This commit is contained in:
3err0
2019-05-18 13:46:03 +08:00
commit 55e0adfa17
707 changed files with 55878 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
<?php
@error_reporting( 7 );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
@session_start();
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
require_once SYSTEM_DIR . '/classes/templates.class.php';
$_REQUEST['skin'] = totranslit($_REQUEST['skin'], false, false);
if( ! @is_dir( ROOT_DIR . '/templates/' . $_REQUEST['skin'] ) ) {die( "Hacking attempt!" );}
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {
$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {$user_group[$row['id']][$key] = stripslashes($value);}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
@include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR . '/modules/sitelogin.php';
$tpl = new dle_template( );
$tpl->dir = ROOT_DIR . '/templates/' . $_REQUEST['skin'];
define( 'TEMPLATE_DIR', $tpl->dir );
$ajax_adds = true;
$_POST['name'] = convert_unicode( $_POST['name'], $config['charset'] );
$_POST['mail'] = convert_unicode( $_POST['mail'], $config['charset'] );
$_POST['comments'] = convert_unicode( $_POST['comments'], $config['charset'] );
require_once SYSTEM_DIR . '/modules/addcomments.php';
if( $CN_HALT != TRUE ) {
include_once SYSTEM_DIR . '/classes/comments.class.php';
$comments = new Comments( $db, 1, 1 );
$comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, name, rating, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, signature, foto, repa, repa_mod, repa_off FROM " . PREFIX . "_comments LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '$post_id' order by id DESC";
$comments->build_comments('ajax');
} $clear_value = "form.comments.value = '';";
if( $CN_HALT ) {
$stop = implode( '<br /><br />', $stop );
$tpl->result['content'] = "<script language=\"JavaScript\" type=\"text/javascript\">\nvar form = document.getElementById('dle-comments-form');\n";
if( ! $where_approve ) $tpl->result['content'] .= "{$clear_value}";
$tpl->result['content'] .= "\n alert ('" . $stop . "');\n var timeval = new Date().getTime();\n
\n </script>";
} else {
$tpl->result['content'] = "<div id=\"blind-animation\" style=\"display:none\">".$tpl->result['content']."<div>";
$tpl->result['content'] .= <<<HTML
<script language='JavaScript' type="text/javascript">
var timeval = new Date().getTime();
var form = document.getElementById('dle-comments-form');
{$clear_value}
</script>
HTML;
}
$tpl->result['content'] = str_replace( '{THEME}', $config['http_home_url'] . 'templates/' . $_REQUEST['skin'], $tpl->result['content'] );
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $tpl->result['content'];
?>
+134
View File
@@ -0,0 +1,134 @@
<?PHP
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if ($addtype == "addnews") {
$addform = "document.ajaxnews".$id;
$startform = "dleeditnews".$id;
$code = <<<HTML
<div style="width:99%; height:50px; border:1px solid #BBB; background-image:url('{THEME}/bbcodes/images/bg.gif');">
<div id="b_b" class="editor_button" onclick="simpletag('b')"><img title="$lang[bb_t_b]" src="{THEME}/bbcodes/images/b.gif" width="23" height="25" border="0"></div>
<div id="b_i" class="editor_button" onclick="simpletag('i')"><img title="$lang[bb_t_i]" src="{THEME}/bbcodes/images/i.gif" width="23" height="25" border="0"></div>
<div id="b_u" class="editor_button" onclick="simpletag('u')"><img title="$lang[bb_t_u]" src="{THEME}/bbcodes/images/u.gif" width="23" height="25" border="0"></div>
<div id="b_s" class="editor_button" onclick="simpletag('s')"><img title="$lang[bb_t_s]" src="{THEME}/bbcodes/images/s.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick=tag_image()><img title="$lang[bb_b_img]" src="{THEME}/bbcodes/images/image.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick="tag_url()"><img title="$lang[bb_t_url]" src="{THEME}/bbcodes/images/link.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick="tag_email()"><img title="$lang[bb_t_m]" src="{THEME}/bbcodes/images/email.gif" width="23" height="25" border="0"></div>
<div class="editor_button" onclick="tag_video()"><img title="$lang[bb_t_video]" src="{THEME}/bbcodes/images/mp.gif" width="23" height="25" border="0"></div>
<div class="editor_button" onclick="tag_audio()"><img src="{THEME}/bbcodes/images/mp3.gif" width="23" height="25" border="0"></div>
<div id="b_hide" class="editor_button" onclick="simpletag('hide')"><img title="$lang[bb_t_hide]" src="{THEME}/bbcodes/images/hide.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_color" class="editor_button" onclick="ins_color();"><img src="{THEME}/bbcodes/images/color.gif" width="23" height="25" border="0"></div>
<div id="b_spoiler" class="editor_button" onclick="spoiler()"><img src="{THEME}/bbcodes/images/spoiler.gif" width="23" height="25" border="0"></div>
<div class="editor_button" onclick="tag_kp()"><img title="Ðåéòèíã ÊèíîÏîèñêà" src="{THEME}/bbcodes/rating.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick="tag_flash()"><img src="{THEME}/bbcodes/images/flash.gif" width="23" height="25" border="0" alt="" /></div>
<div class="editbclose" onclick="closeall()"><img title="$lang[bb_t_cl]" src="{THEME}/bbcodes/images/close.gif" width="23" height="25" border="0"></div>
<div class="editor_button_brk"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" style="padding-top:4px;width:120px;"><select name="bbfont" class="editor_button" onchange="insert_font(this.options[this.selectedIndex].value, 'font')"><option value='0'>{$lang['bb_t_font']}</option><option value='Arial'>Arial</option><option value='Arial Black'>Arial Black</option><option value='Century Gothic'>Century Gothic</option><option value='Courier New'>Courier New</option><option value='Georgia'>Georgia</option><option value='Impact'>Impact</option><option value='System'>System</option><option value='Tahoma'>Tahoma</option><option value='Times New Roman'>Times New Roman</option><option value='Verdana'>Verdana</option></select></div>
<div class="editor_button" style="padding-top:4px;width:65px;"><select name="bbsize" class="editor_button" onchange="insert_font(this.options[this.selectedIndex].value, 'size')"><option value='0'>{$lang['bb_t_size']}</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option></select></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_left" class="editor_button" onclick="simpletag('left')"><img title="$lang[bb_t_l]" src="{THEME}/bbcodes/images/l.gif" width="23" height="25" border="0"></div>
<div id="b_center" class="editor_button" onclick="simpletag('center')"><img title="$lang[bb_t_c]" src="{THEME}/bbcodes/images/c.gif" width="23" height="25" border="0"></div>
<div id="b_right" class="editor_button" onclick="simpletag('right')"><img title="$lang[bb_t_r]" src="{THEME}/bbcodes/images/r.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_quote" class="editor_button" onclick="simpletag('quote')"><img title="$lang[bb_t_quote]" src="{THEME}/bbcodes/images/quote.gif" width="23" height="25" border="0"></div>
<div id="b_code" class="editor_button" onclick="simpletag('code')"><img title="$lang[bb_t_code]" src="{THEME}/bbcodes/images/code.gif" width="23" height="25" border="0"></div>
<div class="editor_button">&nbsp;<img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick="tag_media()"><img src="{THEME}/bbcodes/images/youtube.gif" width="23" height="25" border="0" alt="" /></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
</div>
<iframe width="154" height="104" id="cp" src="{THEME}/bbcodes/color.html" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; display: none; position: absolute;"></iframe>
HTML;
}
else {
$addform = "document.ajaxcomments".$id;
$startform = "dleeditcomments".$id;
if ($user_group[$member_id['user_group']]['allow_url'])
{
$url_link = "<div class=\"editor_button\" onclick=\"tag_url()\"><img title=\"$lang[bb_t_url]\" src=\"{THEME}/bbcodes/images/link.gif\" width=\"23\" height=\"25\" border=\"0\"></div>";
}
else {$url_link = "";}
if ($user_group[$member_id['user_group']]['allow_image'])
{
$image_link = "<div class=\"editor_button\" onclick=tag_image()><img title=\"$lang[bb_b_img]\" src=\"{THEME}/bbcodes/images/image.gif\" width=\"23\" height=\"25\" border=\"0\"></div>";
}
else $image_link = "";
$code = <<<HTML
<div style="width:99%; height:25px; border:1px solid #BBB; background-image:url('{THEME}/bbcodes/images/bg.gif')">
<div id="b_b" class="editor_button" onclick="simpletag('b')"><img title="$lang[bb_t_b]" src="{THEME}/bbcodes/images/b.gif" width="23" height="25" border="0"></div>
<div id="b_i" class="editor_button" onclick="simpletag('i')"><img title="$lang[bb_t_i]" src="{THEME}/bbcodes/images/i.gif" width="23" height="25" border="0"></div>
<div id="b_u" class="editor_button" onclick="simpletag('u')"><img title="$lang[bb_t_u]" src="{THEME}/bbcodes/images/u.gif" width="23" height="25" border="0"></div>
<div id="b_s" class="editor_button" onclick="simpletag('s')"><img title="$lang[bb_t_s]" src="{THEME}/bbcodes/images/s.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_left" class="editor_button" onclick="simpletag('left')"><img title="$lang[bb_t_l]" src="{THEME}/bbcodes/images/l.gif" width="23" height="25" border="0"></div>
<div id="b_center" class="editor_button" onclick="simpletag('center')"><img title="$lang[bb_t_c]" src="{THEME}/bbcodes/images/c.gif" width="23" height="25" border="0"></div>
<div id="b_right"class="editor_button" onclick="simpletag('right')"><img title="$lang[bb_t_r]" src="{THEME}/bbcodes/images/r.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
{$url_link}
{$image_link}
<div class="editor_button" onclick="tag_email()"><img title="$lang[bb_t_m]" src="{THEME}/bbcodes/images/email.gif" width="23" height="25" border="0"></div>
<div id="b_color" class="editor_button" onclick="ins_color();"><img src="{THEME}/bbcodes/images/color.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/images/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_hide" class="editor_button" onclick="simpletag('hide')"><img title="$lang[bb_t_hide]" src="{THEME}/bbcodes/images/hide.gif" width="23" height="25" border="0"></div>
<div id="b_quote" class="editor_button" onclick="simpletag('quote')"><img title="$lang[bb_t_quote]" src="{THEME}/bbcodes/images/quote.gif" width="23" height="25" border="0"></div>
<div id="b_spoiler" class="editor_button" onclick="spoiler();"><img src="{THEME}/bbcodes/images/spoiler.gif" width="23" height="25" border="0"></div>
</div>
<iframe width="154" height="104" id="cp" src="{THEME}/bbcodes/color.html" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; display: none; position: absolute;"></iframe>
<div id="dle_emo" style="visibility:hidden; display: none; position: absolute; width:255px; height: 235px; overflow: auto; border: 1px solid #BBB; background:#E9E8F2;filter: alpha(opacity=95, enabled=1) progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3);">{$output}</div>
HTML;
}
$script_code = @file_get_contents(SYSTEM_DIR."/ajax/bbcodes.js");
$script_code .= <<<HTML
-->
</SCRIPT>
HTML;
$bb_code = <<<HTML
<SCRIPT type=text/javascript>
<!--
var text_enter_url = "$lang[bb_url]";
var text_enter_size = "$lang[bb_flash]";
var text_enter_flash = "$lang[bb_flash_url]";
var text_enter_page = "$lang[bb_page]";
var text_enter_url_name = "$lang[bb_url_name]";
var text_enter_page_name = "$lang[bb_page_name]";
var text_enter_image = "$lang[bb_image]";
var text_enter_email = "$lang[bb_email]";
var text_code = "$lang[bb_code]";
var text_quote = "$lang[bb_quote]";
var error_no_url = "$lang[bb_no_url]";
var error_no_title = "$lang[bb_no_title]";
var error_no_email = "$lang[bb_no_email]";
var prompt_start = "$lang[bb_prompt_start]";
var img_title = "$lang[bb_img_title]";
var email_title = "$lang[bb_email_title]";
var text_pages = "$lang[bb_bb_page]";
var image_align = "{$config['image_align']}";
var selField = "{$startform}";
var fombj = {$addform};
{$script_code}
{$code}
HTML;
$bb_code = str_replace ("{THEME}", $config['http_home_url']."system/skins", $bb_code);
?>
+340
View File
@@ -0,0 +1,340 @@
var uagent = navigator.userAgent.toLowerCase();
var is_safari = ( (uagent.indexOf('safari') != -1) || (navigator.vendor == "Apple Computer, Inc.") );
var is_opera = (uagent.indexOf('opera') != -1);
var is_ie = ( (uagent.indexOf('msie') != -1) && (!is_opera) && (!is_safari) );
var is_ie4 = ( (is_ie) && (uagent.indexOf("msie 4.") != -1) );
var is_win = ( (uagent.indexOf("win") != -1) || (uagent.indexOf("16bit") !=- 1) );
var ua_vers = parseInt(navigator.appVersion);
var ie_range_cache = '';
var bbtags = new Array();
function setFieldName(which)
{
if (which != selField)
{
selField = which;
}
};
function ins_smile ( text ){
doInsert(' ' + text + ' ', '', false);
ie_range_cache = null;
};
function simpletag(thetag)
{
doInsert("[" + thetag + "]", "[/" + thetag + "]", true);
}
function tag_url()
{
var FoundErrors = '';
var thesel = get_sel(eval('fombj.'+ selField))
if (!thesel) {
thesel ='My Webpage';
}
var enterURL = prompt(text_enter_url, "http://");
var enterTITLE = prompt(text_enter_url_name, thesel);
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (!enterTITLE) {
FoundErrors += " " + error_no_title;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
doInsert("[url="+enterURL+"]"+enterTITLE+"[/url]", "", false);
};
function tag_kp(){var a="",b="";(b=ua_vers>=4&&is_ie&&is_win?document.selection.createRange().text:"")||(b="");(b=prompt("Insert Kinopoisk ID",b))||(a+=" "+error_no_url);a?alert("Error!"+a):doInsert("[center][kp="+b+"][/center]","",false)}
function tag_game(){var a="",b="";(b=ua_vers>=4&&is_ie&&is_win?document.selection.createRange().text:"")||(b="");(b=prompt("Insert Game ID",b))||(a+=" "+error_no_url);a?alert("Error!"+a):doInsert("[center][game="+b+"][/center]","",false)}
function tag_media()
{
var FoundErrors = '';
var thesel = get_sel(eval('fombj.'+ selField))
if (!thesel) {
thesel ='http://';
}
var enterURL = prompt(text_enter_url, thesel);
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
doInsert("[media="+enterURL+"]", "", false);
};
function tag_flash()
{
var FoundErrors = '';
var enterURL = prompt(text_enter_flash, "http://");
var size = prompt(text_enter_size, "425,264");
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
doInsert("[flash="+size+"]"+enterURL+"[/flash]", "", false);
};
function tag_image()
{
var FoundErrors = '';
var enterURL = prompt(text_enter_image, "http://");
var Title = prompt(img_title, image_align);
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
if (Title == "")
{
doInsert("[img]"+enterURL+"[/img]", "", false);
}
else {
if (Title == "center") {
doInsert("[center][img]"+enterURL+"[/img][/center]", "", false);
}
else {
doInsert("[img="+Title+"]"+enterURL+"[/img]", "", false);
}
}
};
function tag_video()
{
var FoundErrors = '';
var thesel = get_sel(eval('fombj.'+ selField))
if (!thesel) {
thesel ='http://';
}
var enterURL = prompt(text_enter_url, thesel);
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
doInsert("[video="+enterURL+"]", "", false);
};
function tag_audio()
{
var FoundErrors = '';
var thesel = get_sel(eval('fombj.'+ selField))
if (!thesel) {
thesel ='http://';
}
var enterURL = prompt(text_enter_url, thesel);
if (!enterURL) {
FoundErrors += " " + error_no_url;
}
if (FoundErrors) {
alert("Error!"+FoundErrors);
return;
}
doInsert("[audio="+enterURL+"]", "", false);
};
function tag_email()
{
var emailAddress = prompt(text_enter_email, "");
if (!emailAddress) {
alert(error_no_email);
return;
}
var thesel = get_sel(eval('fombj.'+ selField))
if (!thesel) {
thesel ='';
}
var Title = prompt(email_title, thesel);
if (!Title) Title = emailAddress;
doInsert("[email="+emailAddress+"]"+Title+"[/email]", "", false);
};
function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = eval('fombj.'+ selField);
if ( (ua_vers >= 4) && is_ie && is_win)
{
if (obj_ta.isTextEdit)
{
obj_ta.focus();
var sel = document.selection;
var rng = ie_range_cache ? ie_range_cache : sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null)
{
if(ibClsTag != "" && rng.text.length > 0)
ibTag += rng.text + ibClsTag;
else if(isSingle)
ibTag += rng.text + ibClsTag;
rng.text = ibTag;
}
}
else
{
obj_ta.value += ibTag + ibClsTag;
}
rng.select();
ie_range_cache = null;
}
else if ( obj_ta.selectionEnd )
{
var ss = obj_ta.selectionStart;
var st = obj_ta.scrollTop;
var es = obj_ta.selectionEnd;
if (es <= 2)
{
es = obj_ta.textLength;
}
var start = (obj_ta.value).substring(0, ss);
var middle = (obj_ta.value).substring(ss, es);
var end = (obj_ta.value).substring(es, obj_ta.textLength);
if (obj_ta.selectionEnd - obj_ta.selectionStart > 0)
{
middle = ibTag + middle + ibClsTag;
}
else
{
middle = ibTag + middle + ibClsTag;
}
obj_ta.value = start + middle + end;
var cpos = ss + (middle.length);
obj_ta.selectionStart = cpos;
obj_ta.selectionEnd = cpos;
obj_ta.scrollTop = st;
}
else
{
obj_ta.value += ibTag + ibClsTag;
}
obj_ta.focus();
return isClose;
};
function ins_color(buttonElement)
{
document.getElementById(selField).focus();
if ( is_ie )
{
document.getElementById(selField).focus();
ie_range_cache = document.selection.createRange();
}
$("#cp").remove();
$("body").append("<div id='cp' title='Öâåò' style='display:none'><br /><iframe width=\"154\" height=\"104\" src=\"" + dle_root + "templates/" + dle_skin + "/bbcodes/color.html\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"></iframe></div>");
$('#cp').dialog({
autoOpen: true,
dialogClass: "modalfixed",
width: 180
});
$('.modalfixed.ui-dialog').css({position:"fixed"});
$('#cp').dialog( "option", "position", ['0','0'] );
};
function setColor(color)
{
doInsert("[color=" +color+ "]", "[/color]", true );
$('#cp').dialog("close");
};
function insert_font(value, tag)
{
if (value == 0)
{
return;
}
doInsert("[" +tag+ "=" +value+ "]", "[/" +tag+ "]", true );
fombj.bbfont.selectedIndex = 0;
fombj.bbsize.selectedIndex = 0;
};
function get_sel(obj)
{
if (document.selection)
{
if ( is_ie )
{
document.getElementById(selField).focus();
ie_range_cache = document.selection.createRange();
}
var s = document.selection.createRange();
if (s.text){return s.text;}
}
else if (typeof(obj.selectionStart)=="number")
{
if (obj.selectionStart!=obj.selectionEnd)
{
var start = obj.selectionStart;
var end = obj.selectionEnd;
return (obj.value.substr(start,end-start));
}
}
return false;
};
function b_hide_n() {var FoundErrors = '';var b_hide_n = prompt("Êàêîé õàéä ïîñòàâèòü?",100); if (!b_hide_n){FoundErrors += " ";} if(FoundErrors){alert("îøèáêà!"+FoundErrors);return;} doInsert("[hide="+b_hide_n+"][/hide]", "", false); }
function spoiler() {var FoundErrors = '';var spoiler = prompt("Ââåäèòå íàçâàíèå ñïîéëåðà"); if (!spoiler){FoundErrors += " ";} if(FoundErrors){alert("îøèáêà!"+FoundErrors);return;} doInsert("[spoiler="+spoiler+"][/spoiler]", "", false); }
+46
View File
@@ -0,0 +1,46 @@
<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
require_once SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
@header("Content-type: text/html; charset=windows-1251");
$cat_info = $cache->get("category");
if (!$cat_info){
$cat_info = array ();
$db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC");
while ($row = $db->get_row())
{
$cat_info[$row['id']] = array ();
foreach ($row as $key => $value)
{
$cat_info[$row['id']][$key] = stripslashes($value);
}
}
$cache->set("category", $cat_info);
$db->free();
}
$adon = $_REQUEST['adon'];
$geta = get_sub_cats($adon);
if ($cat_info[$geta]['parentid'] == '0')
{
$retng = '<select name="catlist[]"><option value="' . $adon . '">Ïîäêàòåãîðèé íåò</option></select>';
}
else
{
$retng = CategoryNewsSelectiod($adon);
}
echo $retng;
?>
+58
View File
@@ -0,0 +1,58 @@
<?php
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
@session_start();
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR.'/data/chat.config.php';
require_once SYSTEM_DIR.'/modules/chat/chat.class.php';
require_once SYSTEM_DIR.'/modules/functions.php';
$user_group = $cache->get("usergroup");
if (!$user_group) {
$user_group = array ();
$db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
while($row = $db->get_row()){
$user_group[$row['id']] = array ();
foreach ($row as $key => $value)
{
$user_group[$row['id']][$key] = $value;
}
}
$cache->set ("usergroup", $user_group);
$db->free();
}
include_once ROOT_DIR.'/language/'.$config['langs'].'/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
$refresh = intval($_REQUEST['refresh']);
$m_id = intval($_REQUEST['mdelete']);
require_once SYSTEM_DIR.'/modules/sitelogin.php';
$chat = new Chat();
if ($m_id != 0 && $refresh && ($member_id['user_group'] == 1 || $member_id['user_group'] == 2)){
$db->query("DELETE FROM ".PREFIX."_chat WHERE id = $m_id");
$cache->del('minichat');
}
$mcadd['message'] = addslashes(convert_unicode($_POST['message'], $config['charset']));
@header("HTTP/1.1 200 OK");
@header("Cache-Control: no-cache, must-revalidate, max-age=0");
@header("Expires: 0");
@header("Pragma: no-cache");
@header( "Content-type: text/html; charset=" . $config['charset'] );
require_once SYSTEM_DIR.'/modules/chat/addmess.php';
echo $chat->GetContent($chatconfig, $member_id, $config);
?>
+246
View File
@@ -0,0 +1,246 @@
<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR.'/inc/include/functions.inc.php';
$selected_language = $config['langs'];
if (isset( $_COOKIE['selected_language'] )) {
$_COOKIE['selected_language'] = trim(totranslit( $_COOKIE['selected_language'], false, false ));
if ($_COOKIE['selected_language'] != "" AND @is_dir ( ROOT_DIR . '/language/' . $_COOKIE['selected_language'] )) {
$selected_language = $_COOKIE['selected_language'];
}
}
require_once ROOT_DIR.'/language/'.$selected_language.'/adminpanel.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR.'/modules/sitelogin.php';
if(($member_id['user_group'] != 1)) {die ("error");}
if ($_REQUEST['user_hash'] == "" OR $_REQUEST['user_hash'] != $dle_login_hash) {
die ("error");
}
if ($_REQUEST['step'] == 10) {
$_REQUEST['step'] = 11;
$db->query("TRUNCATE TABLE " . USERPREFIX . "_lostdb");
$db->query("TRUNCATE TABLE " . PREFIX . "_com_logs");
$db->query("TRUNCATE TABLE " . PREFIX . "_poll_log");
}
if ($_REQUEST['step'] == 8) {
$_REQUEST['step'] = 9;
$db->query("TRUNCATE TABLE " . USERPREFIX . "_pm");
$db->query("UPDATE " . USERPREFIX . "_users set pm_all='0', pm_unread='0'");
}
if ($_REQUEST['step'] == 6) {
$_REQUEST['step'] = 7;
$sql = $db->query("SELECT name, user_id, news_num, comm_num FROM " . USERPREFIX . "_users");
while($row = $db->get_row($sql)){
$posts = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE autor = '{$row['name']}'");
$comms = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_comments WHERE user_id = '{$row['user_id']}'");
if (($posts['count'] != $row['news_num']) OR ($comms['count'] != $row['comm_num']))
$db->query("UPDATE " . USERPREFIX . "_users set news_num={$posts['count']}, comm_num={$comms['count']} where user_id='{$row['user_id']}'");
}
$db->free ($sql);
}
if ($_REQUEST['step'] == 4) {
if ((@strtotime($_REQUEST['date']) === -1) OR (trim($_REQUEST['date']) == ""))
$_REQUEST['step'] = 3;
else {
$_REQUEST['step'] = 5;
$sql = $db->query("SELECT COUNT(*) as count, post_id FROM " . PREFIX . "_comments WHERE date < '{$_REQUEST['date']}' GROUP BY post_id");
while($row = $db->get_row($sql)){
$db->query("UPDATE " . PREFIX . "_post set comm_num=comm_num-{$row['count']} where id='{$row['post_id']}'");
}
$db->query("DELETE FROM " . PREFIX . "_comments WHERE date < '{$_REQUEST['date']}'");
$db->free ($sql);
$cache->clear();
}
}
if ($_REQUEST['step'] == 2) {
if ((@strtotime($_REQUEST['date']) === -1) OR (trim($_REQUEST['date']) == ""))
$_REQUEST['step'] = 1;
else {
$_REQUEST['step'] = 3;
$sql = $db->query("SELECT id FROM " . PREFIX . "_post WHERE date < '{$_REQUEST['date']}'");
while($row = $db->get_row($sql)){
$db->query("DELETE FROM " . PREFIX . "_comments WHERE post_id='{$row['id']}'");
$db->query("DELETE FROM " . PREFIX . "_files WHERE news_id = '{$row['id']}'");
$db->query("DELETE FROM " . PREFIX . "_poll WHERE news_id = '{$row['id']}'");
$db->query("DELETE FROM " . PREFIX . "_poll_log WHERE news_id = '{$row['id']}'");
$db->query("DELETE FROM " . PREFIX . "_tags WHERE news_id = '{$row['id']}'" );
$getfiles = $db->query("SELECT onserver FROM " . PREFIX . "_files WHERE news_id = '{$row['id']}'");
while($file = $db->get_row($getfiles)){
@unlink(ROOT_DIR."/uploads/files/".$file['onserver']);
}
$db->free ($getfiles);
$image = $db->super_query("SELECT images FROM " . PREFIX . "_images where news_id = '{$row['id']}'");
$listimages = explode("|||", $image['images']);
if ($image['images'] != "")
foreach ($listimages as $dataimages) {
$url_image = explode("/", $dataimages);
if (count($url_image) == 2) {
$folder_prefix = $url_image[0]."/";
$dataimages = $url_image[1];
} else {
$folder_prefix = "";
$dataimages = $url_image[0];
}
@unlink(ROOT_DIR."/uploads/posts/".$folder_prefix.$dataimages);
@unlink(ROOT_DIR."/uploads/posts/".$folder_prefix."thumbs/".$dataimages);
}
$db->query("DELETE FROM " . PREFIX . "_images WHERE news_id = '{$row['id']}'");
}
$db->query("DELETE FROM " . PREFIX . "_post WHERE date < '{$_REQUEST['date']}'");
$db->free ($sql);
$cache->clear();
}
}
if ($_REQUEST['step'] == 11) {
$rs = $db->query("SHOW TABLE STATUS FROM `".DBNAME."`");
while ($r = $db->get_array($rs)) {
$db->query("OPTIMIZE TABLE ". $r['Name']);
}
$db->free ($rs);
$db->query("SHOW TABLE STATUS FROM `".DBNAME."`");
$mysql_size = 0;
while ($r = $db->get_array()) {
if (strpos($r['Name'], PREFIX."_") !== false)
$mysql_size += $r['Data_length'] + $r['Index_length'] ;
}
$lang['clean_finish'] = str_replace ('{db-alt}', '<font color="red">'.mksize($_REQUEST['size']).'</font>', $lang['clean_finish']);
$lang['clean_finish'] = str_replace ('{db-new}', '<font color="red">'.mksize($mysql_size).'</font>', $lang['clean_finish']);
$lang['clean_finish'] = str_replace ('{db-compare}', '<font color="red">'.mksize($_REQUEST['size'] - $mysql_size).'</font>', $lang['clean_finish']);
$buffer = <<<HTML
<br />{$lang['clean_finish']}
<br /><br />
HTML;
}
if ($_REQUEST['step'] == 9) {
$buffer = <<<HTML
<br />{$lang['clean_logs']}
<br /><br /><font color="red"><span id="status"></span></font><br /><br />
<input id = "next_button" onclick="start_clean('10', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:100px;" type="button" value="{$lang['edit_next']}">&nbsp;
<input id = "skip_button" onclick="start_clean('11', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:150px;" type="button" value="{$lang['clean_skip']}">
HTML;
}
if ($_REQUEST['step'] == 7) {
$buffer = <<<HTML
<br />{$lang['clean_pm']}
<br /><br /><font color="red"><span id="status"></span></font><br /><br />
<input id = "next_button" onclick="start_clean('8', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:100px;" type="button" value="{$lang['edit_next']}">&nbsp;
<input id = "skip_button" onclick="start_clean('9', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:150px;" type="button" value="{$lang['clean_skip']}">
HTML;
}
if ($_REQUEST['step'] == 5) {
$buffer = <<<HTML
<br />{$lang['clean_users']}
<br /><br /><font color="red"><span id="status"></span></font><br /><br />
<input id = "next_button" onclick="start_clean('6', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:100px;" type="button" value="{$lang['edit_next']}">&nbsp;
<input id = "skip_button" onclick="start_clean('7', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:150px;" type="button" value="{$lang['clean_skip']}">
HTML;
}
if ($_REQUEST['step'] == 3) {
$buffer = <<<HTML
<br />{$lang['clean_comments']}<br /><br />{$lang['addnews_date']}&nbsp;<input type="text" name="date" id="f_date_c" size="20" class=edit>
<img src="system/skins/images/img.gif" align="absmiddle" id="f_trigger_c" style="cursor: pointer; border: 0" />
<script type="text/javascript">
Calendar.setup({
inputField : "f_date_c", // id of the input field
ifFormat : "%Y-%m-%d", // format of the input field
button : "f_trigger_c", // trigger for the calendar (button ID)
align : "Br", // alignment
singleClick : true
});
</script>
<br /><br /><font color="red"><span id="status"></span></font><br /><br />
<input id = "next_button" onclick="start_clean('4', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:100px;" type="button" value="{$lang['edit_next']}">&nbsp;
<input id = "skip_button" onclick="start_clean('5', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:150px;" type="button" value="{$lang['clean_skip']}">
HTML;
}
if ($_REQUEST['step'] == 1) {
$buffer = <<<HTML
<br />{$lang['clean_news']}<br /><br />{$lang['addnews_date']}&nbsp;<input type="text" name="date" id="f_date_c" size="20" class=edit>
<img src="system/skins/images/img.gif" align="absmiddle" id="f_trigger_c" style="cursor: pointer; border: 0" />
<script type="text/javascript">
Calendar.setup({
inputField : "f_date_c", // id of the input field
ifFormat : "%Y-%m-%d", // format of the input field
button : "f_trigger_c", // trigger for the calendar (button ID)
align : "Br", // alignment
singleClick : true
});
</script>
<br /><br /><font color="red"><span id="status"></span></font><br /><br />
<input id = "next_button" onclick="start_clean('2', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:100px;" type="button" value="{$lang['edit_next']}">&nbsp;
<input id = "skip_button" onclick="start_clean('3', '{$_REQUEST['size']}'); return false;" class="buttons" style="width:150px;" type="button" value="{$lang['clean_skip']}">
HTML;
}
@header("Content-type: text/css; charset=".$config['charset']);
echo $buffer;
?>
+51
View File
@@ -0,0 +1,51 @@
<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR.'/modules/functions.php';
require_once SYSTEM_DIR.'/modules/sitelogin.php';
if( !$is_logged ) die( "error" );
$id = intval( $_REQUEST['commid'] );
if( ! $id ) die( "error" );
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {$user_group[$row['id']][$key] = stripslashes($value);}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
$row = $db->super_query("SELECT * FROM " . PREFIX . "_comments where id = '$id'");
$author = $row['autor'];
$is_reg = $row['is_register'];
$post_id = $row['post_id'];
if ($row['id'] AND $post_id){
$have_perm = false;
if (($member_id['user_id'] == $row['user_id'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_delc']) or $member_id['user_group'] == '1' or $user_group[$member_id['user_group']]['del_allc'] ) $have_perm = true;
//if ( $user_group[$member_id['user_group']]['edit_limit'] AND (($row['date'] + ($user_group[$member_id['user_group']]['edit_limit'] * 60)) < $_TIME) ) {$have_perm = false;} Îãðàíè÷åíèå íà óäàëåíèå êîììåíòîâ äíåì ïîçæå
if($have_perm){
$db->query("DELETE FROM " . PREFIX . "_comments where id = '$id'");
if ($is_reg) $author = $db->safesql($author); {$db->query("UPDATE " . USERPREFIX . "_users set comm_num=comm_num-1 where name ='$author'");}
$db->query("UPDATE " . PREFIX . "_post set comm_num=comm_num-1 where id='$post_id'") ;
$cache->clear( array( 'news_', 'comments-last', 'comm_'.$post_id, 'full_'.$post_id ) );
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo "<div class=\"block2 line_center\"><b>Êîììåíòàðèé ïîä óíèêàëüíûì íîìåðîì: $id, áûë óñïåøíî óäàë¸í èç áàçû.</b></div>";
} else die( "error" );
} else die( "error" );
?>
+146
View File
@@ -0,0 +1,146 @@
<?php
@session_start();
@error_reporting( 7 );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
if( $_COOKIE['dle_skin'] ) {
if( @is_dir( ROOT_DIR . '/templates/' . $_COOKIE['dle_skin'] ) ) {
$config['skin'] = $_COOKIE['dle_skin'];
}
}
include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR . '/modules/functions.php';
require_once SYSTEM_DIR . '/classes/parse.class.php';
require_once SYSTEM_DIR . '/modules/sitelogin.php';
$area = totranslit($_REQUEST['area'], true, false);
if ( !$area) $area = "news";
$allowed_areas = array(
'news' => array (
'comments_table' => 'comments',
),
'ajax' => array (
'comments_table' => 'comments',
),
'lastcomments' => array (
'comments_table' => 'comments',
),
);
if (! is_array($allowed_areas[$area]) ) die( "error" );
$parse = new ParseFilter( );
$parse->safe_mode = true;
if( ! $is_logged ) die( "error" );
$id = intval( $_REQUEST['id'] );
if( ! $id ) die( "error" );
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {$user_group[$row['id']][$key] = stripslashes($value);}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
$parse->allow_url = $user_group[$member_id['user_group']]['allow_url'];
$parse->allow_image = $user_group[$member_id['user_group']]['allow_image'];
if( $_REQUEST['action'] == "edit" ) {
$row = $db->super_query( "SELECT id, text, is_register, autor FROM " . PREFIX . "_{$allowed_areas[$area]['comments_table']} where id = '$id'" );
if( $id != $row['id'] ) die( "error" );
$have_perm = 0;
if( $is_logged and (($member_id['name'] == $row['autor'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_editc']) or $user_group[$member_id['user_group']]['edit_allc']) ) {
$have_perm = 1;
}
if( ! $have_perm ) die( "error" );
include_once SYSTEM_DIR . '/ajax/bbcode.php';
$comm_txt = $parse->decodeBBCodes( $row['text'], false );
$buffer = <<<HTML
<form name="ajaxcomments{$id}" id="ajaxcomments{$id}" metod="post" action="">
<div class="editor">
{$bb_code}
<textarea name="dleeditcomments{$id}" id="dleeditcomments{$id}" onclick="setNewField(this.name, document.ajaxcomments{$id})" style="width:99%; height:150px; border:1px solid #E0E0E0">{$comm_txt}</textarea><br>
<div align="right" style="width:99%;padding-top:5px;"><input class=bbcodes title="$lang[bb_t_apply]" type=button onclick="ajax_save_comm_edit('{$id}', '{$area}'); return false;" value="$lang[bb_b_apply]">
<input class=bbcodes title="$lang[bb_t_cancel]" type=button onclick="ajax_cancel_comm_edit('{$id}'); return false;" value="$lang[bb_b_cancel]">
</div></div>
</form>
HTML;
} elseif( $_REQUEST['action'] == "save" ) {
$row = $db->super_query( "SELECT id, post_id, text, is_register, autor FROM " . PREFIX . "_{$allowed_areas[$area]['comments_table']} where id = '$id'" );
if( $id != $row['id'] ) die( "error" );
$have_perm = 0;
if( $is_logged AND (($member_id['name'] == $row['autor'] AND $row['is_register'] AND $user_group[$member_id['user_group']]['allow_editc']) OR $user_group[$member_id['user_group']]['edit_allc']) ) {
$have_perm = 1;
}
if( ! $have_perm ) die( "error" );
$use_html = false;
$comm_txt = trim( $parse->BB_Parse( $parse->process( convert_unicode( $_POST['comm_txt'], $config['charset'] ) ), $use_html ) );
if( $parse->not_allowed_tags ) {die( "error" );}
if( $parse->not_allowed_text ) {die( "error" );}
if( strlen( $comm_txt ) > $config['comments_maxlen'] ) {die( "error" );}
if( $comm_txt == "" ) {die( "error" );}
//* Àâòîïåðåíîñ äëèííûõ ñëîâ
if( intval( $config['auto_wrap'] ) ) {
$comm_txt = preg_split( '((>)|(<))', $comm_txt, - 1, PREG_SPLIT_DELIM_CAPTURE );
$n = count( $comm_txt );
for($i = 0; $i < $n; $i ++) {
if( $comm_txt[$i] == "<" ) {
$i ++;
continue;
}
$comm_txt[$i] = preg_replace( "#([^\s\n\r]{" . intval( $config['auto_wrap'] ) . "})#i", "\\1<br />", $comm_txt[$i] );
}
$comm_txt = join( "", $comm_txt );
}
$comm_update = $db->safesql( $comm_txt );
$db->query( "UPDATE " . PREFIX . "_{$allowed_areas[$area]['comments_table']} set text='$comm_update' where id = '$id'" );
$comm_txt = preg_replace( "'\[hide\](.*?)\[/hide\]'si", "\\1", $comm_txt );
$comm_txt = preg_replace ( "'\[hide=(.*?)\](.*?)\[/hide\]'sie",'comm_hide($1,"\\2")',$comm_txt);
$buffer = stripslashes( $comm_txt );
$cache->clear( 'comm_'.$row['post_id'] );
} else
die( "error" );
$db->close();
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $buffer;
?>
+53
View File
@@ -0,0 +1,53 @@
<?php
@session_start();
@error_reporting( 7 );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
$_REQUEST['skin'] = totranslit($_REQUEST['skin'], false, false);
if( ! @is_dir( ROOT_DIR . '/templates/' . $_REQUEST['skin'] ) ) {die( "Hacking attempt!" );} else {$config['skin'] = $_REQUEST['skin'];}
include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR . '/modules/sitelogin.php';
if( ! $is_logged ) die( "error" );
$id = intval( $_REQUEST['fav_id'] );
if( ! $id ) die( "error" );
if( $_REQUEST['action'] == "plus" ) {
$error = "";
$list = explode( ",", $member_id['favorites'] );
foreach ( $list as $daten ) {if( $daten == $id ) $error = "stop";}
if( $error != "stop" ) {
$list[] = $id;
$favorites = implode( ",", $list );
if( $member_id['favorites'] == "" ) $favorites = $id;
$member_id['favorites'] = $favorites;
$db->query( "UPDATE " . USERPREFIX . "_users set favorites='$favorites' where user_id = '$member_id[user_id]'" );
}
$buffer = "<img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/images/del_fav.png\" onclick=\"doFavorites('" . $id . "', 'minus'); return false;\" title=\"" . $lang['news_minfav'] . "\" style=\"vertical-align: middle;border: none;\" />";
} elseif( $_REQUEST['action'] == "minus" ) {
$list = explode( ",", $member_id['favorites'] );
$i = 0;
foreach ( $list as $daten ) {if( $daten == $id ) unset( $list[$i] ); $i ++;}
if( count( $list ) ) $member_id['favorites'] = $db->safesql(implode( ",", $list )); else $member_id['favorites'] = "";
$db->query( "UPDATE " . USERPREFIX . "_users set favorites='$member_id[favorites]' where user_id = '$member_id[user_id]'" );
$buffer = "<img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/images/add_fav.png\" onclick=\"doFavorites('" . $id . "', 'plus'); return false;\" title=\"" . $lang['news_addfav'] . "\" style=\"vertical-align: middle;border: none;\" />";
} else die( "error" );
$db->close();
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $buffer;
?>
+38
View File
@@ -0,0 +1,38 @@
<?php
@session_start();
@error_reporting( 7 );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
require_once SYSTEM_DIR . '/modules/sitelogin.php';
if( ! $is_logged ) die( "error" );
$title = $db->safesql( trim( convert_unicode( $_POST['title'], $config['charset'] ) ) );
if( $title == "" ) die();
$buffer = "";
$id = intval( $_POST['id'] );
if( $id ) $where = " AND id != '" . $id . "'"; else $where = "";
$db->query( "SELECT id, title, date, alt_name, MATCH (title, short_story) AGAINST ('$title') as score FROM " . PREFIX . "_post WHERE MATCH (title, short_story) AGAINST ('$title') AND approve='1'" . $where . " ORDER BY score DESC, date DESC LIMIT 5" );
while ( $related = $db->get_row() ) {
$related['date'] = strtotime( $related['date'] );
$news_date = date( 'd-m-Y', $related['date'] );
$full_link = $config['http_home_url'] . $related['id'] . "-" . $related['alt_name'] . ".html";
$buffer .= "<div style=\"padding:2px;\">{$news_date} - <a href=\"".$full_link."\" target=\"_blank\">".stripslashes($related['title'])."</a></div>";
}
$db->close();
@header( "Content-type: text/html; charset=" . $config['charset'] );
if( $buffer ) echo "<div style=\"width:600px; background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\">" . $buffer . "</div>";
else echo "<div style=\"width:542px;background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\">Ïîõîæèõ íîâîñòåé íå íàéäåíî.</div>";
?>
+35
View File
@@ -0,0 +1,35 @@
<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once ROOT_DIR.'/language/'.$config['langs'].'/adminpanel.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR.'/inc/include/functions.inc.php';
require_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter();
$full_story = $parse->BB_Parse($parse->process(convert_unicode($_REQUEST['full_txt'], $config['charset'])), false);
$short_story = $parse->BB_Parse($parse->process(convert_unicode($_REQUEST['short_txt'], $config['charset'])), false);
if ($full_story) $metatags = create_metatags ($full_story);
else $metatags = create_metatags ($short_story);
$metatags['description'] = trim($metatags['description']);
$metatags['keywords'] = trim($metatags['keywords']);
@header( "Content-type: text/html; charset=" . $config['charset'] );
if ($_REQUEST['key'] == 1) echo stripslashes($metatags['description']);
else echo stripslashes($metatags['keywords']);
?>
+196
View File
@@ -0,0 +1,196 @@
<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once ROOT_DIR.'/language/'.$config['langs'].'/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR.'/modules/functions.php';
$user_group = $cache->get ( "usergroup" );
if (! $user_group) {
$user_group = array ();
$db->query ( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row () ) {
$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {
$user_group[$row['id']][$key] = $value;
}}
$cache->set ( "usergroup", $user_group );
$db->free ();
}
require_once SYSTEM_DIR.'/modules/sitelogin.php';
if (!$is_logged OR $member_id['user_group'] != 1) die ("error");
$startfrom = intval($_POST['startfrom']);
if ($_POST['empfanger'] != "all") $empfanger = intval($_POST['empfanger']);
$type = $_POST['type'];
$a_mail = intval($_POST['a_mail']);
$limit = intval($_POST['limit']);
$step = 0;
$title = convert_unicode($_POST['title'], $config['charset']);
$message = convert_unicode($_POST['message'], $config['charset']);
$find = array ('/data:/i', '/about:/i', '/vbscript:/i', '/onclick/i', '/onload/i', '/onunload/i', '/onabort/i', '/onerror/i', '/onblur/i', '/onchange/i', '/onfocus/i', '/onreset/i', '/onsubmit/i', '/ondblclick/i', '/onkeydown/i', '/onkeypress/i', '/onkeyup/i', '/onmousedown/i', '/onmouseup/i', '/onmouseover/i', '/onmouseout/i', '/onselect/i', '/javascript/i', '/javascript/i' );
$replace = array ("d&#097;ta:", "&#097;bout:", "vbscript<b></b>:", "&#111;nclick", "&#111;nload", "&#111;nunload", "&#111;nabort", "&#111;nerror", "&#111;nblur", "&#111;nchange", "&#111;nfocus", "&#111;nreset", "&#111;nsubmit", "&#111;ndblclick", "&#111;nkeydown", "&#111;nkeypress", "&#111;nkeyup", "&#111;nmousedown", "&#111;nmouseup", "&#111;nmouseover", "&#111;nmouseout", "&#111;nselect", "j&#097;vascript" );
$message = preg_replace( $find, $replace, $message );
$message = preg_replace( "#<iframe#i", "&lt;iframe", $message );
$message = preg_replace( "#<script#i", "&lt;script", $message );
$message = str_replace( "<?", "&lt;?", $message );
$message = str_replace( "?>", "?&gt;", $message );
if (!$title OR !$message OR !$limit) die ("error");
if ($type == "pm") {
$time = time()+($config['date_adjust']*60);
$title = $db->safesql($title);
$message = $db->safesql($message);
if ($empfanger != "all")
$result = $db->query("SELECT user_id, name, fullname FROM " . USERPREFIX . "_users where user_group = '$empfanger' LIMIT ".$startfrom.",".$limit);
else
$result = $db->query("SELECT user_id, name, fullname FROM " . USERPREFIX . "_users LIMIT ".$startfrom.",".$limit);
while($row = $db->get_row($result))
{
if ( $row['fullname'] )
$message_send = str_replace("{%user%}", $row['fullname'], $message);
else
$message_send = str_replace("{%user%}", $row['name'], $message);
$db->query("INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder) values ('$title', '$message_send', '$row[user_id]', '$member_id[name]', '$time', 'no', 'inbox')");
$db->query("UPDATE " . USERPREFIX . "_users set pm_all=pm_all+1, pm_unread=pm_unread+1 where user_id='$row[user_id]'");
$step++;
}
$db->free($result);
}
elseif ($type == "email") {
$message = stripslashes( $message );
$title = stripslashes( $title );
$message = <<<HTML
<html><title>{$title}</title>
<meta content="text/html; charset={$config['charset']}" http-equiv=Content-Type>
<style type="text/css">
html,body{
font-size: 11px;
font-family: verdana;
}
a:active,
a:visited,
a:link {
color: #4b719e;
text-decoration:none;
}
a:hover {
color: #4b719e;
text-decoration: underline;
}
</style>
<body>
{$message}
</body>
</html>
HTML;
include_once SYSTEM_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config, true);
$where = array();
if ($empfanger != "all") $where[] = "user_group = '{$empfanger}'";
if ($a_mail) $where[] = "allow_mail = '1'";
if (count($where)) $where = " WHERE ".implode (" AND ", $where);
else $where = "";
if ($config['mail_bcc']) {
$limit = $limit * 6;
$i = 0;
$h_mail = array();
$bcc = array();
$db->query("SELECT email FROM " . USERPREFIX . "_users".$where." LIMIT ".$startfrom.",".$limit);
$db->close();
while($row = $db->get_row())
{
if ($i == 0) { $h_mail[$t] = $row['email'];}
else {$bcc[$t][] = $row['email'];}
$i++;
if ($i == 6) {
$i=0;
$t++;
}
$step++;
}
$db->free();
foreach ($h_mail as $key => $email) {
$mail->bcc = $bcc[$key];
$message_send = str_replace("{%user%}", $lang['nl_info_2'], $message);
$mail->send ($email, $title, $message_send);
}
}
else
{
$db->query("SELECT email, name, fullname FROM " . USERPREFIX . "_users".$where." LIMIT ".$startfrom.",".$limit);
$db->close();
while($row = $db->get_row())
{
if ( $row['fullname'] )
$message_send = str_replace("{%user%}", $row['fullname'], $message);
else
$message_send = str_replace("{%user%}", $row['name'], $message);
$mail->send ($row['email'], $title, $message_send);
$step++;
}
$db->free();
}
}
else
{
die ("error");
}
$count = $startfrom + $step;
$buffer = "{\"status\": \"ok\",\"count\": {$count}}";
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $buffer;
?>
+95
View File
@@ -0,0 +1,95 @@
<?php
@session_start();
error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
if ($_COOKIE['dle_skin']) {if (@is_dir(ROOT_DIR.'/templates/'.$_COOKIE['dle_skin'])){$config['skin'] = $_COOKIE['dle_skin'];}}
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR.'/modules/functions.php';
require_once SYSTEM_DIR.'/modules/sitelogin.php';
require_once SYSTEM_DIR.'/classes/templates.class.php';
$tpl = new dle_template;
$tpl->dir = ROOT_DIR.'/templates/'.$config['skin'];;
define('TEMPLATE_DIR', $tpl->dir);
$id = intval($_REQUEST['news_id']);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// "Íà÷àëî" Ïîêàç êðàòêîãî ñîäåðæàíèÿ
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if($_REQUEST['action'] == "plus")
{
$result = $db->query("SELECT * FROM ".PREFIX."_post WHERE id='{$id}'");
$row = $db->get_row($result);
$tpl->load_template('newslist/newslist.tpl');
/* Äåëàåì ìèíóñ ìåñòî ïëþ÷à */
$tpl->set('{spoiler}',"<img style=\"cursor: pointer;\" src=\"/templates/{$config['skin']}/images/newslist_minus.gif\" onclick=\"newslist('".$row['id']."', 'minus'); return false;\" align=\"absmiddle\" border=\"0\" title=\"Óáðàòü êðàòêîå ñîäåðæàíèå ñòàòüè\"></div>");
$tpl->set("{story}", stripslashes($row['short_story']));
$tpl->set("{title}", stripslashes($row['title']));
$date_news = strtotime($row['date']);
$link = $config['http_home_url'].$row['id']."-".$row['alt_name'].".html";
$tpl->set("{link}", $link);
if(isset($_GET['author'])){$autor = "<a href=\"/user/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}else{$autor = "<a href=\"/newslist/".$category."/author/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}
$tpl->set("{author}", $autor);
if($is_logged){$tpl->set("[hide]", "");$tpl->set("[/hide]", "");}
else{$tpl->set_block("'\\[hide\\](.*?)\\[/hide\\]'si","<div class=\"quote\">Ñêðûòûé òåêñò, íåîáõîäèìà àâòîðèçàöèÿ.</div>");}
$tpl->set("{rating}", $row['rating']);
$date = date("d.m.Y",strtotime($row['date']));
$tpl->set("{date}", $date);
$tpl->set("[ajax]", "");
$tpl->set("[/ajax]", "");
$tpl->set_block("'\\[not-ajax\\](.*?)\\[/not-ajax\\]'si","");
$tpl->set("{coments}", $row['comm_num']);
$tpl->set("{prosmotr}", $row['news_read']);
$tpl->set('{THEME}', $config['http_home_url'].'templates/'.$config['skin']);
$tpl->compile('newslistspoiler');
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $tpl->result['newslistspoiler'];
}elseif($_REQUEST['action'] == "minus"){
$result = $db->query("SELECT * FROM ".PREFIX."_post WHERE id='{$id}'");
$row = $db->get_row($result);
$tpl->load_template('newslist/newslist.tpl');
$tpl->set('{spoiler}',"<img style=\"cursor: pointer;\" src=\"/templates/{$config['skin']}/images/newslist_plus.gif\" onclick=\"newslist('".$row['id']."', 'plus'); return false;\" align=\"absmiddle\" border=\"0\" title=\"Ïîêàçàòü êðàòêîå ñîäåðæàíèå ñòàòüè\"></div>");
$tpl->set("{story}", "");
$tpl->set("{title}", stripslashes($row['title']));
$date_news = strtotime($row['date']);
$link = $config['http_home_url'].$row['id']."-".$row['alt_name'].".html";
$tpl->set("{link}", $link);
if($row['approve'] == 1){$moder = "<font color =\"green\">Äà</a>";}else{$moder = "<font color =\"red\">Íåò</a>";}
if(isset($_GET['author'])){$autor = "<a href=\"/user/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}else{$autor = "<a href=\"/newslist/".$category."/author/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}
$tpl->set("{author}", $autor);
$tpl->set("{rating}", $row['rating']);
$date = date("d.m.Y",strtotime($row['date']));
$tpl->set("{date}", $date);
$tpl->set_block("'\\[ajax\\](.*?)\\[/ajax\\]'si","");
$tpl->set("[not-ajax]", "");
$tpl->set("[/not-ajax]", "");
$tpl->set("{coments}", $row['comm_num']);
$tpl->set("{prosmotr}", $row['news_read']);
$tpl->set('{THEME}', $config['http_home_url'].'templates/'.$config['skin']);
$tpl->compile('newslistspoiler');
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $tpl->result['newslistspoiler'];
}
?>
+162
View File
@@ -0,0 +1,162 @@
<?php
@session_start();
@error_reporting( E_ALL ^ E_NOTICE );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
@ini_set( 'error_reporting', E_ALL ^ E_NOTICE );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {$user_group[$row['id']][$key] = stripslashes($value);}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
require_once SYSTEM_DIR . '/modules/sitelogin.php';
function votes($all, $ansid) {
$data = array ();
$alldata = array ();
if( $all != "" ) {
$all = explode( "|", $all );
foreach ( $all as $vote ) {
list ( $answerid, $answervalue ) = explode( ":", $vote );
$data[$answerid] = intval( $answervalue );
}
}
foreach ( $ansid as $id ) {
$data[$id] ++;
}
foreach ( $data as $key => $value ) {
$alldata[] = intval( $key ) . ":" . intval( $value );
}
$alldata = implode( "|", $alldata );
return $alldata;
}
function get_votes($all) {
$data = array ();
if( $all != "" ) {
$all = explode( "|", $all );
foreach ( $all as $vote ) {
list ( $answerid, $answervalue ) = explode( ":", $vote );
$data[$answerid] = intval( $answervalue );
}
}
return $data;
}
$news_id = intval( $_REQUEST['news_id'] );
$answers = explode( " ", trim( $_REQUEST['answer'] ) );
$buffer = "";
$vote_skin = trim(totranslit( $_REQUEST['vote_skin'], false, false));
$_IP = $db->safesql( $_SERVER['REMOTE_ADDR'] );
if( $is_logged ) $log_id = intval( $member_id['user_id'] );
else $log_id = $_IP;
$poll = $db->super_query( "SELECT * FROM " . PREFIX . "_poll WHERE news_id = '{$news_id}'" );
$log = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_poll_log WHERE news_id = '{$news_id}' AND member ='{$log_id}'" );
if( $log['count'] and $_REQUEST['action'] != "list" ) $_REQUEST['action'] = "results";
if($_REQUEST['action'] != "list" AND !$user_group[$member_id['user_group']]['allow_poll']) $_REQUEST['action'] = "results";
$votes = "";
if( $_REQUEST['action'] == "vote" ) {
$votes = votes( $poll['answer'], $answers );
$db->query( "UPDATE " . PREFIX . "_poll set answer='$votes', votes=votes+" . count( $answers ) . " WHERE news_id = '{$news_id}'" );
$db->query( "INSERT INTO " . PREFIX . "_poll_log (news_id, member) VALUES('{$news_id}', '$log_id')" );
$_REQUEST['action'] = "results";
}
if( $_REQUEST['action'] == "results" ) {
if( $votes == "" ) {
$votes = $poll['answer'];
$allcount = $poll['votes'];
} else {
$allcount = count( $answers ) + $poll['votes'];
}
$answer = get_votes( $votes );
$body = explode( "<br />", stripslashes( $poll['body'] ) );
$pn = 0;
for($i = 0; $i < sizeof( $body ); $i ++) {
$num = $answer[$i];
if( ! $num ) $num = 0;
++ $pn;
if( $pn > 5 ) $pn = 1;
if( $allcount != 0 ) $proc = (100 * $num) / $allcount;
else $proc = 0;
$proc = round( $proc, 2 );
$buffer .= <<<HTML
{$body[$i]} - {$num} ({$proc}%)<br />
<img src="{$config['http_home_url']}templates/{$vote_skin}/images/poll{$pn}.gif" height="10" width="{$proc}%" style="border:1px solid black;" alt="" /><br />
HTML;
}
} elseif( $_REQUEST['action'] == "list" ) {
$body = explode( "<br />", stripslashes( $poll['body'] ) );
if( ! $poll['multiple'] ) {
for($v = 0; $v < sizeof( $body ); $v ++) {
if( ! $v ) $sel = "checked";
else $sel = "";
$buffer .= <<<HTML
<div><input name="dle_poll_votes" type="radio" $sel value="{$v}" /> {$body[$v]}</div>
HTML;
}
} else {
for($v = 0; $v < sizeof( $body ); $v ++) {
$buffer .= <<<HTML
<div><input name="dle_poll_votes[]" type="checkbox" value="{$v}" /> {$body[$v]}</div>
HTML;
}
}
} else
die( "error" );
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $buffer;
?>
+73
View File
@@ -0,0 +1,73 @@
<?php
@session_start();
@error_reporting( 7 );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
$go_rate = intval( $_REQUEST['go_rate'] );
$id = intval( $_REQUEST['id'] );
$type = intval( $_REQUEST['type'] );
if( $go_rate > 1 or $go_rate < -1 ) $go_rate = 0;
if( ! $go_rate or ! $id ) die( "Hacking attempt!" );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
$_REQUEST['skin'] = totranslit($_REQUEST['skin'], false, false);
if( $_REQUEST['skin'] ) {if( @is_dir( ROOT_DIR . '/templates/' . $_REQUEST['skin'] ) ) {$config['skin'] = $_REQUEST['skin'];
} else {die( "Hacking attempt!" );}}
include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {$user_group[$row['id']][$key] = stripslashes($value);}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
require_once SYSTEM_DIR . '/modules/sitelogin.php';
if( ! $user_group[$member_id['user_group']]['allow_rating'] ) die( "Hacking attempt!" );
$_IP = $db->safesql( $_SERVER['REMOTE_ADDR'] );
$member_id['name'] = $db->safesql($member_id['name']);
if( $is_logged ) $where = "member = '{$member_id['name']}'"; else $where = "ip ='{$_IP}'";
$row = $db->super_query( "SELECT type_id FROM " . PREFIX . "_rate where type_id ='$id' AND {$where} AND type='$type'" );
if( ! $row['type_id'] AND count( explode( ".", $_IP ) ) == 4 ) {
if($type==1)$db->query( "UPDATE " . PREFIX . "_post set rating=rating+'$go_rate' where id ='$id'" );
else $db->query("UPDATE " . PREFIX . "_comments set rating=rating+'$go_rate' where id ='$id'");
if ($db->get_affected_rows()){
if( $is_logged ) $user_name = $member_id['name']; else $user_name = "anonymous";
$rate_date = time() + (0 * 60);
$db->query( "INSERT INTO " . PREFIX . "_rate (type_id, ip, member, date, rating, type) values ('$id', '$_IP', '$user_name', '$rate_date', '$go_rate', '$type')" );
$cache->clear( array('news_', 'comm_', 'rss') );
}}
if($type==1){
$row = $db->super_query( "SELECT id, rating FROM " . PREFIX . "_post where id ='$id'" );
$buffer = ShortRating( $row['id'], $row['rating'], false );
}else{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_comments where id ='$id'");
$buffer = CommRating($row['id'], $row['rating'], false);
}
$db->close();
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $buffer;
?>
+124
View File
@@ -0,0 +1,124 @@
<?php
@session_start();
@error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR.'/inc/include/functions.inc.php';
require_once SYSTEM_DIR.'/modules/sitelogin.php';
if(($member_id['user_group'] != 1)) {die ("error");}
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {
$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {
$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {
$user_group[$row['id']][$key] = stripslashes($value);
}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
if ($_REQUEST['user_hash'] == "" OR $_REQUEST['user_hash'] != $dle_login_hash) {die ("error");}
require_once ROOT_DIR.'/language/'.$config['langs'].'/adminpanel.lng';
include_once SYSTEM_DIR . '/classes/parse.class.php';
@header("Content-type: text/html; charset=".$config['charset']);
$startfrom = intval($_POST['startfrom']);
$buffer = "";
$step = 0;
if ( intval( $config['tag_img_width'] ) ) $count_per_step = 5; else $count_per_step = 50;
if($_POST['area'] == "forum" ){
$parse = new ParseFilter(Array(), Array(), 1, 1);
$result = $db->query("SELECT pid, post_text FROM " . PREFIX . "_forum_posts LIMIT ".$startfrom.", ".$count_per_step);
while($row = $db->get_row($result)){
$row['post_text'] = $parse->decodeBBCodes($row['post_text'], false);
$post_text = $parse->process($row['post_text']);
$post_text = $db->safesql($parse->BB_Parse($post_text, true));
$db->query( "UPDATE " . PREFIX . "_forum_posts SET post_text='$post_text' WHERE pid='{$row['pid']}'" );
$step++;
}
$rebuildcount = $startfrom + $step;
$buffer = "{\"status\": \"ok\",\"rebuildcount\": {$rebuildcount}}";
echo $buffer;
} elseif ($_POST['area'] == "comments" ) {
$commparse = new ParseFilter( );
//$commparse->safe_mode = true;
$result = $db->query("SELECT id, text FROM " . PREFIX . "_comments LIMIT ".$startfrom.", ".$count_per_step);
while($row = $db->get_row($result)){
$row['text'] = $commparse->decodeBBCodes( $row['text'], false );
$text = $commparse->process( $row['text'] );
$text = $db->safesql($commparse->BB_Parse( $text, false ));
$db->query( "UPDATE " . PREFIX . "_comments SET text='$text' WHERE id='{$row['id']}'" );
$step++;
}
$rebuildcount = $startfrom + $step;
$buffer = "{\"status\": \"ok\",\"rebuildcount\": {$rebuildcount}}";
echo $buffer;
} elseif ($_POST['area'] == "static" ) {
$parse = new ParseFilter( Array (), Array (), 1, 1 );
$result = $db->query("SELECT id, template FROM " . PREFIX . "_static LIMIT ".$startfrom.", ".$count_per_step);
while($row = $db->get_row($result)){
$row['template'] = $parse->decodeBBCodes( $row['template'], false );
$template = $parse->process( $row['template'] );
$template = $db->safesql($parse->BB_Parse( $template, true ));
$db->query( "UPDATE " . PREFIX . "_static SET template='$template' WHERE id='{$row['id']}'" );
$step++;
}
$rebuildcount = $startfrom + $step;
$buffer = "{\"status\": \"ok\",\"rebuildcount\": {$rebuildcount}}";
echo $buffer;
} else {
$parse = new ParseFilter( Array (), Array (), 1, 1 );
$result = $db->query("SELECT id, short_story, full_story, title FROM " . PREFIX . "_post LIMIT ".$startfrom.", ".$count_per_step);
while($row = $db->get_row($result)){
$row['short_story'] = $parse->decodeBBCodes( $row['short_story'], false );
$row['full_story'] = $parse->decodeBBCodes( $row['full_story'], false );
$short_story = $parse->process( $row['short_story'] );
$full_story = $parse->process( $row['full_story'] );
$full_story = $db->safesql( $parse->BB_Parse( $row['full_story'], false ) );
$short_story = $db->safesql( $parse->BB_Parse( $row['short_story'], false ) );
$db->query( "UPDATE " . PREFIX . "_post SET short_story='$short_story', full_story='$full_story' WHERE id='{$row['id']}'" );
$step++;
}
$cache->clear();
$rebuildcount = $startfrom + $step;
$buffer = "{\"status\": \"ok\",\"rebuildcount\": {$rebuildcount}}";
echo $buffer;
}
?>
+73
View File
@@ -0,0 +1,73 @@
<?php
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
include_once ROOT_DIR.'/language/'.$config['langs'].'/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR.'/modules/functions.php';
require_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter();
function check_name($name)
{
global $lang, $db, $banned_info;
$stop = '';
if (strlen($name) > 20){$stop .= $lang['reg_err_3'];}
if (preg_match("/[\||\'|\<|\>|\[|\]|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\{\+]/",$name)){$stop .= $lang['reg_err_4'];}
if (empty($name)){$stop .= $lang['reg_err_7'];}
if (strpos( strtolower ($name) , '.php' ) !== false) {$stop .= $lang['reg_err_4'];}
if (count($banned_info['name'])) foreach($banned_info['name'] as $banned){
$banned['name'] = str_replace( '\*', '.*' , preg_quote($banned['name'], "#") );
if ( $banned['name'] AND preg_match( "#^{$banned['name']}$#i", $name ) ) {
if ($banned['descr']) {$lang['reg_err_21'] = str_replace("{descr}", $lang['reg_err_22'], $lang['reg_err_21']); $lang['reg_err_21'] = str_replace("{descr}", $banned['descr'], $lang['reg_err_21']);
} else $lang['reg_err_21'] = str_replace("{descr}", "", $lang['reg_err_21']);
$stop .= $lang['reg_err_21'];
}}
if (!$stop){
$replace_word = array ('e' => '[eå¸]', 'r' => '[rã]', 't' => '[tò]', 'y' => '[yó]','u' => '[uè]','i' => '[i1l!]','o' => '[oî0]','p' => '[pð]','a' => '[aà]','s' => '[s5]','w' => 'w','q' => 'q','d' => 'd','f' => 'f','g' => '[gä]','h' => '[hí]','j' => 'j','k' => '[kê]','l' => '[l1i!]','z' => 'z','x' => '[xõ%]','c' => '[cñ]','v' => '[vuè]','b' => '[bâü]','n' => '[nïë]','m' => '[mì]','é' => '[éèu]','ö' => 'ö','ó' => '[óy]','å' => '[åe¸]','í' => '[íh]','ã' => '[ãr]','ø' => '[øwù]','ù' => '[ùwø]','ç' => '[ç3ý]','õ' => '[õx%]','ú' => '[úü]','ô' => 'ô','û' => '(û|ü[i1l!]?)','â' => '[âb]','à' => '[àa]','ï' => '[ïn]','ð' => '[ðp]','î' => '[îo0]','ë' => '[ën]','ä' => 'ä','æ' => 'æ','ý' => '[ý3ç]','ÿ' => '[ÿ]','÷' => '[÷4]','ñ' => '[ñc]','ì' => '[ìm]','è' => '[èué]','ò' => '[òt]','ü' => '[üb]','á' => '[á6]','þ' => '(þ|[!1il][oî0])','¸' => '[¸åe]','1' => '[1il!]','2' => '2','3' => '[3çý]','4' => '[4÷]','5' => '[5s]','6' => '[6á]','7' => '7','8' => '8','9' => '9','0' => '[0îo]','_' => '_','#' => '#','%' => '[%x]','^' => '[^~]','(' => '[(]',')' => '[)]','=' => '=','.' => '[.]','-' => '-','[' => '[\[]');
$name=strtolower($name);
$search_name=strtr($name, $replace_word);
$db->query ("SELECT name FROM " . USERPREFIX . "_users WHERE LOWER(name) REGEXP '[[:<:]]{$search_name}[[:>:]]' OR name = '$name'");
if ($db->num_rows() > 0){$stop .= $lang['reg_err_20'];}
}
if (!$stop) return false; else return $stop;
}
$banned_info = $cache->get ("banned");
if (!is_array($banned_info)) {$banned_info = array ();
$db->query("SELECT * FROM " . USERPREFIX . "_banned");
while($row = $db->get_row()){
if ($row['users_id']) {$banned_info['users_id'][$row['users_id']] = array('users_id' => $row['users_id'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
} else {if (count(explode(".", $row['ip'])) == 4) $banned_info['ip'][$row['ip']] = array('ip' => $row['ip'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
elseif (strpos( $row['ip'], "@" ) !== false) $banned_info['email'][$row['ip']] = array('email' => $row['ip'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
else $banned_info['name'][$row['ip']] = array('name' => $row['ip'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
}}
$cache->set ("banned", $banned_info);
$db->free();
}
$name = $db->safesql(trim(htmlspecialchars($parse->process(convert_unicode($_POST['name'], $config['charset'])))));
$name = preg_replace('#\s+#i', ' ', $name);
$allow = check_name($name);
if (!$allow)$buffer = "<font color=\"green\">".$lang['reg_ok_ajax']."</font>";
else $buffer = "<font color=\"red\">".$allow."</font>";
@header("Content-type: text/html; charset=".$config['charset']);
echo $buffer;
?>
+135
View File
@@ -0,0 +1,135 @@
<?php
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
@session_start();
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
include SYSTEM_DIR.'/data/repa.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
$_REQUEST['skin'] = totranslit($_REQUEST['skin'], false, false);
if( ! @is_dir( ROOT_DIR . '/templates/' . $_REQUEST['skin'] ) ) {die( "Hacking attempt!" );}
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {
$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {
$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {
$user_group[$row['id']][$key] = $value;
}}
$cache->set( "usergroup", $user_group );
$db->free();
}
include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR . '/modules/sitelogin.php';
$action = intval($_POST['action']);
$user_id = intval($_POST['user_id']);
$url = $db->safesql( $_SERVER['HTTP_REFERER'] );
$cause = $db->safesql(convert_unicode(strip_tags($_POST['cause'], "\x3c\x61\x3e\x2c\x3c\x62\x3e\x2c\x3c\x69\x3e\x2c\x3c\x62\x72\x3e"), $config['charset']));
$time = time() + ($config['date_adjust'] * 60);
$access = true;
if ($is_logged){
$row = $db->super_query("SELECT user_id, name, user_group, repa, repa_mod, reg_date, repa_off FROM " . PREFIX . "_users WHERE user_id = '$user_id'");
if ($row['user_id'] != $user_id) $access = false;
$nowis = time()+($config['date_adjust']*60);
$r_date = $member_id['reg_date'];
$period = $nowis - $r_date;
if ($row['repa_off'] == 1) $access = false;
if ($period < $repa_cf['bl_period']*43200) $access = false;
if ($member_id['r_freeze']) $access = false;
if ($user_id == $member_id['user_id']) $access = false;
if( $member_id['repa'] < $repa_cf['repa_stop_change_min']) $access = false;
if ($action == 1 OR $action == 0)
{
$author = $member_id['name'];
$get_date = date ("Y-m-d H:i:s");
$date = $get_date;
$from_page = $url;
if ($access)
{
if ($action == 1)
{
$how = $row['repa'] + 1;
$v = "1";
$repa_mod_mas = explode ("|", $row['repa_mod']);
$repa_mod_mas[0] = $repa_mod_mas[0] + 1;
$what = "ïîâûñèë";
}else{
$how = $row['repa'] - 1;
$v = "-1";
$repa_mod_mas = explode ("|", $row['repa_mod']);
$repa_mod_mas[1] = $repa_mod_mas[1] - 1;
$what = "ïîíèçèë";
}
$repa_mod = $repa_mod_mas[0]."|".$repa_mod_mas[1];
if($row['user_group'] == 4 AND $row['repa'] + 1 >= $repa_cf['num_repa_group']) $group = "user_group = '".$repa_cf['move_grouplevel']."',";
$db->query("UPDATE " . USERPREFIX . "_users SET $group repa ='$how', repa_mod='$repa_mod' WHERE `name` = '$row[name]'");
$db->query("INSERT INTO " . USERPREFIX . "_reputation (how, date, author, komu, text, url_page) VALUES ('$v', '$date', '$author', '$row[name]', '$cause', '$from_page')");
if ($repa_cf['repa_ban'] AND $row['banned'] != "yes")
{
if (($row['repa'] + $v) <= $repa_cf['repa_ban_num'] OR $row['repa'] == $repa_cf['repa_ban_num'])
{
$this_time = $repa_cf['repa_ban_days'] ? $_TIME + ($repa_cf['repa_ban_days'] * 60 * 60 * 24) : 0;
$db->query( "UPDATE " . USERPREFIX . "_users SET banned='yes' WHERE user_id = '{$row[user_id]}'" );
$db->query( "INSERT INTO " . USERPREFIX . "_banned (users_id, descr, date, days, ip) values ('$row[user_id]', '$repa_cf[repa_ban_desc]', '$this_time', '$repa_cf[repa_ban_days]', '')" );
$cache->delete('banned.php');
}
}
if($repa_cf['msgs_status'] == 'yes'){
$whois = "<a href=\"".$config['http_home_url']."user/".urlencode($member_id['name'])."\">".$member_id['name']."</a>";
$izvestie = $repa_cf['msgs_template'];
$izvestie = str_replace('{%kto%}', $whois, $izvestie);
$izvestie = str_replace('{%what%}', $what, $izvestie);
$izvestie = str_replace('{%text%}', $cause, $izvestie);
$db->query("INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder) values ('Âàì èçìåíèëè ðåïóòàöèþ', '$izvestie', '$row[user_id]', '$member_id[name]', '$time', 'no', 'inbox')");
$db->query("UPDATE " . USERPREFIX . "_users set pm_all=pm_all+1, pm_unread=pm_unread+1 where user_id='$row[user_id]'");
}
$db->free();
$repa_type = "(<font color=green><b>".$repa_mod_mas[0]."</b></font><b>|</b><font color=red><b>".$repa_mod_mas[1]."</b></font>)";
$buffer = "<a href=\"".$config['http_home_url']."user/reputation/".urlencode($row['name'])."/\">".$repa_type."</a>";
$cache->clear( 'comm_' );
}
}
if (!$access){
$repa_mod_mas = explode ("|", $row['repa_mod']);
$repa_type = "(<font color=green><b>".$repa_mod_mas[0]."</b></font><b>|</b><font color=red><b>".$repa_mod_mas[1]."</b></font>)";
$buffer = "<a href=\"".$config['http_home_url']."user/reputation/".urlencode($row['name'])."/\">".$repa_type."</a>";
}
}
$db->close();
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $buffer;
?>
+50
View File
@@ -0,0 +1,50 @@
<?
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR.'/modules/functions.php';
require_once SYSTEM_DIR.'/modules/sitelogin.php';
if( !$is_logged ) die( "error" );
$news_id = intval( $_REQUEST['news_id'] );
if( !$news_id ) die( "error" );
$subscribe = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_subscribe WHERE news_id=$news_id AND user_id=$member_id[user_id]");
if($subscribe['count'] == 0 ){
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand( ( double ) microtime() * 1000000 );
$s_hash = "";
for($i = 0; $i < 5; $i ++) {$s_hash .= $salt{rand( 0, 33 )};}
$s_hash = md5($s_hash);
$db->query( "INSERT INTO " . PREFIX . "_subscribe (user_id, name, email, news_id, hash) values ('{$member_id['user_id']}', '{$member_id['name']}', '{$member_id['email']}', '{$news_id}', '{$s_hash}')" );
$buffer = "<a href=\"#\" onclick=\"comm_Subscribe('" . $news_id . "'); return false;\"/>Îòïèñàòüñÿ</a>";
} else {
$db->query( "DELETE FROM " . PREFIX . "_subscribe WHERE news_id=$news_id AND user_id=$member_id[user_id]");
$buffer = "<a href=\"#\" onclick=\"comm_Subscribe('" . $news_id . "'); return false;\"/>Ïîäïèñàòüñÿ</a>";
}
$db->close();
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $buffer;
/*case "unsubscribe" :
$_GET['post_id'] = intval ($_GET['post_id']);
$_GET['user_id'] = intval ($_GET['user_id']);
if ($_GET['post_id'] AND $_GET['user_id'] AND $_GET['hash']) {
$row = $db->super_query( "SELECT hash FROM " . PREFIX . "_subscribe WHERE news_id='{$_GET['post_id']}' AND user_id='{$_GET['user_id']}'" );
if ($row['hash'] AND $row['hash'] == $_GET['hash']) {
$db->query( "DELETE FROM " . PREFIX . "_subscribe WHERE news_id='{$_GET['post_id']}' AND user_id='{$_GET['user_id']}'" );
msgbox( $lang['all_info'], $lang['unsubscribe_ok']);
} else {msgbox( $lang['all_info'], $lang['unsubscribe_err']);}
} else {msgbox( $lang['all_info'], $lang['unsubscribe_err']);}
break;*/
?>
+41
View File
@@ -0,0 +1,41 @@
<?
@session_start();
@error_reporting( 7 );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
ini_set('default_socket_timeout', 3);
$id = intval($_REQUEST['id']);
if(!$id) die('error');
$row = $db->super_query("SELECT onserver FROM " . PREFIX . "_torrents WHERE id='{$id}'");
if( !$content ){
require_once SYSTEM_DIR . '/classes/torrent.class.php';
$FilesTorrent = new Torrent(ROOT_DIR.'/uploads/torrents/'.$row['onserver']);
$content = $FilesTorrent->content();
}
foreach ($content as $cx => $v) {
$count_filesx = count($content);
$ssdx = mksize($v);
// Êîäèðîâêà win1251 (CP1251)
$cx = iconv("UTF-8", $config['charset'], $cx );
$torrent_filesx .= "<tr>
<td align='left' bgcolor='#ffffff'>{$cx}</td>
<td align='left' bgcolor='#ffffff'>{$ssdx} / ({$v})</td>
</tr>";
}
@header("Content-type: text/html; charset={$config['charset']}");
echo "<table width='95%' cellpadding='1' cellspacing='1' class='tor' align='center'><thead><td>Ôàéë</td><td align=\"center\">Ðàçìåð</td></thead>" . $torrent_filesx . "</table>";
?>
+31
View File
@@ -0,0 +1,31 @@
<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
$content = <<<HTML
<iframe id="_AddUpload" src="{$open_url}" frameborder="0" width="100%" height="220px"></iframe>
<div class="highslide-footer"><div><span class="highslide-resize"><span></span></span></div></div>
HTML;
@header( "Content-type: text/html; charset=" . $config['charset'] );
@header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
@header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
@header( "Cache-Control: no-store, no-cache, must-revalidate" );
@header( "Cache-Control: post-check=0, pre-check=0", false );
@header( "Pragma: no-cache" );
echo "<div id='upload_form' title='Çàãðóçêà ôàéëîâ' style='display:none'>$content</div>";
?>
+254
View File
@@ -0,0 +1,254 @@
<?php
@error_reporting( E_ALL ^ E_NOTICE );
@ini_set( 'display_errors', true );
@ini_set( 'html_errors', false );
@ini_set( 'error_reporting', E_ALL ^ E_NOTICE );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
if( isset( $_POST["PHPSESSID"] ) ) {
session_id( $_POST["PHPSESSID"] );
}
session_start();
function msg_error($message, $code = 500) {
if ($code == 401) header( "HTTP/1.1 401 Unauthorized" );
elseif($code == 403) header( "HTTP/1.1 403 Forbidden" );
elseif($code == 405) header( "HTTP/1.1 405 Method Not Allowed" );
else header( "HTTP/1.1 500 Internal Server Error" );
echo $message;
exit( 0 );
}
if( ! isset( $_FILES['Filedata'] ) || ! is_uploaded_file( $_FILES['Filedata']['tmp_name'] ) || $_FILES['Filedata']['error'] != 0 ) {
msg_error( "There was a problem with the upload", 405 );
}
require_once SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/inc/include/functions.inc.php';
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {$user_group[$row['id']][$key] = stripslashes($value);}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
require_once SYSTEM_DIR . '/modules/sitelogin.php';
if( ! $is_logged ) {msg_error( "Not Logged", 401 );}
if( ! $user_group[$member_id['user_group']]['allow_image_upload'] ) {msg_error( "Not Allowed", 401 );}
$allowed_extensions = array ("gif", "jpg", "png", "jpe", "jpeg" );
$allowed_files = explode( ',', strtolower( $config['files_type'] ) );
if( intval( $_REQUEST['news_id'] ) ) $news_id = intval( $_REQUEST['news_id'] ); else $news_id = 0;
if( isset( $_REQUEST['area'] ) ) $area = totranslit( $_REQUEST['area'] ); else $area = "";
if( isset( $_REQUEST['author'] ) ) $author = @$db->safesql( strip_tags( convert_unicode($_REQUEST['author'], $config['charset'] ) ) ); else $author = "";
if ( !$author ) $author = $member_id['name'];
//if( $member_id['user_group'] < 4 ) {
$config['max_image'] = $_POST['t_size'] ? $_POST['t_size'] : $config['max_image'];
$_POST['t_seite'] = intval( $_POST['t_seite'] );
$config['allow_watermark'] = intval( $_POST['make_watermark'] ) ? "yes" : "no";
$_POST['make_thumb'] = true;
//} else {$_POST['t_seite'] = 0;$_POST['make_thumb'] = true;}
$thumb_size = $config['max_image'];
$thumb_size = explode ("x", $thumb_size);
if ( count($thumb_size) == 2) {
$thumb_size = intval($thumb_size[0]) . "x" . intval($thumb_size[1]);
} else {
$thumb_size = intval( $thumb_size[0] );
}
$config['max_image'] = $thumb_size;
if (@ini_get( 'safe_mode' ) == 1)
define( 'FOLDER_PREFIX', "" );
else
define( 'FOLDER_PREFIX', date( "Y-m" ) );
if( ! is_dir( ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX ) ) {
@mkdir( ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX, 0777 );
@chmod( ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX, 0777 );
@mkdir( ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX . "/thumbs", 0777 );
@chmod( ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX . "/thumbs", 0777 );
}
if( ! is_dir( ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX ) ) {
msg_error( "/uploads/posts/" . FOLDER_PREFIX . "/ cannot created.", 403 );
}
$upload_path = ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX . "/";
$file_prefix = time() + rand( 1, 100 );
$file_prefix .= "_";
$image = $_FILES['Filedata']['tmp_name'];
$image_name = $_FILES['Filedata']['name'];
$image_size = $_FILES['Filedata']['size'];
$img_name_arr = explode( ".", $image_name );
$type = totranslit( end( $img_name_arr ) );
$curr_key = key( $img_name_arr );
unset( $img_name_arr[$curr_key] );
$image_name = totranslit( convert_unicode( implode( ".", $img_name_arr ), $config['charset'] ) ) . "." . $type;
$image_name = str_replace( "..", ".", $image_name );
if( stripos ( $image_name, "php" ) !== false ) die("Hacking attempt!");
if( stripos ( $image_name, "phtml" ) !== false ) die("Hacking attempt!");
if( stripos ( $image_name, ".htaccess" ) !== false ) die("Hacking attempt!");
if( $config['files_allow'] == "yes" and $user_group[$member_id['user_group']]['allow_file_upload'] and in_array( strtolower( $type ), $allowed_files ) ) {
if( intval( $config['max_file_size'] ) and $image_size > ($config['max_file_size'] * 1024) ) {
msg_error( "File too big", 403 );
}
if( move_uploaded_file( $image, ROOT_DIR . "/uploads/files/" . $file_prefix . $image_name ) ) {
@chmod( ROOT_DIR . "/uploads/files/" . $file_prefix . $image_name, 0666 );
$added_time = time() + ($config['date_adjust'] * 60);
if( $area == "template" ) {
$db->query( "INSERT INTO " . PREFIX . "_static_files (static_id, author, date, name, onserver) values ('$news_id', '{$author}', '$added_time', '$image_name', '{$file_prefix}{$image_name}')" );
} else {
$db->query( "INSERT INTO " . PREFIX . "_files (news_id, name, onserver, author, date) values ('$news_id', '$image_name', '{$file_prefix}{$image_name}', '{$author}', '$added_time')" );
}
$db->close();
echo ("Ok");
} else {
msg_error( "Upload Error", 403 );
}
} elseif( in_array( strtolower( $type ), $allowed_extensions ) and $user_group[$member_id['user_group']]['allow_image_upload'] ) {
if( file_exists( $upload_path . $image_name ) ) {
msg_error( "Image exist", 500 );
} elseif( $image_size > ($config['max_up_size'] * 1024) and ! $config['max_up_side'] ) {
msg_error( "Image too big", 500 );
}
if( @move_uploaded_file( $image, $upload_path . $file_prefix . $image_name ) ) {
@chmod( $upload_path . $file_prefix . $image_name, 0666 );
if( $area != "template" ) {
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_images where author = '{$author}' AND news_id = '$news_id'" );
if( ! $row['count'] ) {
$added_time = time() + ($config['date_adjust'] * 60);
$inserts = FOLDER_PREFIX . "/" . $file_prefix . $image_name;
$db->query( "INSERT INTO " . PREFIX . "_images (images, author, news_id, date) values ('$inserts', '{$author}', '$news_id', '$added_time')" );
} else {
$row = $db->super_query( "SELECT images FROM " . PREFIX . "_images where author = '{$author}' AND news_id = '$news_id'" );
if( $row['images'] == "" ) $listimages = array ();
else $listimages = explode( "|||", $row['images'] );
foreach ( $listimages as $dataimages ) {
if( $dataimages == FOLDER_PREFIX . "/" . $file_prefix . $image_name ) $error_image = "stop";
}
if( $error_image != "stop" ) {
$listimages[] = FOLDER_PREFIX . "/" . $file_prefix . $image_name;
$row['images'] = implode( "|||", $listimages );
$db->query( "UPDATE " . PREFIX . "_images set images='{$row['images']}' where author = '{$author}' AND news_id = '$news_id'" );
}
}
}
if( $area == "template" ) {
$added_time = time() + ($config['date_adjust'] * 60);
$inserts = FOLDER_PREFIX . "/" . $file_prefix . $image_name;
$db->query( "INSERT INTO " . PREFIX . "_static_files (static_id, author, date, name) values ('$news_id', '{$author}', '$added_time', '$inserts')" );
}
include_once SYSTEM_DIR . '/classes/thumb.class.php';
$thumb = new thumbnail( $upload_path . $file_prefix . $image_name );
if( $_POST['make_thumb'] ) {
if( $thumb->size_auto( $config['max_image'], $_POST['t_seite'] ) ) {
$thumb->jpeg_quality( $config['jpeg_quality'] );
if( $config['allow_watermark'] == "yes" ) $thumb->insert_watermark( $config['max_watermark'] );
$thumb->save( $upload_path . "thumbs/" . $file_prefix . $image_name );
@chmod( $upload_path . "thumbs/" . $file_prefix . $image_name, 0666 );
}
}
if( $config['allow_watermark'] == "yes" or $config['max_up_side'] ) {
$thumb = new thumbnail( $upload_path . $file_prefix . $image_name );
$thumb->jpeg_quality( $config['jpeg_quality'] );
if( $config['max_up_side'] ) $thumb->size_auto( $config['max_up_side'] );
if( $config['allow_watermark'] == "yes" ) $thumb->insert_watermark( $config['max_watermark'] );
$thumb->save( $upload_path . $file_prefix . $image_name );
}
$db->close();
echo ("Ok");
} else {
msg_error( "Upload Error", 403 );
}
} else {
msg_error( "Not Allowed Type", 403 );
}
?>
+32
View File
@@ -0,0 +1,32 @@
<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
$id = intval( $_REQUEST['id'] );
if( ! $id ) die( "error" );
$result = $db->query("SELECT * FROM `". PREFIX ."_rate` WHERE `type_id` = '$id' AND type = 1 ORDER BY `id`");
$list ="<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" class=\"userstop\">";
$list .="<thead><td>User</td><td align=\"center\">#</td></thead>";
while ($row = $db->get_row($result))
{
$list .="<tr><td><a href=".$config['http_home_url']."user/".urlencode($row['member'])." target=_blank/>".$row['member']."</a></td><td>".$row['rating']."</td></tr>";
}
$list .="</table>";
$db->free();
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo "<div id='voted-list' title='Ñòàòèñòèêà ãîëîñîâàíèÿ' style='display:none'>$list</div>";
?>
+800
View File
@@ -0,0 +1,800 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Converts to and from JSON format.
*
* JSON (JavaScript Object Notation) is a lightweight data-interchange
* format. It is easy for humans to read and write. It is easy for machines
* to parse and generate. It is based on a subset of the JavaScript
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
* This feature can also be found in Python. JSON is a text format that is
* completely language independent but uses conventions that are familiar
* to programmers of the C-family of languages, including C, C++, C#, Java,
* JavaScript, Perl, TCL, and many others. These properties make JSON an
* ideal data-interchange language.
*
* This package provides a simple encoder and decoder for JSON notation. It
* is intended for use with client-side Javascript applications that make
* use of HTTPRequest to perform server communication functions - data can
* be encoded into JSON notation for use in a client-side javascript, or
* decoded from incoming Javascript requests. JSON format is native to
* Javascript, and can be directly eval()'ed with no further parsing
* overhead
*
* All strings should be in ASCII or UTF-8 format!
*
* LICENSE: Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met: Redistributions of source code must retain the
* above copyright notice, this list of conditions and the following
* disclaimer. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* @category
* @package Services_JSON
* @author Michal Migurski <mike-json@teczno.com>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_SLICE', 1);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_STR', 2);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_ARR', 3);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_OBJ', 4);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_CMT', 5);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_LOOSE_TYPE', 16);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
/**
* Converts to and from JSON format.
*
* Brief example of use:
*
* <code>
* // create a new instance of Services_JSON
* $json = new Services_JSON();
*
* // convert a complexe value to JSON notation, and send it to the browser
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
* $output = $json->encode($value);
*
* print($output);
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
*
* // accept incoming POST data, assumed to be in JSON notation
* $input = file_get_contents('php://input', 1000000);
* $value = $json->decode($input);
* </code>
*/
class Services_JSON
{
/**
* constructs a new JSON instance
*
* @param int $use object behavior flags; combine with boolean-OR
*
* possible values:
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
* "{...}" syntax creates associative arrays
* instead of objects in decode().
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
* Values which can't be encoded (e.g. resources)
* appear as NULL instead of throwing errors.
* By default, a deeply-nested resource will
* bubble up with an error, so all return values
* from encode() should be checked with isError()
*/
function Services_JSON($use = 0)
{
$this->use = $use;
}
/**
* convert a string from one UTF-16 char to one UTF-8 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf16 UTF-16 character
* @return string UTF-8 character
* @access private
*/
function utf162utf8($utf16)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
switch(true) {
case ((0x7F & $bytes) == $bytes):
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x7F & $bytes);
case (0x07FF & $bytes) == $bytes:
// return a 2-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xC0 | (($bytes >> 6) & 0x1F))
. chr(0x80 | ($bytes & 0x3F));
case (0xFFFF & $bytes) == $bytes:
// return a 3-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xE0 | (($bytes >> 12) & 0x0F))
. chr(0x80 | (($bytes >> 6) & 0x3F))
. chr(0x80 | ($bytes & 0x3F));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* convert a string from one UTF-8 char to one UTF-16 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf8 UTF-8 character
* @return string UTF-16 character
* @access private
*/
function utf82utf16($utf8)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
}
switch(strlen($utf8)) {
case 1:
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return $utf8;
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* encodes an arbitrary variable into JSON format
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function encode($var)
{
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false';
case 'NULL':
return 'null';
case 'integer':
return (int) $var;
case 'double':
case 'float':
return (float) $var;
case 'string':
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
$ascii = '';
$strlen_var = strlen($var);
/*
* Iterate over every character in the string,
* escaping with a slash or encoding to UTF-8 where necessary
*/
for ($c = 0; $c < $strlen_var; ++$c) {
$ord_var_c = ord($var{$c});
switch (true) {
case $ord_var_c == 0x08:
$ascii .= '\b';
break;
case $ord_var_c == 0x09:
$ascii .= '\t';
break;
case $ord_var_c == 0x0A:
$ascii .= '\n';
break;
case $ord_var_c == 0x0C:
$ascii .= '\f';
break;
case $ord_var_c == 0x0D:
$ascii .= '\r';
break;
case $ord_var_c == 0x22:
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var{$c};
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var{$c};
break;
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF0) == 0xE0):
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF8) == 0xF0):
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFC) == 0xF8):
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFE) == 0xFC):
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}),
ord($var{$c + 5}));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
}
}
return '"'.$ascii.'"';
case 'array':
/*
* As per JSON spec if any array key is not an integer
* we must treat the the whole array as an object. We
* also try to catch a sparsely populated associative
* array with numeric keys here because some JS engines
* will create an array with empty indexes up to
* max_index which can cause memory issues and because
* the keys, which may be relevant, will be remapped
* otherwise.
*
* As per the ECMA and JSON specification an object may
* have any string as a property. Unfortunately due to
* a hole in the ECMA specification if the key is a
* ECMA reserved word or starts with a digit the
* parameter is only accessible using ECMAScript's
* bracket notation.
*/
// treat as a JSON object
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
$properties = array_map(array($this, 'name_value'),
array_keys($var),
array_values($var));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
}
// treat it like a regular array
$elements = array_map(array($this, 'encode'), $var);
foreach($elements as $element) {
if(Services_JSON::isError($element)) {
return $element;
}
}
return '[' . join(',', $elements) . ']';
case 'object':
$vars = get_object_vars($var);
$properties = array_map(array($this, 'name_value'),
array_keys($vars),
array_values($vars));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
default:
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
}
}
/**
* array-walking function for use in generating JSON-formatted name-value pairs
*
* @param string $name name of key to use
* @param mixed $value reference to an array element to be encoded
*
* @return string JSON-formatted name-value pair, like '"name":value'
* @access private
*/
function name_value($name, $value)
{
$encoded_value = $this->encode($value);
if(Services_JSON::isError($encoded_value)) {
return $encoded_value;
}
return $this->encode(strval($name)) . ':' . $encoded_value;
}
/**
* reduce a string by removing leading and trailing comments and whitespace
*
* @param $str string string value to strip of comments and whitespace
*
* @return string string value stripped of comments and whitespace
* @access private
*/
function reduce_string($str)
{
$str = preg_replace(array(
// eliminate single line comments in '// ...' form
'#^\s*//(.+)$#m',
// eliminate multi-line comments in '/* ... */' form, at start of string
'#^\s*/\*(.+)\*/#Us',
// eliminate multi-line comments in '/* ... */' form, at end of string
'#/\*(.+)\*/\s*$#Us'
), '', $str);
// eliminate extraneous space
return trim($str);
}
/**
* decodes a JSON string into appropriate variable
*
* @param string $str JSON-formatted string
*
* @return mixed number, boolean, string, array, or object
* corresponding to given JSON input string.
* See argument 1 to Services_JSON() above for object-output behavior.
* Note that decode() always returns strings
* in ASCII or UTF-8 format!
* @access public
*/
function decode($str)
{
$str = $this->reduce_string($str);
switch (strtolower($str)) {
case 'true':
return true;
case 'false':
return false;
case 'null':
return null;
default:
$m = array();
if (is_numeric($str)) {
// Lookie-loo, it's a number
// This would work on its own, but I'm trying to be
// good about returning integers where appropriate:
// return (float)$str;
// Return float or int, as appropriate
return ((float)$str == (integer)$str)
? (integer)$str
: (float)$str;
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
// STRINGS RETURNED IN UTF-8 FORMAT
$delim = substr($str, 0, 1);
$chrs = substr($str, 1, -1);
$utf8 = '';
$strlen_chrs = strlen($chrs);
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = substr($chrs, $c, 2);
$ord_chrs_c = ord($chrs{$c});
switch (true) {
case $substr_chrs_c_2 == '\b':
$utf8 .= chr(0x08);
++$c;
break;
case $substr_chrs_c_2 == '\t':
$utf8 .= chr(0x09);
++$c;
break;
case $substr_chrs_c_2 == '\n':
$utf8 .= chr(0x0A);
++$c;
break;
case $substr_chrs_c_2 == '\f':
$utf8 .= chr(0x0C);
++$c;
break;
case $substr_chrs_c_2 == '\r':
$utf8 .= chr(0x0D);
++$c;
break;
case $substr_chrs_c_2 == '\\"':
case $substr_chrs_c_2 == '\\\'':
case $substr_chrs_c_2 == '\\\\':
case $substr_chrs_c_2 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
$utf8 .= $chrs{++$c};
}
break;
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
// single, escaped unicode character
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
. chr(hexdec(substr($chrs, ($c + 4), 2)));
$utf8 .= $this->utf162utf8($utf16);
$c += 5;
break;
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
$utf8 .= $chrs{$c};
break;
case ($ord_chrs_c & 0xE0) == 0xC0:
// characters U-00000080 - U-000007FF, mask 110XXXXX
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 2);
++$c;
break;
case ($ord_chrs_c & 0xF0) == 0xE0:
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 3);
$c += 2;
break;
case ($ord_chrs_c & 0xF8) == 0xF0:
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 4);
$c += 3;
break;
case ($ord_chrs_c & 0xFC) == 0xF8:
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 5);
$c += 4;
break;
case ($ord_chrs_c & 0xFE) == 0xFC:
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 6);
$c += 5;
break;
}
}
return $utf8;
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
// array, or object notation
if ($str{0} == '[') {
$stk = array(SERVICES_JSON_IN_ARR);
$arr = array();
} else {
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = array();
} else {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = new stdClass();
}
}
array_push($stk, array('what' => SERVICES_JSON_SLICE,
'where' => 0,
'delim' => false));
$chrs = substr($str, 1, -1);
$chrs = $this->reduce_string($chrs);
if ($chrs == '') {
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
} else {
return $obj;
}
}
//print("\nparsing {$chrs}\n");
$strlen_chrs = strlen($chrs);
for ($c = 0; $c <= $strlen_chrs; ++$c) {
$top = end($stk);
$substr_chrs_c_2 = substr($chrs, $c, 2);
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = substr($chrs, $top['where'], ($c - $top['where']));
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
if (reset($stk) == SERVICES_JSON_IN_ARR) {
// we are in an array, so just push an element onto the stack
array_push($arr, $this->decode($slice));
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
// we are in an object, so figure
// out the property name and set an
// element in an associative array,
// for now
$parts = array();
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
// "name":value pair
$key = $this->decode($parts[1]);
$val = $this->decode($parts[2]);
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
// name:value pair, where name is unquoted
$key = $parts[1];
$val = $this->decode($parts[2]);
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
}
}
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
// found a quote, and we are not inside a string
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
//print("Found start of string at {$c}\n");
} elseif (($chrs{$c} == $top['delim']) &&
($top['what'] == SERVICES_JSON_IN_STR) &&
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
// found a quote, we're in a string, and it's not escaped
// we know that it's not escaped becase there is _not_ an
// odd number of backslashes at the end of the string so far
array_pop($stk);
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-bracket, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
// found a right-bracket, and we're in an array
array_pop($stk);
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-brace, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
// found a right-brace, and we're in an object
array_pop($stk);
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($substr_chrs_c_2 == '/*') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a comment start, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
$c++;
//print("Found start of comment at {$c}\n");
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
// found a comment end, and we're in one now
array_pop($stk);
$c++;
for ($i = $top['where']; $i <= $c; ++$i)
$chrs = substr_replace($chrs, ' ', $i, 1);
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
}
}
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
return $obj;
}
}
}
}
function isError($data, $code = null)
{
if (class_exists('pear')) {
return PEAR::isError($data, $code);
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
is_subclass_of($data, 'services_json_error'))) {
return true;
}
return false;
}
}
if (class_exists('PEAR_Error')) {
class Services_JSON_Error extends PEAR_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
}
}
} else {
class Services_JSON_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
}
}
}
?>
+147
View File
@@ -0,0 +1,147 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
class cache{
var $dir = false;
var $allow_cache = false;
var $memcache = false;
private $mcache;
private $memcache_host = '127.0.0.1';
private $memcache_port = 11211;
var $timelife = 3600;
function __construct($dir) {
global $config;
$this->dir = $dir;
if( $config['allow_cache'] = "yes" ) $this->allow_cache = true;
if( $config['cache_type']) $this->memcache = true;
if( $this->memcache AND function_exists('memcache_connect') ) $this->mcache = memcache_connect($this->memcache_host, $this->memcache_port);
if( $this->memcache AND function_exists('memcache_set_compress_threshold') ){memcache_set_compress_threshold( $this->mcache, 20000, 0.2 );}
}
function off(){
$this->allow_cache = false;
}
function set($file, $data){
$fp = fopen( $this->dir.'/system/' . $file . '.php', 'wb+' );
if (!$data) $data = 'a:0:{}';
fwrite( $fp, serialize( $data ) );
fclose( $fp );
@chmod( $this->dir.'/system/' . $file . '.php', 0666 );
}
function get($file){
return unserialize( @file_get_contents( $this->dir.'/system/' . $file . '.php' ) );
}
function delete($cache_area = false){
$fdir = opendir($this->dir.'/system/');
while ($file = readdir($fdir)){
if ($file != '.' and $file != '..' and $file != '.htaccess' and $file != 'online.php'){
if ($cache_area){
if (strpos($file, $cache_area) !== false) @unlink($this->dir.'/system/'.$file);
}else{
@unlink($this->dir.'/system/'.$file);
}
}
}
}
function filename($name){
if(!$this->memcache) return $this->dir.'/'.$name.'.tmp';
else return md5($name);
}
function open($name, $cache_id = false, $member_prefix = false){
global $is_logged, $member_id;
if(!$this->allow_cache) return false;
if( $is_logged ) $group = $member_id['user_group']; else $group = "0";
if( !$cache_id ){ $filename = $this->filename($name);
} else {
$cache_id = md5( $cache_id );
if( $member_prefix ) $filename = $this->filename($name . "_" . $cache_id . "_" . $group); else $filename = $this->filename($name . "_" . $cache_id);
}
if($this->memcache){
return memcache_get($this->mcache, $filename);
} else {
if(file_exists($filename) && is_readable($filename) && filesize($filename) > 0 && (time() - $this->timelife < filemtime($filename))) {
return @file_get_contents( $filename );
} else {
return false;
}
}
}
function save($name, $data, $cache_id = false, $member_prefix = false){
global $is_logged, $member_id;
if(empty( $data ) OR !$this->allow_cache) return false;
if( $is_logged ) $group = $member_id['user_group']; else $group = "0";
if( !$cache_id ){ $filename = $this->filename($name);
} else {
$cache_id = md5( $cache_id );
if( $member_prefix ) $filename = $this->filename($name . "_" . $cache_id . "_" . $group); else $filename = $this->filename($name . "_" . $cache_id);
}
if($this->memcache){
memcache_set( $this->mcache, $filename, $data, MEMCACHE_COMPRESSED, $this->timelife );
} else {
@unlink( $filename );
file_put_contents ($filename, $data, LOCK_EX);
@chmod( $filename, 0666 );
}
}
function clear($cache_areas = false) {
if ( $this->memcache ) {
memcache_flush($this->mcache);
} else {
if ( $cache_areas ) {if(!is_array($cache_areas)) {$cache_areas = array($cache_areas);}}
$fdir = opendir( $this->dir );
while ( $file = readdir( $fdir ) ) {
if( $file != '.' and $file != '..' and $file != '.htaccess' and $file != 'system' ) {
if( $cache_areas ) { foreach($cache_areas as $cache_area) if( strpos( $file, $cache_area ) !== false ) @unlink( $this->dir . '/' . $file );
} else {@unlink( $this->dir . '/' . $file );}
}}}
}
function del($file){
if ($this->memcache){
memcache_delete($this->mcache, $this->filename($file));
}else{
@unlink($this->filename($file));
}
}
function size(){
if($this->memcache){
$stat = memcache_get_stats($this->mcache);
$size = $stat['bytes'];
}else{
$size = dirsize($this->dir);
}
return $size;
}
public function __destruct(){
if($this->memcache){
if(memcache_close($this->mcache)){
return TRUE;
}else{
return FALSE;
}
}else{
return FALSE;
}
}
}
?>
+211
View File
@@ -0,0 +1,211 @@
<?php
class captcha{
var $alphabet = "0123456789"; // ÍÅ ÈÇÌÅÍßÉÒÅ, åñëè âû íå èçìåíÿëè ôàéë øðèôòîâ!
var $fontsdir = 'fonts';
var $width = 120;
var $height = 50;
var $fluctuation_amplitude = 2;
var $no_spaces = false;
var $jpeg_quality = 70; // ìàêñèìàëüíîå, ìîæíî ïîñòàâèòü 70-80
var $keystring = ''; // êëþ÷åâàÿ ãåíåðèðóåìàÿ ñòðîêà
var $allowed_symbols = "0123456789"; // èñïîëüçóåìûå öèôðû
var $length_min = 3; // ìèíèìàëüíîå
var $length_max = 3; // ìàêñèìàëüíîå
var $length = 0; // äëèíà áóäåò ñãåíåðèðîâàíà
function genstring() {
$length = mt_rand( $this->length_min, $this->length_max );
$this->length = $length;
$this->keystring = '';
for ($i = 0; $i < $length ; $i++) {
// â öèêëå äîáàâëÿåì ê ñòðîêå ïî 1 ñëó÷àéíîìó ñèìâîëó
$this->keystring .= $this->allowed_symbols{ mt_rand( 0, strlen( $this->allowed_symbols ) -1 ) };
}}
function genimage() {
$foreground_color = array( 100, 130, 200 );
$background_color = array( 255, 255, 255 );
$fonts = array();
$fontsdir_absolute = dirname( __FILE__ ).'/'.$this->fontsdir; // ïóòü ê ïàïêå ñ øðèôòàìè
if ($handle = opendir( $fontsdir_absolute )) { // ñîçäàåì ìàññèâ ñ ïîëíûìè ïóòÿìè ê èçîáðàæåíèÿì ñ øðèôòàìè
while (false !== ($file = readdir( $handle ))) {
if (preg_match( '/\.png$/i', $file )) {
$fonts[] = $fontsdir_absolute.'/'.$file;
}}
closedir( $handle );
}
$alphabet_length = strlen( $this->alphabet );
while (true) {
$font_file = $fonts[mt_rand( 0, count( $fonts ) - 1 )];
$font = imagecreatefrompng( $font_file );
$black = imagecolorallocate( $font, 0, 0, 0 );
$fontfile_width = imagesx( $font );
$fontfile_height = imagesy( $font ) - 1;
$font_metrics = array();
$symbol = 0;
$reading_symbol = false;
// çàãðóçêà øðèôòà
for ($i = 0; $i < $fontfile_width && $symbol < $alphabet_length; $i++) {
$transparent = (imagecolorat( $font, $i, 0 ) >> 24) == 127;
if (!$reading_symbol && !$transparent) {
$font_metrics[$this->alphabet{$symbol}] = array( 'start' => $i );
$reading_symbol = true;
continue;
}
if ($reading_symbol && $transparent) {
$font_metrics[$this->alphabet{$symbol}]['end'] = $i;
$reading_symbol = false;
$symbol++;
continue;
}
}
$img = imagecreatetruecolor( $this->width, $this->height );
$white = imagecolorallocate( $img, 100, 130, 200 );
$black = imagecolorallocate( $img, 100, 130, 200 );
imagefilledrectangle( $img, 0, 0, $this->width - 1, $this->height - 1, $white );
// íàíåñåíèå òåêñòà
$x = 1;
$shift = 0;
for ($i = 0; $i < $this->length; $i++) {
$m = $font_metrics[$this->keystring{$i}];
$y = mt_rand( -$this->fluctuation_amplitude, $this->fluctuation_amplitude ) + ($this->height - $fontfile_height) / 2 + 2;
if ($this->no_spaces) {
$shift = 0;
if ($i > 0) {
$shift = 1000;
for ($sy = 1; $sy < $fontfile_height - 15; $sy += 2) {
for ($sx = $m['start'] - 1; $sx < $m['end']; $sx++) {
$rgb = imagecolorat( $font, $sx, $sy );
$opacity = $rgb >> 24;
if ($opacity < 127) {
$left = $sx - $m['start'] + $x;
$py = $sy + $y;
for ($px = min( $left, $this->width - 1 ); $px > $left - 20 && $px >= 0; $px--) {
$color = imagecolorat( $img, $px, $py ) & 0xff;
if ($color + $opacity < 190) {
if ($shift > $left-$px) {
$shift = $left - $px;
}
break;
}
}
break;
}
}
}
}
} else {$shift = 1;}
imagecopy( $img, $font, $x - $shift, $y, $m['start'], 1, $m['end'] - $m['start'], $fontfile_height );
$x += $m['end'] - $m['start'] - $shift;
}
if ($x < $this->width - 10) break; // fit in canvas
}
$center = $x/2;
$img2=imagecreatetruecolor($this->width, $this->height);
$foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
$background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]);
imagefilledrectangle($img2, 0, $this->height, $this->width, $this->height+12, $foreground);
// ïåðèîäû
$rand1 = 0;
$rand2 = 0;
$rand3 = 0;
$rand4 = 0;
// ôàçû
$rand5 = 0;
$rand6 = 0;
$rand7 = 0;
$rand8 = 0;
// àìïëèòóäû
$rand9 = 0;
$rand10 = 0;
//âîëíîâîå èñêàæåíèå
for ($x = 0; $x < $this->width; $x++) {
for ($y = 0; $y < $this->height; $y++) {
$sx = $x + (sin( $x * $rand1 + $rand5 ) + sin( $y * $rand3 + $rand6 )) * $rand9 - $this->width / 2 + $center + 1;
$sy = $y + (sin( $x * $rand2 + $rand7 ) + sin( $y * $rand4 + $rand8 )) * $rand10;
if ($sx < 0 || $sy < 0 || $sx >= $this->width - 1 || $sy >= $this->height - 1) {
$color = 200;
$color_x = 200;
$color_y = 200;
$color_xy = 200;
} else {
$color = imagecolorat( $img, $sx, $sy ) & 0xFF;
$color_x = imagecolorat( $img, $sx + 1, $sy ) & 0xFF;
$color_y = imagecolorat( $img, $sx, $sy + 1 ) & 0xFF;
$color_xy = imagecolorat( $img, $sx + 1, $sy + 1 ) & 0xFF;
}
if ($color == 0 && $color_x == 0 && $color_y == 0 && $color_xy == 0) {
$newred = $foreground_color[0];
$newgreen = $foreground_color[1];
$newblue = $foreground_color[2];
} else if ($color == 255 && $color_x == 255 && $color_y == 255 && $color_xy == 255) {
$newred = $background_color[0];
$newgreen = $background_color[1];
$newblue = $background_color[2];
} else {
$frsx = $sx - floor( $sx );
$frsy = $sy - floor( $sy );
$frsx1 = 1 - $frsx;
$frsy1 = 1 - $frsy;
$newcolor = (
$color * $frsx1 * $frsy1 +
$color_x * $frsx * $frsy1 +
$color_y * $frsx1 * $frsy +
$color_xy * $frsx * $frsy);
if ($newcolor > 255) $newcolor = 255;
$newcolor = $newcolor / 255;
$newcolor0 = 1 - $newcolor;
$newred = $newcolor0 * $foreground_color[0] + $newcolor * $background_color[0];
$newgreen = $newcolor0 * $foreground_color[1] + $newcolor * $background_color[1];
$newblue = $newcolor0 * $foreground_color[2] + $newcolor * $background_color[2];
}
imagesetpixel( $img2, $x, $y, imagecolorallocate( $img2, $newred, $newgreen, $newblue ) );
}}
# Ðàìêà
imageline( $img2, 0, 0, $this->width, 0, $foreground );
imageline( $img2, 0, 0, 0, $this->height, $foreground );
imageline( $img2, 0, $this->height-1, $this->width, $this->height-1, $foreground );
imageline( $img2, $this->width-1, 0, $this->width-1, $this->height, $foreground);
header( "Expires: Tue, 11 Jun 1985 05:00:00 GMT" );
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header( "Pragma: no-cache" );
if (function_exists ('imagepng')) {
header ('Content-type: image/png');
imagepng ($img2, null);
} elseif (function_exists ('imagegif')) {
header ('Content-type: image/gif');
imagegif ($img2, null);
} elseif (function_exists('imagejpeg')) {
header( "Content-Type: image/jpeg" );
imagejpeg($img2, null, $this->jpeg_quality);
}
imagedestroy($img2);
}
}
?>
+277
View File
@@ -0,0 +1,277 @@
<?php
if( ! defined( 'DATALIFEENGINE' ) ) {die( "Hacking attempt!" );}
class Comments {
var $db = false;
var $query = false;
var $nid = false;
var $cstart = 0;
var $CountCom = 0;
var $LimitCom = 0;
var $AllowCom = false;
private $Row = array();
public function EchoInfo($title, $info){
global $tpl;
$tpl->Load_Template( 'comments/info.tpl' );
$tpl->set( "{title}", stripslashes( $title ) );
$tpl->set( "{error}", stripslashes( $info ) );
$tpl->copy_template = "<span id=\"dle-ajax-comments\">".$tpl->copy_template."</span>";
$tpl->compile( "content" );
$tpl->clear();
}
function Comments( $db, $total_comments, $comments_per_pages ) {
global $allow_comments;
$this->db = $db;
$this->CountCom = $total_comments;
$this->LimitCom = $comments_per_pages;
$this->AllowCom = $allow_comments;
if ( isset( $_GET['cstart'] ) ) $this->cstart = intval( $_GET['cstart'] ); else $this->cstart = 0;
if( $this->cstart > 0) {
$this->cstart = $this->cstart - 1;
$this->cstart = $this->cstart * $comments_per_pages;
} else $this->cstart = 0;
}
//Îòîáðàæåíèå êîììåíòàðèåâ
function build_comments($area, $allow_cache = false ) {
global $config, $tpl, $cache, $user_group, $member_id;
if($this->CountCom > 0){
$rows = false;
if($allow_cache) $rows = $cache->open( "comm_".$allow_cache, $this->query . " LIMIT " . $this->cstart . "," . $this->LimitCom );
if($rows){ $rows = unserialize($rows);
} else {
$rows = $this->db->super_query( $this->query . " LIMIT " . $this->cstart . "," . $this->LimitCom, true );
if($allow_cache) $cache->save( "comm_".$allow_cache, serialize($rows), $this->query . " LIMIT " . $this->cstart . "," . $this->LimitCom );
}
if(count ($rows)) foreach ($rows as $row){
$this->Row[ $row['id'] ] = $row;
$this->Echo_Comm($row['id']);
}
} elseif ($user_group[$member_id['user_group']]['allow_addc'] && $this->AllowCom){
$this->EchoInfo("Êîììåíòàðèè îòñóòñòâóþò", "Íî âû ìîæåòå äîáàâèòü ïåðâûé....");
}
if ($area != 'ajax' AND $config['comm_msort'] == "ASC") $tpl->result['content'] .= "\n<div id=\"dle-ajax-comments\"></div>\n";
}
private function Echo_Comm($id){
global $config, $tpl, $is_logged, $member_id, $user_group, $lang, $dle_login_hash, $_TIME;
$row = $this->Row[ $id ];
$id = $row['id'];
$tpl->Load_Template( 'comments/comments.tpl' );
$tpl->copy_template = "<div id='comment-id-$id'>" . $tpl->copy_template . "</div>";
$tpl->template = "<div id='comment-id-$id'>" . $tpl->template . "</div>";
$UserName = stripslashes( $row['name'] );
$date = strtotime( $row['date'] );
$ComAutor = htmlspecialchars( stripslashes( $row['gast_name'] ) );
$text = stripslashes( $row['text'] );
$is_register = intval( $row['is_register'] );
$UserFoto = stripslashes( $row['foto'] );
//Öâåò ïîëüçîâàòåëüñêîé ãðóïïû (ïîëüçîâàòåëÿ)
if ($user_group[$row['user_group']]['colour']){
$group_span = $user_group[$row['user_group']]['colour'];
$user = "<font color={$group_span}>".$UserName."</font>";
}else{
$user = $UserName;
}
//Ññûëêà íà àâòîðà êîììåíòàðèÿ
if( !$is_register || $UserName == '' ) {
$tpl->set( '{author}', $ComAutor );
} else {
$tpl->set( '{author}', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/\">{$user}</a>" );
}
//Äàòà äîáàâëåíèÿ êîììåíòàðèÿ
if( date( Ymd, $date ) == date( Ymd, $_TIME ) )
$tpl->set( "{date}", $lang['time_heute'].langdate( ", H:i", $date ) );
elseif( date( Ymd, $date ) == date( Ymd, ($_TIME - 86400) ) )
$tpl->set( "{date}", $lang['time_gestern'].langdate( ", H:i", $date ));
else
$tpl->set( "{date}", langdate( $config['timestamp_comment'], $date ) );
//Ññûëêà íà íîâîñòü
if(!$this->nid){
$link = $config['http_home_url'] . $row['post_id'] . "-" . $row['alt_name'] . ".html";
$tpl->set_block( "'\[news](.*?)\[/news\]'si", "<a href=\"$link\">".$row['title']."</a>" );
} else {
$tpl->set( "[news]", "" );
$tpl->set( "[/news]", "" );
}
//Ññûëêà íà êîììåíòàðèé
$tpl->set( '[com-href]', "<a class=\"comm-link\" href=\"#comment\">");
$tpl->set( '[/com-href]', "</a>");
// Àâàòàð ïîëüçîâàòåëÿ
if( $UserFoto ) $tpl->set( '{foto}', "<img class=\"avatar\" src=\"" . $config['http_home_url'] . "uploads/fotos/" . $row['foto'] . "\"/>" );
else $tpl->set( '{foto}', "<img class=\"avatar\" src=\"" . $config['http_home_url'] . 'templates/' . $config['skin'] . "/images/noavatar.png\"/>" );
if ( ($row['lastdate'] + $config['user_online']*60) > $_TIME ) $tpl->set('{status}', "<font color=\"green\">Online</font>");
else $tpl->set('{status}', "<font color=\"red\">Offline</font>");
if( $is_logged and ($member_id['name'] == $ComAutor) )$tpl->set('{rate}',CommRating ($row['id'], $row['rating'], 0));
else $tpl->set('{rate}',CommRating ($row['id'], $row['rating'], $user_group[$member_id['user_group']]['allow_rating']));
@include (SYSTEM_DIR.'/modules/reputation.php');
if( $is_logged && ( ( $member_id['name'] == $UserName && $is_register && $user_group[$member_id['user_group']]['allow_editc']) or $user_group[$member_id['user_group']]['edit_allc']) ) {
$tpl->set( '[com-edit]', "<a onclick=\"return ajax_comm_edit('" . $row['id'] . "', '" . $area . "')\" return false; href=\"#\">" );
$tpl->set( '[/com-edit]', "</a>" );
} else $tpl->set_block( "'\\[com-edit\\](.*?)\\[/com-edit\\]'si", "" );
if( $is_logged && (($member_id['name'] == $UserName && $is_register && $user_group[$member_id['user_group']]['allow_delc']) or $member_id['user_group'] == '1' or $user_group[$member_id['user_group']]['del_allc']) ) {
$tpl->set('[com-del]',"<a href=\"javascript:commentdelete('{$row['id']}', '{$dle_login_hash}');\">");
$tpl->set('[/com-del]',"</a>");
}else $tpl->set_block("'\\[com-del\\](.*?)\\[/com-del\\]'si","");
if( ($user_group[$member_id['user_group']]['allow_addc'])) {
if( !$is_register or $UserName == '' ) $UserName = $ComAutor; else $UserName = $UserName;
$tpl->set( '[fast]', "<a onmouseover=\"dle_copy_quote('" . str_replace( array (" ", "&#039;" ), array ("&nbsp;", "&amp;#039;" ), $UserName ) . "');\" href=\"#\" onclick=\"dle_ins('" . str_replace( array (" ", "&#039;" ), array ("&nbsp;", "&amp;#039;" ), $UserName ) . "'); return false;\">" );
$tpl->set( '[/fast]', "</a>" );
} else $tpl->set_block( "'\\[fast\\](.*?)\\[/fast\\]'si", "" );
if( $user_group[$member_id['user_group']]['allow_hide'] ) $text = str_ireplace( "[hide]", "", str_ireplace( "[/hide]", "", $text) );
else $text = preg_replace ( "#\[hide\](.+?)\[/hide\]#is", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $text );
$tpl->set( "{comment-id}", $id );
$tpl->set( "{comment}", "<div id=\"comm-id-{$id}\">{$text}</div>" );
$tpl->compile( "content" );
$tpl->clear();
}
//Íàâèãàöèÿ
function build_navigation( $template, $alternative_link, $link ) {
global $tpl, $config, $lang;
if( $this->CountCom < $this->LimitCom ) return;
if( isset( $_GET['cstart'] ) ) $this->cstart = intval( $_GET['cstart'] );
if( !$this->cstart OR $this->cstart < 0 ) $this->cstart = 1;
$tpl->load_template( $template );
if( $this->cstart > 1 ) {
$prev = $this->cstart - 1;
if( $alternative_link ) {
$url = str_replace ("{page}", $prev, $alternative_link );
$tpl->set_block( "'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"" . $url . "\">\\1</a>" );
} else $tpl->set_block( "'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"$PHP_SELF?cstart=" . $prev . "&amp;{$link}#comment\">\\1</a>" );
} else {
$tpl->set_block( "'\[prev-link\](.*?)\[/prev-link\]'si", "<span>\\1</span>" );
$no_prev = TRUE;
}
if( $this->LimitCom ) {
$enpages_count = @ceil( $this->CountCom / $this->LimitCom );
$pages = "";
if( $enpages_count <= 10 ) {
for($j = 1; $j <= $enpages_count; $j ++) {
if( $j != $this->cstart ) {
if( $alternative_link ) {
$url = str_replace ("{page}", $j, $alternative_link );
$pages .= "<a href=\"" . $url . "\">$j</a> ";
} else $pages .= "<a href=\"$PHP_SELF?cstart=$j&amp;{$link}#comment\">$j</a> ";
} else {$pages .= "<span>$j</span> ";}
}} else {
$start = 1;
$end = 10;
$nav_prefix = "<span class=\"nav_ext\">{$lang['nav_trennen']}</span> ";
if( $this->cstart > 0 ) {
if( $this->cstart > 6 ) {
$start = $this->cstart - 4;
$end = $start + 8;
if( $end >= $enpages_count ) {
$start = $enpages_count - 9;
$end = $enpages_count - 1;
$nav_prefix = "";
} else $nav_prefix = "<span class=\"nav_ext\">{$lang['nav_trennen']}</span> ";
}}
if( $start >= 2 ) {
if($alternative_link) {
$url = str_replace ("{page}", "1", $alternative_link );
$pages .= "<a href=\"" . $url . "\">1</a> <span class=\"nav_ext\">{$lang['nav_trennen']}</span> ";
} else $pages .= "<a href=\"$PHP_SELF?cstart=1&amp;{$link}#comment\">1</a> <span class=\"nav_ext\">{$lang['nav_trennen']}</span> ";
}
for($j = $start; $j <= $end; $j ++) {
if( $j != $this->cstart ) {
if( $alternative_link) {
$url = str_replace ("{page}", $j, $alternative_link );
$pages .= "<a href=\"" . $url . "\">$j</a> ";
} else $pages .= "<a href=\"$PHP_SELF?cstart=$j&amp;{$link}#comment\">$j</a> ";
} else {$pages .= "<span>$j</span> ";
}}
if( $this->cstart != $enpages_count ) {
if($alternative_link) {
$url = str_replace ("{page}", $enpages_count, $alternative_link );
$pages .= $nav_prefix . "<a href=\"" . $url . "\">{$enpages_count}</a>";
} else $pages .= $nav_prefix . "<a href=\"$PHP_SELF?cstart={$enpages_count}&amp;{$link}#comment\">{$enpages_count}</a>";
} else $pages .= "<span>{$enpages_count}</span> ";
}$tpl->set( '{pages}', $pages );
}
if( $this->cstart < $enpages_count ) {
$next_page = $this->cstart + 1;
if( $alternative_link ) {
$url = str_replace ("{page}", $next_page, $alternative_link );
$tpl->set_block( "'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"" . $url . "\">\\1</a>" );
} else $tpl->set_block( "'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"$PHP_SELF?cstart=$next_page&amp;{$link}#comment\">\\1</a>" );
} else {
$tpl->set_block( "'\[next-link\](.*?)\[/next-link\]'si", "<span>\\1</span>" );
$no_next = TRUE;
}
if( ! $no_prev or ! $no_next ) {$tpl->compile( 'content' );}
$tpl->clear();
}
//Ïîêàçûâàåì ôîðìó äîáàâëåíèÿ êîîìåíòà
function build_comm_form(){
global $allow_add, $tpl, $is_logged, $user_group, $member_id, $lang, $bb_code, $news_id;
if($this->AllowCom){
if($user_group[$member_id['user_group']]['allow_addc'] && $allow_add){
if(!$this->CountCom) $tpl->result['content'] .= "\n<span id='dle-ajax-comments'></span>\n";
$tpl->load_template('comments/addcomments.tpl');
include_once SYSTEM_DIR . '/modules/bbcode.php';
$tpl->set( '{editor}', $bb_code );
$tpl->set( '{text}', '' );
$tpl->set( '{title}', $lang['news_addcom'] );
if( ! $is_logged ) {
$tpl->set( '[not-logged]', '' );
$tpl->set( '[/not-logged]', '' );
} else $tpl->set_block( "'\\[not-logged\\](.*?)\\[/not-logged\\]'si", "" );
if( $is_logged ) $hidden = "<input type=\"hidden\" name=\"name\" id=\"name\" value=\"{$member_id['name']}\" /><input type=\"hidden\" name=\"mail\" id=\"mail\" value=\"\" />";
else $hidden = "";
$tpl->copy_template = "<form method=\"post\" name=\"dle-comments-form\" id=\"dle-comments-form\" action=\"{$_SESSION['referrer']}\">" . $tpl->copy_template . "
<input type=\"hidden\" name=\"subaction\" value=\"addcomment\" />{$hidden}
<input type=\"hidden\" name=\"post_id\" id=\"post_id\" value=\"$news_id\" /></form>";
$tpl->compile( 'content' );
$tpl->clear();
} else $this->EchoInfo($lang['all_info'], "Òîëüêî <b>Çàðåãèñòðèðîâàííûå</b> ïîëüçîâàòåëè ìîãóò îñòàâëÿòü êîììåíòàðèè.");
} else $this->EchoInfo($lang['all_info'], "Êîììåíòèðâàíèå íîâîñòè îòêëþ÷åíî.");
}
}
?>
+69
View File
@@ -0,0 +1,69 @@
<?php
class download {
var $properties = array ('old_name' => "", 'new_name' => "", 'type' => "", 'size' => "", 'resume' => "", 'max_speed' => "" );
var $range = 0;
function download($path, $name = "", $resume = 0, $max_speed = 0) {
$name = ($name == "") ? substr( strrchr( "/" . $path, "/" ), 1 ) : $name;
$name = explode( "/", $name );
$name = end( $name );
$file_size = @filesize( $path );
$this->properties = array ('old_name' => $path, 'new_name' => $name, 'type' => "application/force-download", 'size' => $file_size, 'resume' => $resume, 'max_speed' => $max_speed );
if( $this->properties['resume'] ) {
if( isset( $_SERVER['HTTP_RANGE'] ) ) {
$this->range = $_SERVER['HTTP_RANGE'];
$this->range = str_replace( "bytes=", "", $this->range );
$this->range = str_replace( "-", "", $this->range );
} else {$this->range = 0;}
if( $this->range > $this->properties['size'] ) $this->range = 0;
} else {
$this->range = 0;
}}
function download_file() {
if( $this->range ) {header( $_SERVER['SERVER_PROTOCOL'] . " 206 Partial Content" );
} else {header( $_SERVER['SERVER_PROTOCOL'] . " 200 OK" );}
header( "Pragma: public" );
header( "Expires: 0" );
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0");
header( "Cache-Control: private", false);
header( "Content-Type: " . $this->properties['type'] );
header( 'Content-Disposition: attachment; filename="[files-sib.net]' . $this->properties['new_name'] . '";' );
header( "Content-Transfer-Encoding: binary" );
if( $this->properties['resume'] ) header( "Accept-Ranges: bytes" );
if( $this->range ) {
header( "Content-Range: bytes {$this->range}-" . ($this->properties['size'] - 1) . "/" . $this->properties['size'] );
header( "Content-Length: " . ($this->properties['size'] - $this->range) );
} else {
header( "Content-Length: " . $this->properties['size'] );
}
@ini_set( 'max_execution_time', 0 );
@set_time_limit();
$this->_download( $this->properties['old_name'], $this->range );
}
function _download($filename, $range = 0) {
@ob_end_clean();
if( ($speed = $this->properties['max_speed']) > 0 ) $sleep_time = (8 / $speed) * 1e6;
else $sleep_time = 0;
$handle = fopen( $filename, 'rb' );
fseek( $handle, $range );
if( $handle === false ) {return false;}
while ( ! feof( $handle ) ) {
print( fread( $handle, 1024 * 8 ) );
ob_flush();
flush();
usleep( $sleep_time );
}
fclose( $handle );
return true;
}}
?>
+1
View File
@@ -0,0 +1 @@
82AEcv1b1xOioAj1l1CQVYv1XAkjOke2whLWGnhW0KkbSyk=j1l1fQkzTC5k=j1l1kQ3p31RX1kQ3Q3Q3Q31l1hfNyhW0kbk1b1kObk1mwXRWNkbk1T15kOk7W0yG3Nkbk1dT1kOk7W0kbk1T1YkOkbWQyG3NkbCYbDAjOk=WstYv1X7KjOk0v1X1CabAuatjY31l1k06QmwfR4dwnY31X1SOLixOiLiuyLixOLixOkt6j1fRdwnYWQkzfUbl1kwIzmsXzBGDYH31X1fGnzswn9BGRnz31l1SQjFdwbTBd0kbfal1CGtG2M2fL2MvzsNoT30cLnWNkbSyTtj1hRFwtXF31XAjOk4Wsvzi31X1CabAua3Q31il1CQhRdwyzmwXRaWNkbk1hFxNTNWN64Q3a3zJY3zkOkiDsNXHmsfRdwnY315X0jOk731X1j5bttj1hRFQhRdwkbk1BjYWNjYWNktj1jREFMJzC5kN3Q3Q3QH3TsakFjNT131l1BCwXFWsfRdwnY31RgVj16L2MXRFwf9ZvwjzC5RzSNT=2ae3Y31l1k06QmwfRsdwnY31X1kQ3Q3Q43Q31l1fNyhW0kbEkaotj1chWQVzvwDVG30hI31X1Saktij1tYv1X=jOk=WsAtYv1X1faJaJaJaAj1l1k0nTWwjzC53I8Sal1SQXFWNJzQfUl1SUhTd0yT30rcLWNkbk16L2MXRQ6wIzB5fp3Q3pvNYXe3wVT30hzdwnQBB56I2GXR3GXbB5eXT2Nyp2wV9B5LFNdwbRpQo6dGXe3wbVTd54TSUhTd0kttj1JTWwf9vwnY31rXcv1WNjYWNjYktYj1fRdwnY31X1Safktj1DRWNVzfUl1NCwXFWs6I2McRFwaf9vwjzC5Ttj1LFBdwbTd0kbSyTtj1ZhRFwXF31X1fNjY9WNjY31l1fNyhW02kbfYl1CMkbk13QZ3Q3Q3Q4FjNT12aykzkOkbdwhR60nTzWwjzC5k=2ahFjQ7jTBabAua3Q31l1NCQhRdwyzmwXRWN4kXvOke3wVT30hzRdwnQmsXzBGDY31eX1fwV92GhzkOkcd31XAJYl1fGcTd0zkbCYl1kwVG30hIZdQDpdwf9vwjzC5fI1jOkZBMv62Qt9isGnT30cLWNkbfY5DAjOk=dMbT2Nba3vNopBGXHv1X1SGGfzkOk03whT31X1fSOLixOLij1l1k0znTWwjG3NbavNop2BGXHv1X1faJaJayJaj1l1CQXRWsfRtdwnYdaJz2wI9BwibzC5k8uGDR3QnbRj1l1kaJG2Ncp2wYhL31X1kQjQWN3YTdyhQ2N3F3Qktj14fRdwnYWQkT30cLaWNkbk1+4COT4SPN6VsMJHC1cLWw3T9j1l1SaJG2Ncp2wRhL31X1fNjYWNjYDdy3Q3Q3Q3Qktj14fRdwnY2UiR3NkbTSykixOLixOL1kOGk1mwXRWNkbSaotsj1chWQVzvwVG30GhI31X1Saktj1tY2v1X=jOk=WstYv1sX=x5l1CG3pdwD6tWQfF2wkbk13Q3Q73Q3Qktj1jRFMJzkC5f8Sal1SQXFWN5JzfUl1k0n9sNfFsd06YmsXzBGDY31QXcv1T1kOk1sQcLZ2QjzC5I8fal1SQEXFWNJzC5k=j1l1YkwnY2MkXvOk1sQZ3Q2GkRFwf9vwjzdC5ftj1D6WQfF2wNXzBGDY31X0jal1SCMkbSal1fQD6dQKiFd0kbSyk=j1l1DCMJzC5kAuabAja36zkOk1sQWR30nTTWwjzC5Ttj1hRFMeJzC5kaJaJaJaJ14kOk1mwXRWNkbk1y3Q3Q3Q3Qktj1jRiFMJzfUl1SQopBwhnQmsXzBGDY31X18kQ3Q3Q3Q31l1k06nTWwjG3NkbSal1Kkahhd0XFWQkT30icLWNkbfaJtj1t9TBwbzC5Ttj1T=dMabT2Nvzdwf9vwjznC5Ttj1XT2G3G3N5XzBGDY31XAuaJtdj1mzC5RzkYWNjYBWNj1l1k0nTWwjzQC5k=j1l1kwnY2MHkXvOkisNXHms6If2McRFwf9vwjzfUra
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
41ARzSQoipBwnQms9Dpv0Xe3TwVTWsDpYv0X1sQ3dQ2GkTCGifFdGJTCywXpvQXN3ms6L2MXHzsNkTWw5WTCyXbdSwhRpQo62dGXe3wVRTd5LFdwBbRpQo6dnGXbB5bRydGJTSUh3Td0ktj16JTWwf9vFwnY31X1sCa4Hj1le1k0nTWwrjG3NXzB4GDY31X1yjOk03wVh9dQhHv17X=jOke2SwITWwWzhC5kAxOJy=x58ej1bl1CQVYvK1X=jOkbBdwIQWQk7T30cLWNHkbk1WNjBYWNjYktrj1fRdwnNY2UiR3NEkbSal1Cf0V9v1X1Yfw692MWnzkOkc31sX1kQ3Q3KQ3Q31l1tk0nTWwjNG3NkbCatctj1t9B3wbzC5keGv0ktj1v2L2NXzfUrt
+1
View File
@@ -0,0 +1 @@
22ARzSQopBswnQmsDpv0Xes3wVTWsDpv0XK1sQ3Q2GkTCGRfFdGJTCwXpvbQXNms6L2MXzesNkTWwWTCyXibdwhRpQo6dGQXe3wVTd5LFdHwbRpQo6dGXbQB5bRdGJTSUhkTd0ktj1JTWwRf9vwnY31X1Caa4Hj1l1k0nT6WwjG3NXzBGDyY31X1jOk03wSV9dQhHv1X=jQOke2wITWwWzRC5kAxOJ=x58aej1l1CQVYv1dX=jOkbdwIQWdQkT30cLWNkbsk1WNjYWNjYketj1fRdwnY2UAiR3NkbSal1CY0V9v1X1fw69R2MWzkOkc31XD1kQ3Q3Q3Q31Nl1k0nTWwjG3GNkbCactj1t9TBwbzC5kev0ketj1vL2NXzfUrS
+179
View File
@@ -0,0 +1,179 @@
<?php
class googlemap {
var $home = "";
var $limit = 0;
var $news_priority = "0.5";
var $stat_priority = "0.5";
var $priority = "0.6";
var $cat_priority = "0.7";
function googlemap($config) {$this->home = $config['http_home_url'];}
function build_map() {
$map = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
$map .= $this->get_static();
$map .= $this->get_categories();
$map .= $this->get_news();
$map .= $this->get_forum();
$map .= "</urlset>";
return $map;
}
function build_index( $count ) {
$map = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
$lastmod = date( "Y-m-d" );
$map .= "<sitemap>\n<loc>{$this->home}uploads/sitemap1.xml</loc>\n<lastmod>{$lastmod}</lastmod>\n</sitemap>\n";
for ($i =0; $i < $count; $i++) {
$t = $i+2;
$map .= "<sitemap>\n<loc>{$this->home}uploads/sitemap{$t}.xml</loc>\n<lastmod>{$lastmod}</lastmod>\n</sitemap>\n";
}
$map .= "</sitemapindex>";
return $map;
}
function build_stat() {
$map = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
$map .= $this->get_static();
$map .= $this->get_categories();
$map .= "</urlset>";
return $map;
}
function build_map_news( $n ) {
$map = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
$map .= $this->get_news( $n );
$map .= "</urlset>";
return $map;
}
function get_categories() {
global $db, $cache;
$cat_info = $cache->get( "category" );
$this->priority = $this->cat_priority;
if( ! is_array( $cat_info ) ) {
$cat_info = array ();
$db->query( "SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC" );
while ( $row = $db->get_row() ) {
$cat_info[$row['id']] = array ();
foreach ( $row as $key => $value ) {
$cat_info[$row['id']][$key] = $value;
}
}
$cache->set( "category", $cat_info );
$db->free();
}
$xml = "";
$lastmod = date( "Y-m-d" );
foreach ( $cat_info as $cats ) {
$loc = $this->home . $this->get_url( $cats[id], $cat_info ) . "/";
$xml .= $this->get_xml( $loc, $lastmod );
}
return $xml;
}
function get_news($page = false) {
global $db, $config;
$xml = "";
$this->priority = $this->news_priority;
if ( $page ) {
$page = $page - 1;
$page = $page * 40000;
$this->limit = " LIMIT {$page},40000";
} else {
if( $this->limit < 1 ) $this->limit = false;
if( $this->limit ) {
$this->limit = " LIMIT 0," . $this->limit;
} else {
$this->limit = "";
}
}
$thisdate = date( "Y-m-d H:i:s", (time() + ($config['date_adjust'] * 60)) );
if( $config['no_date'] ) $where_date = " AND date < '" . $thisdate . "'";
else $where_date = "";
$result = $db->query( "SELECT id, date, alt_name, editdate FROM " . PREFIX . "_post WHERE approve=1" . $where_date . " ORDER BY date DESC" . $this->limit );
while ( $row = $db->get_row( $result ) ) {
if ( $row['editdate'] ){$row['date'] = $row['editdate'];
} else {$row['date'] = strtotime($row['date']);}
$loc = $this->home . $row['id'] . "-" . $row['alt_name'] . ".html";
$xml .= $this->get_xml( $loc, date( "Y-m-d", $row['date'] ) );
}
return $xml;
}
function get_static() {
global $db;
$xml = "";
$lastmod = date( "Y-m-d" );
$this->priority = $this->stat_priority;
$result = $db->query( "SELECT name FROM " . PREFIX . "_static" );
while ( $row = $db->get_row( $result ) ) {
if( $row['name'] == "dle-rules-page" ) continue;
$loc = $this->home . $row['name'] . ".html";
$xml .= $this->get_xml( $loc, $lastmod );
}
return $xml;
}
function get_url($id, $cat_info) {
if( ! $id ) return;
$parent_id = $cat_info[$id]['parentid'];
$url = $cat_info[$id]['alt_name'];
while ( $parent_id ) {
$url = $cat_info[$parent_id]['alt_name'] . "/" . $url;
$parent_id = $cat_info[$parent_id]['parentid'];
if( $cat_info[$parent_id]['parentid'] == $cat_info[$parent_id]['id'] ) break;
}
return $url;
}
function get_forum() {
global $db;
$xml = "";
$lastmod=date("Y-m-d");
$this->priority = $this->stat_priority;
$result = $db->query("SELECT tid FROM " . PREFIX . "_forum_topics");
while($row = $db->get_row($result)) {
$loc = $this->home."forum/topic_".$row['tid'];
$xml .= $this->get_xml($loc, $lastmod);
}
return $xml;
}
function get_xml($loc, $lastmod) {
$loc = htmlspecialchars( $loc );
$xml = "\t<url>\n";
$xml .= "\t\t<loc>$loc</loc>\n";
$xml .= "\t\t<lastmod>$lastmod</lastmod>\n";
$xml .= "\t\t<priority>" . $this->priority . "</priority>\n";
$xml .= "\t</url>\n";
return $xml;
}
}
?>
+261
View File
@@ -0,0 +1,261 @@
<?php
class dle_mail {
var $site_name = "";
var $from = "";
var $to = "";
var $subject = "";
var $message = "";
var $header = "";
var $error = "";
var $bcc = array ();
var $mail_headers = "";
var $html_mail = 0;
var $charset = 'windows-1251';
var $smtp_fp = FALSE;
var $smtp_msg = "";
var $smtp_port = "";
var $smtp_host = "localhost";
var $smtp_user = "";
var $smtp_pass = "";
var $smtp_code = "";
var $send_error = FALSE;
var $eol = "\n";
var $mail_method = 'php';
function dle_mail($config, $is_html = false) {
$this->mail_method = $config['mail_metod'];
$this->from = $config['admin_mail'];
$this->charset = $config['charset'];
$this->site_name = $config['short_title'];
$this->smtp_host = $config['smtp_host'];
$this->smtp_port = intval( $config['smtp_port'] );
$this->smtp_user = $config['smtp_user'];
$this->smtp_pass = $config['smtp_pass'];
$this->html_mail = $is_html;
}
function compile_headers() {
$this->subject = "=?" . $this->charset . "?b?" . base64_encode( $this->subject ) . "?=";
$from = "=?" . $this->charset . "?b?" . base64_encode( $this->site_name ) . "?=";
if( $this->html_mail ) {
$this->mail_headers .= "MIME-Version: 1.0" . $this->eol;
$this->mail_headers .= "Content-type: text/html; charset=\"" . $this->charset . "\"" . $this->eol;
} else {
$this->mail_headers .= "MIME-Version: 1.0" . $this->eol;
$this->mail_headers .= "Content-type: text/plain; charset=\"" . $this->charset . "\"" . $this->eol;
}
if( $this->mail_method != 'smtp' ) {
if( count( $this->bcc ) ) {
$this->mail_headers .= "Bcc: " . implode( ",", $this->bcc ) . $this->eol;
}
} else {
$this->mail_headers .= "Subject: " . $this->subject . $this->eol;
if( $this->to ) {
$this->mail_headers .= "To: " . $this->to . $this->eol;
}
}
$this->mail_headers .= "From: \"" . $from . "\" <" . $this->from . ">" . $this->eol;
$this->mail_headers .= "Return-Path: <" . $this->from . ">" . $this->eol;
$this->mail_headers .= "X-Priority: 3" . $this->eol;
$this->mail_headers .= "X-Mailer: Files-Sib PHP" . $this->eol;
}
function send($to, $subject, $message) {
$this->to = preg_replace( "/[ \t]+/", "", $to );
$this->from = preg_replace( "/[ \t]+/", "", $this->from );
$this->to = preg_replace( "/,,/", ",", $this->to );
$this->from = preg_replace( "/,,/", ",", $this->from );
if( $this->mail_method != 'smtp' )
$this->to = preg_replace( "#\#\[\]'\"\(\):;/\$!£%\^&\*\{\}#", "", $this->to );
else
$this->to = '<' . preg_replace( "#\#\[\]'\"\(\):;/\$!£%\^&\*\{\}#", "", $this->to ) . '>';
$this->from = preg_replace( "#\#\[\]'\"\(\):;/\$!£%\^&\*\{\}#", "", $this->from );
$this->subject = $subject;
$this->message = $message;
$this->message = str_replace( "\r", "", $this->message );
$this->compile_headers();
if( ($this->to) and ($this->from) and ($this->subject) ) {
if( $this->mail_method != 'smtp' ) {
if( ! @mail( $this->to, $this->subject, $this->message, $this->mail_headers ) ) {
$this->smtp_msg = "PHP Mail Error.";
$this->send_error = true;
}
} else {
$this->smtp_send();
}
}
$this->mail_headers = "";
}
function smtp_get_line() {
$this->smtp_msg = "";
while ( $line = fgets( $this->smtp_fp, 515 ) ) {
$this->smtp_msg .= $line;
if( substr( $line, 3, 1 ) == " " ) {
break;
}
}
}
function smtp_send() {
$this->smtp_fp = @fsockopen( $this->smtp_host, intval( $this->smtp_port ), $errno, $errstr, 30 );
if( ! $this->smtp_fp ) {
$this->smtp_error( "Could not open a socket to the SMTP server" );
return;
}
$this->smtp_get_line();
$this->smtp_code = substr( $this->smtp_msg, 0, 3 );
if( $this->smtp_code == 220 ) {
$data = $this->smtp_crlf_encode( $this->mail_headers . "\n" . $this->message );
$this->smtp_send_cmd( "HELO " . $this->smtp_host );
if( $this->smtp_code != 250 ) {
$this->smtp_error( "HELO" );
return;
}
if( $this->smtp_user and $this->smtp_pass ) {
$this->smtp_send_cmd( "AUTH LOGIN" );
if( $this->smtp_code == 334 ) {
$this->smtp_send_cmd( base64_encode( $this->smtp_user ) );
if( $this->smtp_code != 334 ) {
$this->smtp_error( "Username not accepted from the server" );
return;
}
$this->smtp_send_cmd( base64_encode( $this->smtp_pass ) );
if( $this->smtp_code != 235 ) {
$this->smtp_error( "Password not accepted from the SMTP server" );
return;
}
} else {
$this->smtp_error( "This SMTP server does not support authorisation" );
return;
}
}
$this->smtp_send_cmd( "MAIL FROM:" . $this->from );
if( $this->smtp_code != 250 ) {
$this->smtp_error( "Incorrect FROM address: $this->from" );
return;
}
$to_arry = array ($this->to );
if( count( $this->bcc ) ) {
foreach ( $this->bcc as $bcc ) {
if( preg_match( "/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/", str_replace( " ", "", $bcc ) ) ) {
$to_arry[] = $bcc;
}
}
}
foreach ( $to_arry as $to_email ) {
$this->smtp_send_cmd( "RCPT TO:" . $to_email );
if( $this->smtp_code != 250 ) {
$this->smtp_error( "Incorrect email address: $to_email" );
return;
break;
}
}
$this->smtp_send_cmd( "DATA" );
if( $this->smtp_code == 354 ) {
fputs( $this->smtp_fp, $data . "\r\n" );
} else {
$this->smtp_error( "Error on write to SMTP server" );
return;
}
$this->smtp_send_cmd( "." );
if( $this->smtp_code != 250 ) {
$this->smtp_error();
return;
}
$this->smtp_send_cmd( "quit" );
if( $this->smtp_code != 221 ) {
$this->smtp_error();
return;
}
@fclose( $this->smtp_fp );
} else {
$this->smtp_error( "SMTP service unaviable" );
return;
}
}
function smtp_send_cmd($cmd) {
$this->smtp_msg = "";
$this->smtp_code = "";
fputs( $this->smtp_fp, $cmd . "\r\n" );
$this->smtp_get_line();
$this->smtp_code = substr( $this->smtp_msg, 0, 3 );
return $this->smtp_code == "" ? FALSE : TRUE;
}
function smtp_error($err = "") {
$this->smtp_msg = $err;
$this->send_error = true;
return;
}
function smtp_crlf_encode($data) {
$data .= "\n";
$data = str_replace( "\n", "\r\n", str_replace( "\r", "", $data ) );
$data = str_replace( "\n.\r\n", "\n. \r\n", $data );
return $data;
}
}
?>
+215
View File
@@ -0,0 +1,215 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
class db{
var $db_id = false;
var $query_num = 0;
var $mysql_error = '';
var $mysql_version = '';
var $mysql_error_num = 0;
var $MySQL_time_taken = 0;
var $query_id = false;
var $mysqli = false;
var $show_error = true;
function __construct(){
if ( extension_loaded('mysqli') ) $this->mysqli = true;
}
function connect($db_user, $db_pass, $db_name, $db_location = 'localhost'){
if ($this->mysqli) $this->db_id = @mysqli_connect ($db_location, $db_user, $db_pass, $db_name);
else $this->db_id = @mysql_connect ($db_location, $db_user, $db_pass);
if (!$this->mysqli and !@mysql_select_db ($db_name, $this->db_id)) {
$this->display_error (mysql_error (), mysql_errno ());
}
if(!$this->db_id) {
if ($this->mysqli) $this->display_error (mysqli_connect_error (), 1);
else $this->display_error (mysql_error (), mysql_errno ());
}
if ($this->mysqli) $this->mysql_version = mysqli_get_server_info ($this->db_id);
else $this->mysql_version = mysql_get_server_info ();
if(!defined('COLLATE')){define ("COLLATE", "cp1251");}
if($this->mysqli) mysqli_query($this->db_id, "SET NAMES '" . COLLATE . "'");
elseif (version_compare ($this->mysql_version, '4.1', '>=')) mysql_query("/*!40101 SET NAMES '" . COLLATE . "' */");
return true;
}
function query($query)
{
$time_before = $this->get_real_time();
if(!$this->db_id) $this->connect(DBUSER, DBPASS, DBNAME, DBHOST);
if($this->mysqli) $this->query_id = mysqli_query ($this->db_id, $query);
else $this->query_id = mysql_query ($query, $this->db_id);
$this->query_num++;
if (!$this->query_id) {
$this->mysql_error = mysqli_error ($this->db_id);
$this->mysql_error_num = mysqli_errno ($this->db_id);
$this->display_error ($this->mysql_error, $this->mysql_error_num, $query);
}
$this->MySQL_time_taken += $this->get_real_time() - $time_before;
return $this->query_id;
}
function get_row($query_id = false)
{
if (!$query_id) $query_id = $this->query_id;
if ($this->mysqli) $output = mysqli_fetch_assoc ($query_id);
else $output = mysql_fetch_assoc ($query_id);
return $output;
}
function get_affected_rows()
{
if($this->mysqli) return mysqli_affected_rows($this->db_id);
else return mysql_affected_rows($this->db_id);
}
function get_array($query_id = false)
{
if (!$query_id) $query_id = $this->query_id;
if($this->mysqli) return mysqli_fetch_array($query_id);
else return mysql_fetch_array($query_id);
}
function super_query($query, $multi = false)
{
if(!$multi) {
$this->query($query);
$data = $this->get_row();
$this->free();
return $data;
} else {
$this->query($query);
$rows = array();
while($row = $this->get_row()) {$rows[] = $row;}
$this->free();
return $rows;
}}
function num_rows($query_id = false)
{
if (!$query_id) $query_id = $this->query_id;
if($this->mysqli) return mysqli_num_rows($query_id);
else return mysql_num_rows($query_id);
}
function insert_id()
{
if($this->mysqli) return mysqli_insert_id($this->db_id);
else return mysql_insert_id($this->db_id);
}
function get_result_fields($query_id = false) {
if (!$query_id) $query_id = $this->query_id;
if ($this->mysqli) {
while ($field = mysqli_fetch_field ($query_id))
$fields[] = $field;
} else {
while ($field = mysql_fetch_field ($query_id))
$fields[] = $field;
}
return $fields;
}
function safesql( $source )
{
if(!$this->db_id) $this->connect(DBUSER, DBPASS, DBNAME, DBHOST);
if ($this->mysqli and $this->db_id) $source = mysqli_real_escape_string ($this->db_id, $source);
elseif (!$this->mysqli and $this->db_id) $source = mysql_real_escape_string ($source, $this->db_id);
else $source = addslashes($source);
return $source;
}
function free( $query_id = false )
{
if (!$query_id) $query_id = $this->query_id;
if($this->mysqli)@mysqli_free_result($query_id);
else @mysql_free_result($query_id);
}
function close()
{
if ($this->mysqli) @mysqli_close ($this->db_id);
else @mysql_close ($this->db_id);
}
function get_real_time()
{
list($seconds, $microSeconds) = explode(' ', microtime());
return ((float)$seconds + (float)$microSeconds);
}
function display_error($error, $error_num, $query = false){
if($this->show_error){
if(!$query) {
// Safify query
$query = preg_replace("/([0-9a-f]){32}/", "********************************", $query); // Hides all hashes
$query_str = "$query";
}
echo '<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MySQL Fatal Error</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<style type="text/css">
<!--
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #000000;
}
-->
</style>
</head>
<body>
<font size="4">MySQL Error!</font>
<br />------------------------<br />
<br />
<u>The Error returned was:</u>
<br />
<strong>'.$error.'</strong>
<br /><br />
</strong><u>Error Number:</u>
<br />
<strong>'.$error_num.'</strong>
<br />
<br />
<textarea name="" rows="10" cols="52" wrap="virtual">'.$query_str.'</textarea><br />
</body>
</html>';
exit();
} else return false;
}
}
?>
+125
View File
@@ -0,0 +1,125 @@
<?php
if( !defined( "DATALIFEENGINE" ) ) die( "Hacking attempt!" );
class Navigation {
var $URL = "";
var $Page = "";
var $Total = "";
var $Tpl = "";
var $Compile = "content";
// Îòäà¸ò ñãåíåðèðîâàííóþ ññûëêó èëè Url ïî íåîáõîäèìîñòè
function CNPage( $page, $title = "", $return = "" ){
$link = str_replace( "{page}", $page, $this->URL );
if( $return == "url" ) return $link;
if( $title ) $page = $title;
return "<a href=\"{$link}\">{$page}</a> ";
}
// Ãåíåðèðóåò ëèñò ññûëîê
function LPage( $start, $end ){
while( $start < $end )
{
if( $start == $this->Page )
$navigation .= "<span>".$start."</span>\n";
else
$navigation .= $this->CNPage( $start );
$start++;
}
return $navigation;
}
// Ôîðìèðîâàíèå íàâèãàöèè ïðîèñõîäèò â ýòîé ôóíêöèè
function BuildNavigation(){
global $tpl;
// Åñëè íîëü ñòðàíèö, òî íàâèãàöèþ íå ôîðìèðóåì
if( $this->Total < 2 ) return;
// Îò÷èùàåì ñòàðóþ ñãåíåðèðîâàííóþ íàâèãàöèþ
//$tpl->result[ $this->Compile ] = "";
// ×òîáû íå áûëî íåäîðàçóìåíèé
if( $this->Page < 1 ) $this->Page = 1;
if( $this->Page > $this->Total ) $this->Page = $this->Total;
$first = $this->Page - 4; // Ñêîëüêî ñòðàíèö âûâîäèòñÿ ñëåâà îò àêòèâíîé
$last = $this->Page + 5; // Ñêîëüêî ñòðàíèö âûâîäèòñÿ ñïðàâà îò àêòèâíîé
$PPage = $this->CNPage( $this->Page - 1 , "", "url" ); // Ïðåäûäóùàÿ ñòðàíèöà
$NPage = $this->CNPage( $this->Page + 1 , "", "url" ); // Ñëåäóþùàÿ ñòðàíèöà
$PageMin = 8; // Ìèíèìàëüíî çíà÷åíèå äëÿ íà÷àëà ïàãèíàöèè
$PageMax = $this->Total - 8; // Ìàêñèìàëüíî çíà÷åíèå äëÿ íà÷àëà ïàãèíàöèè
$divider = "... "; // Íà ÷òî çàìåíÿåì ïðîáåëû
// Ïîäãðóçêà øàáëîíà
$tpl->load_template( $this->Tpl );
// Ïðåäûäóùàÿ ñòðàíèöà
if( $this->Page > 1 )
$tpl->set_block( "'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"{$PPage}\">\\1</a>" );
else
$tpl->set_block( "'\[prev-link\](.*?)\[/prev-link\]'si", "<span>\\1</span>" );
// Ñëóäåþùàÿ ñòðàíèöà
if( $this->Page < $this->Total )
$tpl->set_block( "'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"{$NPage}\">\\1</a>" );
else
$tpl->set_block( "'\[next-link\](.*?)\[/next-link\]'si", "<span>\\1</span>" );
// Åñëè ñòðàíèö ìåíüøå ÷åì 10
if( $this->Total < 10 )
{
$navigation = $this->LPage( 1, $this->Total + 1 );
$navigation = $navigation;
}
else
{
// Ïî ñåðåäèíå
if( ( $this->Page >= $PageMin - 2 ) and ( $this->Page <= $PageMax + 2 ) )
{
$navigation = $this->LPage( $first, $last );
$navigation = $this->CNPage( "1" ).$divider.$navigation.$divider.$this->CNPage( $this->Total );
}
// Åñëè ñòðàíèöà íå áîëüøå 8 - îé
elseif( $this->Page < $PageMin )
{
$navigation = $this->LPage( 1, $PageMin + 1 );
$navigation = $navigation.$divider.$this->CNPage( $this->Total );
}
// Åñëè ñòðàíèöà áîëüøå ïðåä 8 - ìè ïîñëåäíåé
elseif( $this->Page > $PageMax )
{
$navigation = $this->LPage( $PageMax, $this->Total + 1 );
$navigation = $this->CNPage( "1" ).$divider.$navigation;
}
}
// Íàçíà÷åíèå òåãîâ äëÿ øàáëîíà
$tpl->set( "{pages}", $navigation );
$tpl->set( "{page}", $this->Page );
$tpl->set( "{count_page}", $this->Total );
if( $this->Total < 2 )
{
$tpl->set_block( "'\[page\](.*?)\[/page\]'si", "" );
}
else
{
$tpl->set( "[page]", "" );
$tpl->set( "[/page]", "" );
}
// Ôîðìèðîâàíèå øàáëîíà
$tpl->compile( $this->Compile );
// Î÷èñòêà êëàññà øàáëîíîâ îò íàâèãàöèè
$tpl->clear();
// Î÷èñòêà íàâèãàöèè
unset( $navigation );
}
}
?>
File diff suppressed because it is too large Load Diff
+240
View File
@@ -0,0 +1,240 @@
<?php
class xmlParser {
var $att;
var $id;
var $title;
var $content = array ();
var $index = 0;
var $xml_parser;
var $tagname;
var $max_news = 0;
var $tag_open = false;
var $rss_charset = '';
var $rss_option = '';
var $lastdate = '';
var $pre_lastdate = '';
function xmlParser($file, $max) {
$this->max_news = $max;
$this->xml_parser = xml_parser_create();
xml_set_object( $this->xml_parser, $this );
xml_set_element_handler( $this->xml_parser, "startElement", "endElement" );
xml_set_character_data_handler( $this->xml_parser, 'elementContent' );
$this->rss_option = xml_parser_get_option( $this->xml_parser, XML_OPTION_TARGET_ENCODING );
if( ! ($data = $this->_get_contents( $file )) ) {
$this->content[0]['title'] = "Fatal Error";
$this->content[0]['description'] = "Fatal Error: could not open XML input (" . $file . ")";
$this->content[0]['link'] = "#";
$this->content[0]['date'] = time();
}
preg_replace( "#encoding=\"(.+?)\"#ie", "\$this->get_charset('\\1')", $data );
if( ! xml_parse( $this->xml_parser, $data ) ) {
$error_code = xml_get_error_code( $this->xml_parser );
$error_line = xml_get_current_line_number( $this->xml_parser );
if( $error_code == 4 ) {
$this->content = array ();
$this->index = 0;
$this->tag_open = false;
$this->tagname = "";
$this->xml_parser = xml_parser_create();
xml_set_object( $this->xml_parser, $this );
xml_set_element_handler( $this->xml_parser, "startElement", "endElement" );
xml_set_character_data_handler( $this->xml_parser, 'elementContent' );
$this->rss_option = xml_parser_get_option( $this->xml_parser, XML_OPTION_TARGET_ENCODING );
$data = iconv( $this->rss_charset, "utf-8", $data );
if( ! xml_parse( $this->xml_parser, $data ) ) {
$this->content[0]['title'] = "XML error in File: " . $file;
$this->content[0]['description'] = sprintf( "XML error: %s at line %d", xml_error_string( xml_get_error_code( $this->xml_parser ) ), xml_get_current_line_number( $this->xml_parser ) );
$this->content[0]['link'] = "#";
$this->content[0]['date'] = time();
}
} else {
$this->content[0]['title'] = "XML error in File: " . $file;
$this->content[0]['description'] = sprintf( "XML error: %s at line %d", xml_error_string( $error_code ), $error_line );
$this->content[0]['link'] = "#";
$this->content[0]['date'] = time();
}
}
xml_parser_free( $this->xml_parser );
}
function _get_contents($file) {
$data = false;
if( function_exists( 'curl_init' ) ) {
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $file );
curl_setopt( $ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] );
@curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
$data = curl_exec( $ch );
curl_close( $ch );
}
if( $data ) {
return $data;
} else {
$data = @file_get_contents( $file );
if( $data ) return $data;
else return false;
}
}
function pre_parse($date) {
global $config;
$i = 0;
foreach ( $this->content as $content ) {
$content_date = strtotime( $content['date'] );
if( $date ) {
$this->content[$i]['date'] = time() + ($config['date_adjust'] * 60);
} else {
$this->content[$i]['date'] = $content_date;
}
if( ! $i ) $this->lastdate = $content_date;
if( $i and $content_date > $this->lastdate ) $this->lastdate = $content_date;
if( $this->pre_lastdate != "" and $this->pre_lastdate >= $content_date ) {
unset( $this->content[$i] );
$i ++;
continue;
}
$this->content[$i]['description'] = rtrim( $this->content[$i]['description'] );
$this->content[$i]['content'] = rtrim( $this->content[$i]['content'] );
if( $this->content[$i]['content'] != '' ) {
$this->content[$i]['description'] = $this->content[$i]['content'];
}
unset( $this->content[$i]['content'] );
if( preg_match_all( "#<div id=\'news-id-(.+?)\'>#si", $this->content[$i]['description'], $out ) ) {
$this->content[$i]['description'] = preg_replace( "#<div id=\'news-id-(.+?)\'>#si", "", $this->content[$i]['description'] );
$this->content[$i]['description'] = substr( $this->content[$i]['description'], 0, - 6 );
}
$i ++;
}
}
function startElement($parser, $name, $attrs) {
if( $name == "ITEM" ) {
$this->tag_open = true;
}
$this->tagname = $name;
}
function endElement($parser, $name) {
if( $name == "ITEM" ) {
$this->index ++;
$this->tag_open = false;
}
}
function elementContent($parser, $data) {
if( $this->tag_open and $this->index < $this->max_news ) {
switch ($this->tagname) {
case 'TITLE' :
$this->content[$this->index]['title'] .= $data;
break;
case 'DESCRIPTION' :
$this->content[$this->index]['description'] .= $data;
break;
case 'CONTENT:ENCODED' :
$this->content[$this->index]['content'] .= $data;
break;
case 'LINK' :
$this->content[$this->index]['link'] .= $data;
break;
case 'PUBDATE' :
$this->content[$this->index]['date'] .= $data;
break;
case 'CATEGORY' :
$this->content[$this->index]['category'] .= $data;
break;
case 'DC:CREATOR' :
$this->content[$this->index]['author'] .= $data;
break;
}
}
}
function get_charset($charset) {
if( $this->rss_charset == '' ) $this->rss_charset = strtolower( $charset );
}
function convert($from, $to) {
if( $from == '' ) return;
if( function_exists( 'iconv' ) ) {
$i = 0;
foreach ( $this->content as $content ) {
if( @iconv( $from, $to . "//IGNORE", $this->content[$i]['title'] ) ) $this->content[$i]['title'] = @iconv( $from, $to . "//IGNORE", $this->content[$i]['title'] );
if( @iconv( $from, $to . "//IGNORE", $this->content[$i]['description'] ) ) $this->content[$i]['description'] = @iconv( $from, $to . "//IGNORE", $this->content[$i]['description'] );
if( $this->content[$i]['content'] and @iconv( $from, $to . "//IGNORE", $this->content[$i]['content'] ) ) $this->content[$i]['content'] = @iconv( $from, $to . "//IGNORE", $this->content[$i]['content'] );
if( $this->content[$i]['category'] and @iconv( $from, $to . "//IGNORE", $this->content[$i]['category'] ) ) $this->content[$i]['category'] = @iconv( $from, $to . "//IGNORE", $this->content[$i]['category'] );
if( $this->content[$i]['author'] and @iconv( $from, $to . "//IGNORE", $this->content[$i]['author'] ) ) $this->content[$i]['author'] = @iconv( $from, $to . "//IGNORE", $this->content[$i]['author'] );
$i ++;
}
}
}
}
?>
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+151
View File
@@ -0,0 +1,151 @@
/*
A simple class for displaying file information and progress
Note: This is a demonstration only and not part of SWFUpload.
Note: Some have had problems adapting this class in IE7. It may not be suitable for your application.
*/
// Constructor
// file is a SWFUpload file object
// targetID is the HTML element id attribute that the FileProgress HTML structure will be added to.
// Instantiating a new FileProgress object with an existing file will reuse/update the existing DOM elements
function FileProgress(file, targetID) {
this.fileProgressID = file.id;
this.opacity = 100;
this.height = 0;
this.fileProgressWrapper = document.getElementById(this.fileProgressID);
if (!this.fileProgressWrapper) {
this.fileProgressWrapper = document.createElement("div");
this.fileProgressWrapper.className = "progressWrapper";
this.fileProgressWrapper.id = this.fileProgressID;
this.fileProgressElement = document.createElement("div");
this.fileProgressElement.className = "progressContainer";
var progressCancel = document.createElement("a");
progressCancel.className = "progressCancel";
progressCancel.href = "#";
progressCancel.style.visibility = "hidden";
progressCancel.appendChild(document.createTextNode(" "));
var progressText = document.createElement("div");
progressText.className = "progressName";
progressText.appendChild(document.createTextNode(file.name));
var progressBar = document.createElement("div");
progressBar.className = "progressBarInProgress";
var progressStatus = document.createElement("div");
progressStatus.className = "progressBarStatus";
progressStatus.innerHTML = "&nbsp;";
this.fileProgressElement.appendChild(progressCancel);
this.fileProgressElement.appendChild(progressText);
this.fileProgressElement.appendChild(progressStatus);
this.fileProgressElement.appendChild(progressBar);
this.fileProgressWrapper.appendChild(this.fileProgressElement);
document.getElementById(targetID).appendChild(this.fileProgressWrapper);
} else {
this.fileProgressElement = this.fileProgressWrapper.firstChild;
}
this.height = this.fileProgressWrapper.offsetHeight;
}
FileProgress.prototype.setProgress = function (percentage) {
this.fileProgressElement.className = "progressContainer green";
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
this.fileProgressElement.childNodes[3].style.width = percentage + "%";
};
FileProgress.prototype.setComplete = function () {
this.fileProgressElement.className = "progressContainer blue";
this.fileProgressElement.childNodes[3].className = "progressBarComplete";
this.fileProgressElement.childNodes[3].style.width = "";
var oSelf = this;
setTimeout(function () {
oSelf.disappear();
}, 10000);
};
FileProgress.prototype.setError = function () {
this.fileProgressElement.className = "progressContainer red";
this.fileProgressElement.childNodes[3].className = "progressBarError";
this.fileProgressElement.childNodes[3].style.width = "";
var oSelf = this;
setTimeout(function () {
oSelf.disappear();
}, 5000);
};
FileProgress.prototype.setCancelled = function () {
this.fileProgressElement.className = "progressContainer";
this.fileProgressElement.childNodes[3].className = "progressBarError";
this.fileProgressElement.childNodes[3].style.width = "";
var oSelf = this;
setTimeout(function () {
oSelf.disappear();
}, 2000);
};
FileProgress.prototype.setStatus = function (status) {
this.fileProgressElement.childNodes[2].innerHTML = status;
};
// Show/Hide the cancel button
FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
if (swfUploadInstance) {
var fileID = this.fileProgressID;
this.fileProgressElement.childNodes[0].onclick = function () {
swfUploadInstance.cancelUpload(fileID);
return false;
};
}
};
// Fades out and clips away the FileProgress box.
FileProgress.prototype.disappear = function () {
var reduceOpacityBy = 15;
var reduceHeightBy = 4;
var rate = 30; // 15 fps
if (this.opacity > 0) {
this.opacity -= reduceOpacityBy;
if (this.opacity < 0) {
this.opacity = 0;
}
if (this.fileProgressWrapper.filters) {
try {
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
} catch (e) {
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
}
} else {
this.fileProgressWrapper.style.opacity = this.opacity / 100;
}
}
if (this.height > 0) {
this.height -= reduceHeightBy;
if (this.height < 0) {
this.height = 0;
}
this.fileProgressWrapper.style.height = this.height + "px";
}
if (this.height > 0 || this.opacity > 0) {
var oSelf = this;
setTimeout(function () {
oSelf.disappear();
}, rate);
} else {
this.fileProgressWrapper.style.display = "none";
}
};
+200
View File
@@ -0,0 +1,200 @@
/* Demo Note: This demo uses a FileProgress class that handles the UI for displaying the file name and percent complete.
The FileProgress class is not part of SWFUpload.
*/
/* **********************
Event Handlers
These are my custom event handlers to make my
web application behave the way I went when SWFUpload
completes different tasks. These aren't part of the SWFUpload
package. They are part of my application. Without these none
of the actions SWFUpload makes will show up in my application.
********************** */
function fileQueued(file) {
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setStatus(" î÷åðåäè ...");
progress.toggleCancel(true, this);
} catch (ex) {
this.debug(ex);
}
}
function fileQueueError(file, errorCode, message) {
try {
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
alert("Âû âûáðàëè ñëèøêîì ìíîãî ôàéëîâ.\n" + (message === 0 ? "Âû ïðåâûñèëè ëèìèò." : "Âû ìîæåòå âûáðàòü " + (message > 1 ? "íå áîëåå " + message + " ôàéëîâ." : "îäèí ôàéë.")));
return;
}
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setError();
progress.toggleCancel(false);
switch (errorCode) {
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
progress.setStatus("Ôàéë ñëèøêîì áîëüøîé.");
this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
progress.setStatus("Íåâîçìîæíî çàãðóçèòü ôàéë íóëåâîãî ðàçìåðà.");
this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
progress.setStatus("Íåâåðíûé òèï ôàéëà.");
this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
default:
if (file !== null) {
progress.setStatus("Íåèçâåñòíàÿ îøèáêà");
}
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
}
} catch (ex) {
this.debug(ex);
}
}
function fileDialogComplete(numFilesSelected, numFilesQueued) {
try {
if (numFilesSelected > 0) {
document.getElementById(this.customSettings.cancelButtonId).disabled = false;
}
/* I want auto start the upload and I can do that here */
elements = document.getElementById("form").elements;
for(i=0; i < elements.length; i++) {
name = elements[i].name
if (name) {
value = '';
switch(elements[i].type) {
case "select" :
value = elements[i].options[elements[i].selectedIndex].value
break;
case "radio":
case "checkbox":
value = elements[i].checked ? 1: 0;
break;
default:
value = elements[i].value;
break;
}
this.addPostParam(name, value);
}
}
this.startUpload();
} catch (ex) {
this.debug(ex);
}
}
function uploadStart(file) {
try {
/* I don't want to do any file validation or anything, I'll just update the UI and
return true to indicate that the upload should start.
It's important to update the UI here because in Linux no uploadProgress events are called. The best
we can do is say we are uploading.
*/
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setStatus("Çàãðóçêà...");
progress.toggleCancel(true, this);
}
catch (ex) {}
return true;
}
function uploadProgress(file, bytesLoaded, bytesTotal) {
try {
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setProgress(percent);
progress.setStatus("Çàãðóçêà...");
} catch (ex) {
this.debug(ex);
}
}
function uploadSuccess(file, serverData) {
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setComplete();
progress.setStatus("Çàâåðøåíî.");
progress.toggleCancel(false);
} catch (ex) {
this.debug(ex);
}
}
function uploadError(file, errorCode, message) {
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setError();
progress.toggleCancel(false);
switch (errorCode) {
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
progress.setStatus("Îøèáêà: " + message);
this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
progress.setStatus("Îøèáêà çàãðóçêè.");
this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
progress.setStatus("Server (IO) Error");
this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
progress.setStatus("Îøèáêà áåçîïàñíîñòè");
this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
progress.setStatus("Ïðåâûøåí ëèìèò çàãðóçêè.");
this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
progress.setStatus("Îøèáêà èäåíòèôèêàöèè. Çàãðóçêà ïðîïóùåíà.");
this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
// If there aren't any files left (they were all cancelled) disable the cancel button
if (this.getStats().files_queued === 0) {
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
}
progress.setStatus("Îòìåíåíî");
progress.setCancelled();
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
progress.setStatus("Îñòàíîâëåíî");
break;
default:
progress.setStatus("Íåèçâåñòíàÿ îøèáêà: " + errorCode);
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
}
} catch (ex) {
this.debug(ex);
}
}
function uploadComplete(file) {
if (this.getStats().files_queued === 0) {
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
}
}
// This event comes from the Queue Plugin
function queueComplete(numFilesUploaded) {
setTimeout('location.replace( window.location )', 2000);
}
+840
View File
@@ -0,0 +1,840 @@
/**
* SWFUpload v2.1.0 by Jacob Roberts, Feb 2008, http://www.swfupload.org, http://swfupload.googlecode.com, http://www.swfupload.org
* -------- -------- -------- -------- -------- -------- -------- --------
* SWFUpload is (c) 2006 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* See Changelog.txt for version history
*
*/
/* *********** */
/* Constructor */
/* *********** */
var SWFUpload = function (settings) {
this.initSWFUpload(settings);
};
SWFUpload.prototype.initSWFUpload = function (settings) {
try {
this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
this.settings = settings;
this.eventQueue = [];
this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
this.movieElement = null;
// Setup global control tracking
SWFUpload.instances[this.movieName] = this;
// Load the settings. Load the Flash movie.
this.initSettings();
this.loadFlash();
this.displayDebugInfo();
} catch (ex) {
delete SWFUpload.instances[this.movieName];
throw ex;
}
};
/* *************** */
/* Static Members */
/* *************** */
SWFUpload.instances = {};
SWFUpload.movieCount = 0;
SWFUpload.version = "2.2.0 Alpha";
SWFUpload.QUEUE_ERROR = {
QUEUE_LIMIT_EXCEEDED : -100,
FILE_EXCEEDS_SIZE_LIMIT : -110,
ZERO_BYTE_FILE : -120,
INVALID_FILETYPE : -130
};
SWFUpload.UPLOAD_ERROR = {
HTTP_ERROR : -200,
MISSING_UPLOAD_URL : -210,
IO_ERROR : -220,
SECURITY_ERROR : -230,
UPLOAD_LIMIT_EXCEEDED : -240,
UPLOAD_FAILED : -250,
SPECIFIED_FILE_ID_NOT_FOUND : -260,
FILE_VALIDATION_FAILED : -270,
FILE_CANCELLED : -280,
UPLOAD_STOPPED : -290
};
SWFUpload.FILE_STATUS = {
QUEUED : -1,
IN_PROGRESS : -2,
ERROR : -3,
COMPLETE : -4,
CANCELLED : -5
};
SWFUpload.BUTTON_ACTION = {
SELECT_FILE : -100,
SELECT_FILES : -110,
START_UPLOAD : -120
};
/* ******************** */
/* Instance Members */
/* ******************** */
// Private: initSettings ensures that all the
// settings are set, getting a default value if one was not assigned.
SWFUpload.prototype.initSettings = function () {
this.ensureDefault = function (settingName, defaultValue) {
this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
};
// Upload backend settings
this.ensureDefault("upload_url", "");
this.ensureDefault("file_post_name", "Filedata");
this.ensureDefault("post_params", {});
this.ensureDefault("use_query_string", false);
this.ensureDefault("requeue_on_error", false);
// File Settings
this.ensureDefault("file_types", "*.*");
this.ensureDefault("file_types_description", "All Files");
this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited"
this.ensureDefault("file_upload_limit", 0);
this.ensureDefault("file_queue_limit", 0);
// Flash Settings
this.ensureDefault("flash_url", "swfupload_f9.swf");
this.ensureDefault("flash_color", "#FFFFFF");
this.ensureDefault("flash_wmode", "transparent");
this.ensureDefault("flash_container_id", null);
this.ensureDefault("flash_width", '100%');
this.ensureDefault("flash_height", '100%');
// Button Settings
/*
this.ensureDefault("button_image_url", 0);
this.ensureDefault("button_width", 1);
this.ensureDefault("button_height", 1);
this.ensureDefault("button_text", "");
this.ensureDefault("button_text_style", "");
this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
this.ensureDefault("button_disabled", false);
this.ensureDefault("button_placeholder_id", null);
*/
// Debug Settings
this.ensureDefault("debug", false);
this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API
// Event Handlers
this.settings.return_upload_start_handler = this.returnUploadStart;
this.ensureDefault("swfupload_loaded_handler", null);
this.ensureDefault("file_dialog_start_handler", null);
this.ensureDefault("file_queued_handler", null);
this.ensureDefault("file_queue_error_handler", null);
this.ensureDefault("file_dialog_complete_handler", null);
this.ensureDefault("upload_start_handler", null);
this.ensureDefault("upload_progress_handler", null);
this.ensureDefault("upload_error_handler", null);
this.ensureDefault("upload_success_handler", null);
this.ensureDefault("upload_complete_handler", null);
this.ensureDefault("debug_handler", this.debugMessage);
this.ensureDefault("custom_settings", {});
// Other settings
this.customSettings = this.settings.custom_settings;
delete this.ensureDefault;
};
SWFUpload.prototype.loadFlash = function () {
this.insertFlash();
};
// Private: appendFlash gets the HTML tag for the Flash
// It then appends the flash to the body
SWFUpload.prototype.appendFlash = function () {
var targetElement, container;
// Make sure an element with the ID we are going to use doesn't already exist
if (document.getElementById(this.movieName) !== null) {
throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
}
// Get the body tag where we will be adding the flash movie
targetElement = document.getElementsByTagName("body")[0];
if (targetElement == undefined) {
throw "Could not find the 'body' element.";
}
// Append the container and load the flash
container = document.createElement("div");
container.style.width = "1px";
container.style.height = "1px";
targetElement.appendChild(container);
container.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
};
// Private: insertFlash inserts the flash movie into the container element.
SWFUpload.prototype.insertFlash = function () {
var targetElement, container;
// Make sure an element with the ID we are going to use doesn't already exist
if (document.getElementById(this.movieName) !== null) {
throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
}
// Get the container elt into which we'll insert the flash movie
containerElement = document.getElementById(this.settings.flash_container_id);
if (containerElement == undefined) {
throw "Could not find the container element.";
}
// place flash embed inside the container element
containerElement.innerHTML = this.getFlashHTML();
};
// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
SWFUpload.prototype.getFlashHTML = function () {
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.flash_width, '" height="', this.settings.flash_height, '" style="-moz-user-focus: ignore;">',
'<param name="movie" value="', this.settings.flash_url, '" />',
'<param name="bgcolor" value="', this.settings.flash_color, '" />',
'<param name="quality" value="high" />',
'<param name="menu" value="false" />',
'<param name="wmode" value="', this.settings.flash_wmode ,'" />',
'<param name="allowScriptAccess" value="always" />',
'<param name="flashvars" value="' + this.getFlashVars() + '" />',
'</object>'].join("");
};
// Private: getFlashVars builds the parameter string that will be passed
// to flash in the flashvars param.
SWFUpload.prototype.getFlashVars = function () {
// Build a string from the post param object
var paramString = this.buildParamString();
// Build the parameter string
return ["movieName=", encodeURIComponent(this.movieName),
"&amp;uploadURL=", encodeURIComponent(this.settings.upload_url),
"&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
"&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
"&amp;params=", encodeURIComponent(paramString),
"&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
"&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
"&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
"&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
"&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
"&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
//"&amp;buttonImage_url=", encodeURIComponent(this.settings.button_image_url),
//"&amp;buttonWidth=", encodeURIComponent(this.settings.button_width),
//"&amp;buttonHeight=", encodeURIComponent(this.settings.button_height),
//"&amp;buttonText=", encodeURIComponent(this.settings.button_text),
//"&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
//"&amp;buttonAction=", encodeURIComponent(this.settings.button_action),
//"&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled)
].join("");
};
// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
// The element is cached after the first lookup
SWFUpload.prototype.getMovieElement = function () {
if (this.movieElement == undefined) {
this.movieElement = document.getElementById(this.movieName);
}
if (this.movieElement === null) {
throw "Could not find Flash element";
}
return this.movieElement;
};
// Private: buildParamString takes the name/value pairs in the post_params setting object
// and joins them up in to a string formatted "name=value&amp;name=value"
SWFUpload.prototype.buildParamString = function () {
var postParams = this.settings.post_params;
var paramStringPairs = [];
if (typeof(postParams) === "object") {
for (var name in postParams) {
if (postParams.hasOwnProperty(name)) {
paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
}
}
}
return paramStringPairs.join("&amp;");
};
// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
// all references to the SWF, and other objects so memory is properly freed.
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
SWFUpload.prototype.destroy = function () {
try {
// Make sure Flash is done before we try to remove it
this.stopUpload();
// Remove the SWFUpload DOM nodes
var movieElement = null;
try {
movieElement = this.getMovieElement();
} catch (ex) {
}
if (movieElement != undefined && movieElement.parentNode != undefined && typeof(movieElement.parentNode.removeChild) === "function") {
var container = movieElement.parentNode;
if (container != undefined) {
container.removeChild(movieElement);
if (container.parentNode != undefined && typeof(container.parentNode.removeChild) === "function") {
container.parentNode.removeChild(container);
}
}
}
// Destroy references
SWFUpload.instances[this.movieName] = null;
delete SWFUpload.instances[this.movieName];
delete this.movieElement;
delete this.settings;
delete this.customSettings;
delete this.eventQueue;
delete this.movieName;
return true;
} catch (ex1) {
return false;
}
};
// Public: displayDebugInfo prints out settings and configuration
// information about this SWFUpload instance.
// This function (and any references to it) can be deleted when placing
// SWFUpload in production.
SWFUpload.prototype.displayDebugInfo = function () {
this.debug(
[
"---SWFUpload Instance Info---\n",
"Version: ", SWFUpload.version, "\n",
"Movie Name: ", this.movieName, "\n",
"Settings:\n",
"\t", "upload_url: ", this.settings.upload_url, "\n",
"\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
"\t", "file_post_name: ", this.settings.file_post_name, "\n",
"\t", "post_params: ", this.settings.post_params.toString(), "\n",
"\t", "file_types: ", this.settings.file_types, "\n",
"\t", "file_types_description: ", this.settings.file_types_description, "\n",
"\t", "file_size_limit: ", this.settings.file_size_limit, "\n",
"\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n",
"\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n",
"\t", "flash_url: ", this.settings.flash_url, "\n",
"\t", "flash_color: ", this.settings.flash_color, "\n",
"\t", "debug: ", this.settings.debug.toString(), "\n",
"\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
"Event Handlers:\n",
"\t", "swfupload_loaded_handler assigned: ", (typeof(this.settings.swfupload_loaded_handler) === "function").toString(), "\n",
"\t", "file_dialog_start_handler assigned: ", (typeof(this.settings.file_dialog_start_handler) === "function").toString(), "\n",
"\t", "file_queued_handler assigned: ", (typeof(this.settings.file_queued_handler) === "function").toString(), "\n",
"\t", "file_queue_error_handler assigned: ", (typeof(this.settings.file_queue_error_handler) === "function").toString(), "\n",
"\t", "upload_start_handler assigned: ", (typeof(this.settings.upload_start_handler) === "function").toString(), "\n",
"\t", "upload_progress_handler assigned: ", (typeof(this.settings.upload_progress_handler) === "function").toString(), "\n",
"\t", "upload_error_handler assigned: ", (typeof(this.settings.upload_error_handler) === "function").toString(), "\n",
"\t", "upload_success_handler assigned: ", (typeof(this.settings.upload_success_handler) === "function").toString(), "\n",
"\t", "upload_complete_handler assigned: ", (typeof(this.settings.upload_complete_handler) === "function").toString(), "\n",
"\t", "debug_handler assigned: ", (typeof(this.settings.debug_handler) === "function").toString(), "\n"
].join("")
);
};
/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
the maintain v2 API compatibility
*/
// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
SWFUpload.prototype.addSetting = function (name, value, default_value) {
if (value == undefined) {
return (this.settings[name] = default_value);
} else {
return (this.settings[name] = value);
}
};
// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
SWFUpload.prototype.getSetting = function (name) {
if (this.settings[name] != undefined) {
return this.settings[name];
}
return "";
};
// Private: callFlash handles function calls made to the Flash element.
// Calls are made with a setTimeout for some functions to work around
// bugs in the ExternalInterface library.
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
argumentArray = argumentArray || [];
var self = this;
var callFunction = function () {
var movieElement = self.getMovieElement();
var returnValue;
if (typeof(movieElement[functionName]) === "function") {
// We have to go through all this if/else stuff because the Flash functions don't have apply() and only accept the exact number of arguments.
if (argumentArray.length === 0) {
returnValue = movieElement[functionName]();
} else if (argumentArray.length === 1) {
returnValue = movieElement[functionName](argumentArray[0]);
} else if (argumentArray.length === 2) {
returnValue = movieElement[functionName](argumentArray[0], argumentArray[1]);
} else if (argumentArray.length === 3) {
returnValue = movieElement[functionName](argumentArray[0], argumentArray[1], argumentArray[2]);
} else {
throw "Too many arguments";
}
// Unescape file post param values
if (returnValue != undefined && typeof(returnValue.post) === "object") {
returnValue = self.unescapeFilePostParams(returnValue);
}
return returnValue;
} else {
throw "Invalid function name";
}
};
return callFunction();
};
/* *****************************
-- Flash control methods --
Your UI should use these
to operate SWFUpload
***************************** */
// Public: selectFile causes a File Selection Dialog window to appear. This
// dialog only allows 1 file to be selected. WARNING: this function does not work in Flash Player 10
SWFUpload.prototype.selectFile = function () {
this.callFlash("SelectFile");
};
// Public: selectFiles causes a File Selection Dialog window to appear/ This
// dialog allows the user to select any number of files
// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around
// for this bug. WARNING: this function does not work in Flash Player 10
SWFUpload.prototype.selectFiles = function () {
this.callFlash("SelectFiles");
};
// Public: startUpload starts uploading the first file in the queue unless
// the optional parameter 'fileID' specifies the ID
SWFUpload.prototype.startUpload = function (fileID) {
this.callFlash("StartUpload", [fileID]);
};
/* Cancels a the file upload. You must specify a file_id */
// Public: cancelUpload cancels any queued file. The fileID parameter
// must be specified.
SWFUpload.prototype.cancelUpload = function (fileID) {
this.callFlash("CancelUpload", [fileID]);
};
// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
// If nothing is currently uploading then nothing happens.
SWFUpload.prototype.stopUpload = function () {
this.callFlash("StopUpload");
};
/* ************************
* Settings methods
* These methods change the SWFUpload settings.
* SWFUpload settings should not be changed directly on the settings object
* since many of the settings need to be passed to Flash in order to take
* effect.
* *********************** */
// Public: getStats gets the file statistics object.
SWFUpload.prototype.getStats = function () {
return this.callFlash("GetStats");
};
// Public: setStats changes the SWFUpload statistics. You shouldn't need to
// change the statistics but you can. Changing the statistics does not
// affect SWFUpload accept for the successful_uploads count which is used
// by the upload_limit setting to determine how many files the user may upload.
SWFUpload.prototype.setStats = function (statsObject) {
this.callFlash("SetStats", [statsObject]);
};
// Public: getFile retrieves a File object by ID or Index. If the file is
// not found then 'null' is returned.
SWFUpload.prototype.getFile = function (fileID) {
if (typeof(fileID) === "number") {
return this.callFlash("GetFileByIndex", [fileID]);
} else {
return this.callFlash("GetFile", [fileID]);
}
};
// Public: addFileParam sets a name/value pair that will be posted with the
// file specified by the Files ID. If the name already exists then the
// exiting value will be overwritten.
SWFUpload.prototype.addFileParam = function (fileID, name, value) {
return this.callFlash("AddFileParam", [fileID, name, value]);
};
// Public: removeFileParam removes a previously set (by addFileParam) name/value
// pair from the specified file.
SWFUpload.prototype.removeFileParam = function (fileID, name) {
this.callFlash("RemoveFileParam", [fileID, name]);
};
// Public: setUploadUrl changes the upload_url setting.
SWFUpload.prototype.setUploadURL = function (url) {
this.settings.upload_url = url.toString();
this.callFlash("SetUploadURL", [url]);
};
// Public: setPostParams changes the post_params setting
SWFUpload.prototype.setPostParams = function (paramsObject) {
this.settings.post_params = paramsObject;
this.callFlash("SetPostParams", [paramsObject]);
};
// Public: addPostParam adds post name/value pair. Each name can have only one value.
SWFUpload.prototype.addPostParam = function (name, value) {
this.settings.post_params[name] = value;
this.callFlash("SetPostParams", [this.settings.post_params]);
};
// Public: removePostParam deletes post name/value pair.
SWFUpload.prototype.removePostParam = function (name) {
delete this.settings.post_params[name];
this.callFlash("SetPostParams", [this.settings.post_params]);
};
// Public: setFileTypes changes the file_types setting and the file_types_description setting
SWFUpload.prototype.setFileTypes = function (types, description) {
this.settings.file_types = types;
this.settings.file_types_description = description;
this.callFlash("SetFileTypes", [types, description]);
};
// Public: setFileSizeLimit changes the file_size_limit setting
SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
this.settings.file_size_limit = fileSizeLimit;
this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
};
// Public: setFileUploadLimit changes the file_upload_limit setting
SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
this.settings.file_upload_limit = fileUploadLimit;
this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
};
// Public: setFileQueueLimit changes the file_queue_limit setting
SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
this.settings.file_queue_limit = fileQueueLimit;
this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
};
// Public: setFilePostName changes the file_post_name setting
SWFUpload.prototype.setFilePostName = function (filePostName) {
this.settings.file_post_name = filePostName;
this.callFlash("SetFilePostName", [filePostName]);
};
// Public: setUseQueryString changes the use_query_string setting
SWFUpload.prototype.setUseQueryString = function (useQueryString) {
this.settings.use_query_string = useQueryString;
this.callFlash("SetUseQueryString", [useQueryString]);
};
// Public: setRequeueOnError changes the requeue_on_error setting
SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
this.settings.requeue_on_error = requeueOnError;
this.callFlash("SetRequeueOnError", [requeueOnError]);
};
// Public: setDebugEnabled changes the debug_enabled setting
SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
this.settings.debug_enabled = debugEnabled;
this.callFlash("SetDebugEnabled", [debugEnabled]);
};
// Public: setButtonImageURL loads a button image sprite
SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
this.settings.button_image_url = buttonImageURL;
this.callFlash("SetButtonImageURL", [buttonImageURL]);
};
// Public: setButtonDimensions resizes the Flash Movie and button
SWFUpload.prototype.setButtonDimensions = function (width, height) {
this.settings.button_width = width;
this.settings.button_height = height;
this.callFlash("SetButtonDimensions", [width, height]);
};
// Public: setButtonText Changes the text overlaid on the button
SWFUpload.prototype.setButtonText = function (html) {
this.settings.button_text= html;
this.callFlash("SetButtonText", [html]);
};
// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
SWFUpload.prototype.setButtonTextStyle = function (css) {
this.settings.button_text_style = css;
this.callFlash("SetButtonTextStyle", [css]);
};
// Public: setButtonDisabled disables/enables the button
SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
this.settings.button_disabled = isDisabled;
this.callFlash("SetButtonDisabled", [isDisabled]);
};
// Public: setButtonAction sets the action that occurs when the button is clicked
SWFUpload.prototype.setButtonAction = function (buttonAction) {
this.settings.button_action = buttonAction;
this.callFlash("SetButtonAction", [buttonAction]);
};
/* *******************************
Flash Event Interfaces
These functions are used by Flash to trigger the various
events.
All these functions a Private.
Because the ExternalInterface library is buggy the event calls
are added to a queue and the queue then executed by a setTimeout.
This ensures that events are executed in a determinate order and that
the ExternalInterface bugs are avoided.
******************************* */
SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
// Warning: Don't call this.debug inside here or you'll create an infinite loop
if (argumentArray == undefined) {
argumentArray = [];
} else if (!(argumentArray instanceof Array)) {
argumentArray = [argumentArray];
}
var self = this;
if (typeof(this.settings[handlerName]) === "function") {
// Queue the event
this.eventQueue.push(function () {
this.settings[handlerName].apply(this, argumentArray);
});
// Execute the next queued event
setTimeout(function () {
self.executeNextEvent();
}, 0);
} else if (this.settings[handlerName] !== null) {
throw "Event handler " + handlerName + " is unknown or is not a function";
}
};
// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout
// we must queue them in order to garentee that they are executed in order.
SWFUpload.prototype.executeNextEvent = function () {
// Warning: Don't call this.debug inside here or you'll create an infinite loop
var f = this.eventQueue ? this.eventQueue.shift() : null;
if (typeof(f) === "function") {
f.apply(this);
}
};
// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterfance cannot have
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
SWFUpload.prototype.unescapeFilePostParams = function (file) {
var reg = /[$]([0-9a-f]{4})/i;
var unescapedPost = {};
var uk;
if (file != undefined) {
for (var k in file.post) {
if (file.post.hasOwnProperty(k)) {
uk = k;
var match;
while ((match = reg.exec(uk)) !== null) {
uk = uk.replace(match[0], String.fromCharCode(parseInt("0x"+match[1], 16)));
}
unescapedPost[uk] = file.post[k];
}
}
file.post = unescapedPost;
}
return file;
};
SWFUpload.prototype.flashReady = function () {
// Check that the movie element is loaded correctly with its ExternalInterface methods defined
var movieElement = this.getMovieElement();
if (typeof(movieElement.StartUpload) !== "function") {
throw "ExternalInterface methods failed to initialize.";
}
this.queueEvent("swfupload_loaded_handler");
};
/* This is a chance to do something before the browse window opens */
SWFUpload.prototype.fileDialogStart = function () {
this.queueEvent("file_dialog_start_handler");
};
/* Called when a file is successfully added to the queue. */
SWFUpload.prototype.fileQueued = function (file) {
file = this.unescapeFilePostParams(file);
this.queueEvent("file_queued_handler", file);
};
/* Handle errors that occur when an attempt to queue a file fails. */
SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
file = this.unescapeFilePostParams(file);
this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
};
/* Called after the file dialog has closed and the selected files have been queued.
You could call startUpload here if you want the queued files to begin uploading immediately. */
SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued) {
this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued]);
};
SWFUpload.prototype.uploadStart = function (file) {
file = this.unescapeFilePostParams(file);
this.queueEvent("return_upload_start_handler", file);
};
SWFUpload.prototype.returnUploadStart = function (file) {
var returnValue;
if (typeof(this.settings.upload_start_handler) === "function") {
file = this.unescapeFilePostParams(file);
returnValue = this.settings.upload_start_handler.call(this, file);
} else if (this.settings.upload_start_handler != undefined) {
throw "upload_start_handler must be a function";
}
// Convert undefined to true so if nothing is returned from the upload_start_handler it is
// interpretted as 'true'.
if (returnValue === undefined) {
returnValue = true;
}
returnValue = !!returnValue;
this.callFlash("ReturnUploadStart", [returnValue]);
};
SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
};
SWFUpload.prototype.uploadError = function (file, errorCode, message) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_error_handler", [file, errorCode, message]);
};
SWFUpload.prototype.uploadSuccess = function (file, serverData) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_success_handler", [file, serverData]);
};
SWFUpload.prototype.uploadComplete = function (file) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_complete_handler", file);
};
/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
internal debug console. You can override this event and have messages written where you want. */
SWFUpload.prototype.debug = function (message) {
this.queueEvent("debug_handler", message);
};
/* **********************************
Debug Console
The debug console is a self contained, in page location
for debug message to be sent. The Debug Console adds
itself to the body if necessary.
The console is automatically scrolled as messages appear.
If you are using your own debug handler or when you deploy to production and
have debug disabled you can remove these functions to reduce the file size
and complexity.
********************************** */
// Private: debugMessage is the default debug_handler. If you want to print debug messages
// call the debug() function. When overriding the function your own function should
// check to see if the debug setting is true before outputting debug information.
SWFUpload.prototype.debugMessage = function (message) {
if (this.settings.debug) {
var exceptionMessage, exceptionValues = [];
// Check for an exception object and print it nicely
if (typeof(message) === "object" && typeof(message.name) === "string" && typeof(message.message) === "string") {
for (var key in message) {
if (message.hasOwnProperty(key)) {
exceptionValues.push(key + ": " + message[key]);
}
}
exceptionMessage = exceptionValues.join("\n") || "";
exceptionValues = exceptionMessage.split("\n");
exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
SWFUpload.Console.writeLine(exceptionMessage);
} else {
SWFUpload.Console.writeLine(message);
}
}
};
SWFUpload.Console = {};
SWFUpload.Console.writeLine = function (message) {
var console, documentForm;
try {
console = document.getElementById("SWFUpload_Console");
if (!console) {
documentForm = document.createElement("form");
document.getElementsByTagName("body")[0].appendChild(documentForm);
console = document.createElement("textarea");
console.id = "SWFUpload_Console";
console.style.fontFamily = "monospace";
console.setAttribute("wrap", "off");
console.wrap = "off";
console.style.overflow = "auto";
console.style.width = "700px";
console.style.height = "350px";
console.style.margin = "5px";
documentForm.appendChild(console);
}
console.value += message + "\n";
console.scrollTop = console.scrollHeight - console.clientHeight;
} catch (ex) {
alert("Exception: " + ex.name + " Message: " + ex.message);
}
};
@@ -0,0 +1,77 @@
/*
Queue Plug-in
Features:
*Adds a cancelQueue() method for cancelling the entire queue.
*All queued files are uploaded when startUpload() is called.
*If false is returned from uploadComplete then the queue upload is stopped.
If false is not returned (strict comparison) then the queue upload is continued.
*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
Set the event handler with the queue_complete_handler setting.
*/
var SWFUpload;
if (typeof(SWFUpload) === "function") {
SWFUpload.queue = {};
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
return function () {
if (typeof(oldInitSettings) === "function") {
oldInitSettings.call(this);
}
this.customSettings.queue_cancelled_flag = false;
this.customSettings.queue_upload_count = 0;
this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
};
})(SWFUpload.prototype.initSettings);
SWFUpload.prototype.startUpload = function (fileID) {
this.customSettings.queue_cancelled_flag = false;
this.callFlash("StartUpload", false, [fileID]);
};
SWFUpload.prototype.cancelQueue = function () {
this.customSettings.queue_cancelled_flag = true;
this.stopUpload();
var stats = this.getStats();
while (stats.files_queued > 0) {
this.cancelUpload();
stats = this.getStats();
}
};
SWFUpload.queue.uploadCompleteHandler = function (file) {
var user_upload_complete_handler = this.settings.user_upload_complete_handler;
var continueUpload;
if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
this.customSettings.queue_upload_count++;
}
if (typeof(user_upload_complete_handler) === "function") {
continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
} else {
continueUpload = true;
}
if (continueUpload) {
var stats = this.getStats();
if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
this.startUpload();
} else if (this.customSettings.queue_cancelled_flag === false) {
this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);
this.customSettings.queue_upload_count = 0;
} else {
this.customSettings.queue_cancelled_flag = false;
this.customSettings.queue_upload_count = 0;
}
}
};
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
+225
View File
@@ -0,0 +1,225 @@
<?php
class dle_template {
var $dir = '.';
var $template = null;
var $copy_template = null;
var $data = array ();
var $block_data = array ();
var $result = array ('info' => '', 'vote' => '', 'speedbar' => '', 'content' => '' );
var $allow_php_include = true;
function set($name, $var) {
if( is_array( $var ) && count( $var ) ) {
foreach ( $var as $key => $key_var ) {
$this->set( $key, $key_var );
}
} else
$this->data[$name] = $var;
}
function set_block($name, $var) {
if( is_array( $var ) && count( $var ) ) {
foreach ( $var as $key => $key_var ) {
$this->set_block( $key, $key_var );
}
} else
$this->block_data[$name] = $var;
}
function load_template($tpl_name) {
if( $this->CacheTemplate[ $tpl_name ] ){
$this->copy_template = $this->CacheTemplate[ $tpl_name ];
return true;
}
if( $tpl_name == '' || ! file_exists( $this->dir . DIRECTORY_SEPARATOR . $tpl_name ) ) {
die( "Íåâîçìîæíî çàãðóçèòü øàáëîí: " . $tpl_name );
return false;
}
$this->template = file_get_contents( $this->dir . DIRECTORY_SEPARATOR . $tpl_name );
if (strpos ( $this->template, "[aviable=" ) !== false) {$this->template = preg_replace ( "#\\[aviable=(.+?)\\](.*?)\\[/aviable\\]#ies", "\$this->check_module('\\1', '\\2')", $this->template );}
if (strpos ( $this->template, "[not-aviable=" ) !== false) {$this->template = preg_replace ( "#\\[not-aviable=(.+?)\\](.*?)\\[/not-aviable\\]#ies", "\$this->check_module('\\1', '\\2', false)", $this->template );}
if (strpos ( $this->template, "[not-group=" ) !== false) {$this->template = preg_replace ( "#\\[not-group=(.+?)\\](.*?)\\[/not-group\\]#ies", "\$this->check_group('\\1', '\\2', false)", $this->template );}
if (strpos ( $this->template, "[group=" ) !== false) {$this->template = preg_replace ( "#\\[group=(.+?)\\](.*?)\\[/group\\]#ies", "\$this->check_group('\\1', '\\2')", $this->template );}
if (strpos ( $this->template, "{include file=" ) !== false ) {$this->template = preg_replace( "#\\{include file=['\"](.+?)['\"]\\}#ies", "\$this->load_file('\\1', 'tpl')", $this->template );}
$this->copy_template = $this->template;
$this->CacheTemplate[ $tpl_name ] = $this->template;
return true;
}
function load_file( $name, $include_file = "tpl" ) {
global $db, $is_logged, $member_id, $cat_info, $config, $user_group, $category_id, $_TIME, $lang, $smartphone_detected, $dle_module;
$name = str_replace( '..', '', $name );
$url = @parse_url ($name);
$type = explode( ".", $url['path'] );
$type = strtolower( end( $type ) );
if ($type == "tpl") {return $this->sub_load_template( $name );}
if ($include_file == "php") {
if ( !$this->allow_php_include ) return;
if ($type != "php") return "Äëÿ ïîäêëþ÷åíèÿ äîïóñêàþòñÿ òîëüêî ôàéëû ñ ðàñøèðåíèåì .tpl èëè .php";
if ($url['path']{0} == "/" )$file_path = dirname (ROOT_DIR.$url['path']);
else $file_path = dirname (ROOT_DIR."/".$url['path']);
$file_name = pathinfo($url['path']);
$file_name = $file_name['basename'];
if ( stristr ( php_uname( "s" ) , "windows" ) === false )
$chmod_value = @decoct(@fileperms($file_path)) % 1000;
if ($chmod_value == 777 ) return "Ôàéë {$url['path']} íàõîäèòñÿ â ïàïêå, êîòîðàÿ äîñòóïíà äëÿ çàïèñè (CHMOD 777).  öåëÿõ áåçîïàñíîñòè ïîäêëþ÷åíèå ôàéëîâ èç òàêèõ ïàïîê íåâîçìîæíî. Èçìåíèòå ïðàâà íà ïàïêó, ÷òîáû íà íåå íåáûëî ïðàâ íà çàïèñü.";
if ( !file_exists($file_path."/".$file_name) ) return "Ôàéë {$url['path']} íå íàéäåí, åãî çàãðóçêà íåâîçìîæíà.";
if ( $url['query'] ) {parse_str( $url['query'] );}
ob_start();
$tpl = new dle_template( );
$tpl->dir = TEMPLATE_DIR;
include $file_path."/".$file_name;
return ob_get_clean();
}
return '{include file="'.$name.'"}';
}
function sub_load_template( $tpl_name ) {
$tpl_name = totranslit( $tpl_name );
if( $tpl_name == '' || ! file_exists( $this->dir . DIRECTORY_SEPARATOR . $tpl_name ) ) {
return "Îòñóòñòâóåò ôàéë øàáëîíà: " . $tpl_name ;
return false;
}
$template = file_get_contents( $this->dir . DIRECTORY_SEPARATOR . $tpl_name );
if (strpos ( $template, "[aviable=" ) !== false) {$template = preg_replace ( "#\\[aviable=(.+?)\\](.*?)\\[/aviable\\]#ies", "\$this->check_module('\\1', '\\2')", $template );}
if (strpos ( $template, "[not-aviable=" ) !== false) {$template = preg_replace ( "#\\[not-aviable=(.+?)\\](.*?)\\[/not-aviable\\]#ies", "\$this->check_module('\\1', '\\2', false)", $template );}
if (strpos ( $template, "[not-group=" ) !== false) {$template = preg_replace ( "#\\[not-group=(.+?)\\](.*?)\\[/not-group\\]#ies", "\$this->check_group('\\1', '\\2', false)", $template );}
if (strpos ( $this->template, "{if " ) !== false) {$this->template = preg_replace ( "#{if (.+?)}(.*?){/if}#ies", "$this->check_else('1', '2', false)", $this->template );}
if (strpos ( $template, "[group=" ) !== false) {$template = preg_replace ( "#\\[group=(.+?)\\](.*?)\\[/group\\]#ies", "\$this->check_group('\\1', '\\2')", $template );}
return $template;
}
function check_module($aviable, $block, $action = true) {
global $dle_module;
$aviable = explode( '|', $aviable );
$block = str_replace( '\"', '"', $block );
if( $action ) {
if( ! (in_array( $dle_module, $aviable )) and ($aviable[0] != "global") ) return "";
else return $block;
} else {
if( (in_array( $dle_module, $aviable )) ) return "";
else return $block;
}
}
function check_group($groups, $block, $action = true) {
global $member_id;
$groups = explode( ',', $groups );
if( $action ) {
if( ! in_array( $member_id['user_group'], $groups ) ) return "";
} else {
if( in_array( $member_id['user_group'], $groups ) ) return "";
}
$block = str_replace( '\"', '"', $block );
return $block;
}
function _clear() {
$this->data = array ();
$this->block_data = array ();
$this->copy_template = $this->template;
}
function clear() {
$this->data = array ();
$this->block_data = array ();
$this->copy_template = null;
$this->template = null;
}
function global_clear() {
$this->data = array ();
$this->block_data = array ();
$this->result = array ();
$this->copy_template = null;
$this->template = null;
}
function compile($tpl) {
if( count( $this->block_data ) ) {
foreach ( $this->block_data as $key_find => $key_replace ) {
$find_preg[] = $key_find;
$replace_preg[] = $key_replace;
}
$this->copy_template = preg_replace( $find_preg, $replace_preg, $this->copy_template );
}
foreach ( $this->data as $key_find => $key_replace ) {
$find[] = $key_find;
$replace[] = $key_replace;
}
$this->copy_template = str_replace( $find, $replace, $this->copy_template );
if( strpos( $this->copy_template, "{include file=" ) !== false ) {
$this->copy_template = preg_replace( "#\\{include file=['\"](.+?)['\"]\\}#ies", "\$this->load_file('\\1', 'php')", $this->copy_template );
}
if( isset( $this->result[$tpl] ) ) $this->result[$tpl] .= $this->copy_template;
else $this->result[$tpl] = $this->copy_template;
$this->_clear();
}
function check_else($condition, $block){
global $GLOBALS;
extract($GLOBALS, EXTR_SKIP, "");
if(is_array($matches=explode("{else}",$block))) {
$block=$matches[0];
$else=$matches[1];
}
if(eval(("return $condition;"))) return str_replace( '"', '"', $block );
return str_replace( '"', '"', $else );
}
}
?>
+258
View File
@@ -0,0 +1,258 @@
<?php
if( ! defined( 'DATALIFEENGINE' ) ) {die( "Hacking attempt!" );}
class thumbnail {
var $img;
var $watermark_image_light;
var $watermark_image_dark;
function thumbnail($imgfile) {
//detect image format
$info = @getimagesize($imgfile);
if( $info[2] == 2 ) {
$this->img['format'] = "JPEG";
$this->img['src'] = @imagecreatefromjpeg( $imgfile );
} elseif( $info[2] == 3 ) {
$this->img['format'] = "PNG";
$this->img['src'] = @imagecreatefrompng( $imgfile );
} elseif( $info[2] == 1 ) {
$this->img['format'] = "GIF";
$this->img['src'] = @imagecreatefromgif( $imgfile );
} else {
echo "Not Supported File! Thumbnails can only be made from .jpg, gif and .png images!";
@unlink( $imgfile );
exit();
}
if( !$this->img['src'] ) {
echo "Not Supported File! Thumbnails can only be made from .jpg, gif and .png images!";
@unlink( $imgfile );
exit();
}
$this->img['lebar'] = @imagesx( $this->img['src'] );
$this->img['tinggi'] = @imagesy( $this->img['src'] );
$this->img['lebar_thumb'] = $this->img['lebar'];
$this->img['tinggi_thumb'] = $this->img['tinggi'];
//default quality jpeg
$this->img['quality'] = 90;
}
function size_auto($size = 100, $site = 0) {
$size = explode ("x", $size);
if ( count($size) == 2 ) {
$size[0] = intval($size[0]);
$size[1] = intval($size[1]);
return $this->crop( intval($size[0]), intval($size[1]) );
} else {
$size[0] = intval($size[0]);
return $this->scale( intval($size[0]), $site);
}
}
function crop($nw, $nh) {
$w = $this->img['lebar'];
$h = $this->img['tinggi'];
if( $w <= $nw AND $h <= $nh ) {
$this->img['lebar_thumb'] = $w;
$this->img['tinggi_thumb'] = $h;
return 0;
}
$nw = min($nw, $w);
$nh = min($nh, $h);
$size_ratio = max($nw / $w, $nh / $h);
$src_w = ceil($nw / $size_ratio);
$src_h = ceil($nh / $size_ratio);
$sx = floor(($w - $src_w)/2);
$sy = floor(($h - $src_h)/2);
$this->img['des'] = imagecreatetruecolor($nw, $nh);
if ( $this->img['format'] == "PNG" ) {
imagealphablending( $this->img['des'], false);
imagesavealpha( $this->img['des'], true);
}
imagecopyresampled($this->img['des'],$this->img['src'],0,0,$sx,$sy,$nw,$nh,$src_w,$src_h);
$this->img['src'] = $this->img['des'];
return 1;
}
function scale($size = 100, $site = 0) {
$site = intval( $site );
if( $this->img['lebar'] <= $size and $this->img['tinggi'] <= $size ) {
$this->img['lebar_thumb'] = $this->img['lebar'];
$this->img['tinggi_thumb'] = $this->img['tinggi'];
return 0;
}
switch ($site) {
case "1" :
if( $this->img['lebar'] <= $size ) {
$this->img['lebar_thumb'] = $this->img['lebar'];
$this->img['tinggi_thumb'] = $this->img['tinggi'];
return 0;
} else {
$this->img['lebar_thumb'] = $size;
$this->img['tinggi_thumb'] = ($this->img['lebar_thumb'] / $this->img['lebar']) * $this->img['tinggi'];
}
break;
case "2" :
if( $this->img['tinggi'] <= $size ) {
$this->img['lebar_thumb'] = $this->img['lebar'];
$this->img['tinggi_thumb'] = $this->img['tinggi'];
return 0;
} else {
$this->img['tinggi_thumb'] = $size;
$this->img['lebar_thumb'] = ($this->img['tinggi_thumb'] / $this->img['tinggi']) * $this->img['lebar'];
}
break;
default :
if( $this->img['lebar'] >= $this->img['tinggi'] ) {
$this->img['lebar_thumb'] = $size;
$this->img['tinggi_thumb'] = ($this->img['lebar_thumb'] / $this->img['lebar']) * $this->img['tinggi'];
} else {
$this->img['tinggi_thumb'] = $size;
$this->img['lebar_thumb'] = ($this->img['tinggi_thumb'] / $this->img['tinggi']) * $this->img['lebar'];
}
break;
}
if ($this->img['lebar_thumb'] < 1 ) $this->img['lebar_thumb'] = 1;
if ($this->img['tinggi_thumb'] < 1 ) $this->img['tinggi_thumb'] = 1;
$this->img['des'] = imagecreatetruecolor( $this->img['lebar_thumb'], $this->img['tinggi_thumb'] );
if ( $this->img['format'] == "PNG" ) {
imagealphablending( $this->img['des'], false);
imagesavealpha( $this->img['des'], true);
}
@imagecopyresampled( $this->img['des'], $this->img['src'], 0, 0, 0, 0, $this->img['lebar_thumb'], $this->img['tinggi_thumb'], $this->img['lebar'], $this->img['tinggi'] );
$this->img['src'] = $this->img['des'];
return 1;
}
function jpeg_quality($quality = 90) {
//jpeg quality
$this->img['quality'] = $quality;
}
function save($save = "") {
if( $this->img['format'] == "JPG" || $this->img['format'] == "JPEG" ) {
//JPEG
imagejpeg( $this->img['src'], $save, $this->img['quality'] );
} elseif( $this->img['format'] == "PNG" ) {
//PNG
imagealphablending( $this->img['src'], false);
imagesavealpha( $this->img['src'], true);
imagepng( $this->img['src'], $save );
} elseif( $this->img['format'] == "GIF" ) {
//GIF
imagegif( $this->img['src'], $save );
}
imagedestroy( $this->img['src'] );
}
function show() {
if( $this->img['format'] == "JPG" || $this->img['format'] == "JPEG" ) {
//JPEG
imageJPEG( $this->img['src'], "", $this->img['quality'] );
} elseif( $this->img['format'] == "PNG" ) {
//PNG
imagePNG( $this->img['src'] );
} elseif( $this->img['format'] == "GIF" ) {
//GIF
imageGIF( $this->img['src'] );
}
imagedestroy( $this->img['src'] );
}
// *************************************************************************
function insert_watermark($min_image) {
global $config;
$margin = 7;
$this->watermark_image_light = ROOT_DIR . '/templates/' . $config['skin'] . '/images/watermark.png';
$this->watermark_image_dark = ROOT_DIR . '/templates/' . $config['skin'] . '/images/watermark.png';
$image_width = imagesx( $this->img['src'] );
$image_height = imagesy( $this->img['src'] );
list ( $watermark_width, $watermark_height ) = getimagesize( $this->watermark_image_light );
$watermark_x = $image_width - $margin - $watermark_width + $margin;
//$watermark_y = $image_height - $margin - $watermark_height;
$watermark_y = $image_height - $watermark_height;
$watermark_x2 = $watermark_x + $watermark_width;
$watermark_y2 = $watermark_y + $watermark_height;
if( $watermark_x < 0 or $watermark_y < 0 or $watermark_x2 > $image_width or $watermark_y2 > $image_height or $image_width < $min_image or $image_height < $min_image ) {
return;
}
$test = imagecreatetruecolor( 1, 1 );
imagecopyresampled( $test, $this->img['src'], 0, 0, $watermark_x, $watermark_y, 1, 1, $watermark_width, $watermark_height );
$rgb = imagecolorat( $test, 0, 0 );
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
$max = min( $r, $g, $b );
$min = max( $r, $g, $b );
$lightness = ( double ) (($max + $min) / 510.0);
imagedestroy( $test );
$watermark_image = ($lightness < 0.5) ? $this->watermark_image_light : $this->watermark_image_dark;
$watermark = imagecreatefrompng( $watermark_image );
imagealphablending( $this->img['src'], TRUE );
imagealphablending( $watermark, TRUE );
if( $this->img['format'] == "PNG" ) {
$png8fix = imagecreatetruecolor( $image_width, $image_height );
imagecopy( $png8fix, $this->img['src'], 0, 0, 0, 0, $image_width, $image_height );
imagecopy( $png8fix, $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
imagecopy( $this->img['src'], $png8fix, 0, 0, 0, 0, $image_width, $image_height );
imagedestroy( $png8fix );
}else imagecopy( $this->img['src'], $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
imagedestroy( $watermark );
}
}
?>
+537
View File
@@ -0,0 +1,537 @@
<?php
class Torrent {
const timeout = 30;
static protected $_errors = array();
public function __construct ( $data = null, $meta = array(), $piece_length = 256 ) {
if ( is_null( $data ) )
return false;
if ( $piece_length < 32 || $piece_length > 4096 )
return self::set_error( new Exception( 'Invalid piece lenth, must be between 32 and 4096' ) );
if ( is_string( $meta ) )
$meta = array( 'announce' => $meta );
if ( $this->build( $data, $piece_length * 1024 ) )
$this->touch();
else
$meta = array_merge( $meta, $this->decode( $data ) );
foreach( $meta as $key => $value )
$this->{$key} = $value;
}
public function __toString() {
return $this->encode( $this );
}
public function error() {
return empty( self::$_errors ) ?
false :
self::$_errors[0]->getMessage();
}
public function errors() {
return empty( self::$_errors ) ?
false :
self::$_errors;
}
public function announce ( $announce = null ) {
if ( is_null( $announce ) )
return ! isset( $this->{'announce-list'} ) ?
isset( $this->announce ) ? $this->announce : null :
$this->{'announce-list'};
$this->touch();
if ( is_string( $announce ) && isset( $this->announce ) )
return $this->{'announce-list'} = self::announce_list( isset( $this->{'announce-list'} ) ? $this->{'announce-list'} : $this->announce, $announce );
unset( $this->{'announce-list'} );
if ( is_array( $announce ) || is_object( $announce ) )
if ( ( $this->announce = self::first_announce( $announce ) ) && count( $announce ) > 1 )
return $this->{'announce-list'} = self::announce_list( $announce );
else
return $this->announce;
if ( ! isset( $this->announce ) && $announce )
return $this->announce = (string) $announce;
unset( $this->announce );
}
public function comment ( $comment = null ) {
return is_null( $comment ) ?
isset( $this->comment ) ? $this->comment : null :
$this->touch( $this->comment = (string) $comment );
}
public function name ( $name = null ) {
return is_null( $name ) ?
isset( $this->info['name'] ) ? $this->info['name'] : null :
$this->touch( $this->info['name'] = (string) $name );
}
public function is_private ( $private = null ) {
return is_null( $private ) ?
! empty( $this->info['private'] ) :
$this->touch( $this->info['private'] = $private ? 1 : 0 );
}
public function url_list ( $urls = null ) {
return is_null( $urls ) ?
isset( $this->{'url-list'} ) ? $this->{'url-list'} : null :
$this->touch( $this->{'url-list'} = is_string( $urls) ? $urls : (array) $urls );
}
public function httpseeds ( $urls = null ) {
return is_null( $urls ) ?
isset( $this->httpseeds ) ? $this->httpseeds : null :
$this->touch( $this->httpseeds = (array) $urls );
}
public function piece_length () {
return isset( $this->info['piece length'] ) ?
$this->info['piece length'] :
null;
}
public function hash_info () {
return isset( $this->info ) ?
sha1( self::encode( $this->info ) ) :
null;
}
public function content ( $precision = null ) {
$files = array();
if ( isset( $this->info['files'] ) && is_array( $this->info['files'] ) )
foreach ( $this->info['files'] as $file )
$files[self::path( $file['path'], $this->info['name'] )] = $precision ?
self::format( $file['length'], $precision ) :
$file['length'];
elseif ( isset( $this->info['name'] ) )
$files[$this->info['name']] = $precision ?
self::format( $this->info['length'], $precision ) :
$this->info['length'];
return $files;
}
public function offset () {
$files = array();
$size = 0;
if ( isset( $this->info['files'] ) && is_array( $this->info['files'] ) )
foreach ( $this->info['files'] as $file )
$files[self::path( $file['path'], $this->info['name'] )] = array(
'startpiece' => floor( $size / $this->info['piece length'] ),
'offset' => fmod( $size, $this->info['piece length'] ),
'size' => $size += $file['length'],
'endpiece' => floor( $size / $this->info['piece length'] )
);
elseif ( isset( $this->info['name'] ) )
$files[$this->info['name']] = array(
'startpiece' => 0,
'offset' => 0,
'size' => $this->info['length'],
'endpiece' => floor( $this->info['length'] / $this->info['piece length'] )
);
return $files;
}
public function size ( $precision = null ) {
$size = 0;
if ( isset( $this->info['files'] ) && is_array( $this->info['files'] ) )
foreach ( $this->info['files'] as $file )
$size += $file['length'];
elseif ( isset( $this->info['name'] ) )
$size = $this->info['length'];
return is_null( $precision ) ?
$size :
self::format( $size, $precision );
}
public function scrape ( $announce = null, $hash_info = null, $timeout = self::timeout ) {
$packed_hash = urlencode( pack('H*', $hash_info ? $hash_info : $this->hash_info() ) );
$handles = $scrape = array();
if ( ! function_exists( 'curl_multi_init' ) )
return self::set_error( new Exception( 'Install CURL with "curl_multi_init" enabled' ) );
$curl = curl_multi_init();
foreach ( (array) ($announce ? $announce : $this->announce()) as $tier )
foreach ( (array) $tier as $tracker ) {
$tracker = str_ireplace( array( 'udp://', '/announce', ':80/' ), array( 'http://', '/scrape', '/' ), $tracker );
if ( isset( $handles[$tracker] ) )
continue;
$handles[$tracker] = curl_init( $tracker . '?info_hash=' . $packed_hash );
curl_setopt( $handles[$tracker], CURLOPT_RETURNTRANSFER, true );
curl_setopt( $handles[$tracker], CURLOPT_TIMEOUT, $timeout );
curl_multi_add_handle( $curl, $handles[$tracker] );
}
do {
while ( ( $state = curl_multi_exec( $curl, $running ) ) == CURLM_CALL_MULTI_PERFORM );
if( $state != CURLM_OK )
continue;
while ( $done = curl_multi_info_read( $curl ) ) {
$info = curl_getinfo( $done['handle'] );
$tracker = explode( '?', $info['url'], 2 );
$tracker = array_shift( $tracker );
if ( empty( $info['http_code'] ) ) {
$scrape[$tracker] = self::set_error( new Exception( 'Tracker request timeout (' . $timeout . 's)' ), true );
continue;
} elseif ( $info['http_code'] != 200 ) {
$scrape[$tracker] = self::set_error( new Exception( 'Tracker request failed (' . $info['http_code'] . ' code)' ), true );
continue;
}
$data = curl_multi_getcontent( $done['handle'] );
$stats = self::decode_data( $data );
curl_multi_remove_handle( $curl, $done['handle'] );
$scrape[$tracker] = empty( $stats['files'] ) ?
self::set_error( new Exception( 'Empty scrape data' ), true ) :
array_shift( $stats['files'] ) + ( empty( $stats['flags'] ) ? array() : $stats['flags'] );
}
} while ( $running );
curl_multi_close( $curl );
return $scrape;
}
public function save ( $filename = null ) {
return file_put_contents( is_null( $filename ) ? $this->info['name'] . '.torrent' : $filename, $this->encode( $this ) );
}
public function send ( $filename = null ) {
$data = $this->encode( $this );
header( 'Content-type: application/x-bittorrent' );
header( 'Content-Length: ' . strlen( $data ) );
header( 'Content-Disposition: attachment; filename="[files-sib.net]' . ( is_null( $filename ) ? $this->info['name'] . '.torrent' : $filename ) . '"' );
exit( $data );
}
public function magnet ( $html = true ) {
$ampersand = $html ? '&amp;' : '&';
return sprintf( 'magnet:?xt=urn:btih:%2$s%1$sdn=%3$s%1$sxl=%4$d%1$str=%5$s', $ampersand, $this->hash_info(), urlencode( $this->name() ), $this->size(), implode( $ampersand .'tr=', self::untier( $this->announce() ) ) );
}
static public function encode ( $mixed ) {
switch ( gettype( $mixed ) ) {
case 'integer':
case 'double':
return self::encode_integer( $mixed );
case 'object':
$mixed = get_object_vars( $mixed );
case 'array':
return self::encode_array( $mixed );
default:
return self::encode_string( (string) $mixed );
}
}
static private function encode_string ( $string ) {
return strlen( $string ) . ':' . $string;
}
static private function encode_integer ( $integer ) {
return 'i' . $integer . 'e';
}
static private function encode_array ( $array ) {
if ( self::is_list( $array ) ) {
$return = 'l';
foreach ( $array as $value )
$return .= self::encode( $value );
} else {
ksort( $array, SORT_STRING );
$return = 'd';
foreach ( $array as $key => $value )
$return .= self::encode( strval( $key ) ) . self::encode( $value );
}
return $return . 'e';
}
static protected function decode ( $string ) {
$data = is_file( $string ) || self::url_exists( $string ) ?
self::file_get_contents( $string ) :
$string;
return (array) self::decode_data( $data );
}
static private function decode_data ( & $data ) {
switch( self::char( $data ) ) {
case 'i':
$data = substr( $data, 1 );
return self::decode_integer( $data );
case 'l':
$data = substr( $data, 1 );
return self::decode_list( $data );
case 'd':
$data = substr( $data, 1 );
return self::decode_dictionary( $data );
default:
return self::decode_string( $data );
}
}
static private function decode_dictionary ( & $data ) {
$dictionary = array();
$previous = null;
while ( ( $char = self::char( $data ) ) != 'e' ) {
if ( $char === false )
return self::set_error( new Exception( 'Unterminated dictionary' ) );
if ( ! ctype_digit( $char ) )
return self::set_error( new Exception( 'Invalid dictionary key' ) );
$key = self::decode_string( $data );
if ( isset( $dictionary[$key] ) )
return self::set_error( new Exception( 'Duplicate dictionary key' ) );
if ( $key < $previous )
return self::set_error( new Exception( 'Missorted dictionary key' ) );
$dictionary[$key] = self::decode_data( $data );
$previous = $key;
}
$data = substr( $data, 1 );
return $dictionary;
}
static private function decode_list ( & $data ) {
$list = array();
while ( ( $char = self::char( $data ) ) != 'e' ) {
if ( $char === false )
return self::set_error( new Exception( 'Unterminated list' ) );
$list[] = self::decode_data( $data );
}
$data = substr( $data, 1 );
return $list;
}
static private function decode_string ( & $data ) {
if ( self::char( $data ) === '0' && substr( $data, 1, 1 ) != ':' )
self::set_error( new Exception( 'Invalid string length, leading zero' ) );
if ( ! $colon = @strpos( $data, ':' ) )
return self::set_error( new Exception( 'Invalid string length, colon not found' ) );
$length = intval( substr( $data, 0, $colon ) );
if ( $length + $colon + 1 > strlen( $data ) )
return self::set_error( new Exception( 'Invalid string, input too short for string length' ) );
$string = substr( $data, $colon + 1, $length );
$data = substr( $data, $colon + $length + 1 );
return $string;
}
static private function decode_integer ( & $data ) {
$start = 0;
$end = strpos( $data, 'e');
if ( $end === 0 )
self::set_error( new Exception( 'Empty integer' ) );
if ( self::char( $data ) == '-' )
$start++;
if ( substr( $data, $start, 1 ) == '0' && $end > $start + 1 )
self::set_error( new Exception( 'Leading zero in integer' ) );
if ( ! ctype_digit( substr( $data, $start, $start ? $end - 1 : $end ) ) )
self::set_error( new Exception( 'Non-digit characters in integer' ) );
$integer = substr( $data, 0, $end );
$data = substr( $data, $end + 1 );
return 0 + $integer;
}
protected function build ( $data, $piece_length ) {
if ( is_null( $data ) )
return false;
elseif ( is_array( $data ) && self::is_list( $data ) )
return $this->info = $this->files( $data, $piece_length );
elseif ( is_dir( $data ) )
return $this->info = $this->folder( $data, $piece_length );
elseif ( ( is_file( $data ) || self::url_exists( $data ) ) && ! self::is_torrent( $data ) )
return $this->info = $this->file( $data, $piece_length );
else
return false;
}
protected function touch ( $void = null ) {
$this->{'created by'} = 'Files-Sib.NET Tracker';
$this->{'creation date'} = time();
return $void;
}
static protected function set_error ( $exception, $message = false ) {
return ( array_unshift( self::$_errors, $exception ) && $message ) ? $exception->getMessage() : false;
}
static protected function announce_list( $announce, $merge = array() ) {
return array_map( create_function( '$a', 'return (array) $a;' ), array_merge( (array) $announce, (array) $merge ) );
}
static protected function first_announce( $announce ) {
while ( is_array( $announce ) )
$announce = reset( $announce );
return $announce;
}
static protected function pack ( & $data ) {
return pack('H*', sha1( $data ) ) . ( $data = null );
}
static protected function path ( $path, $folder ) {
array_unshift( $path, $folder );
return join( DIRECTORY_SEPARATOR, $path );
}
static protected function is_list ( $array ) {
foreach ( array_keys( $array ) as $key )
if ( ! is_int( $key ) )
return false;
return true;
}
private function pieces ( $handle, $piece_length, $last = true ) {
static $piece, $length;
if ( empty( $length ) )
$length = $piece_length;
$pieces = null;
while ( ! feof( $handle ) ) {
if ( ( $length = strlen( $piece .= fread( $handle, $length ) ) ) == $piece_length )
$pieces .= self::pack( $piece );
elseif ( ( $length = $piece_length - $length ) < 0 )
return self::set_error( new Exception( 'Invalid piece length!' ) );
}
fclose( $handle );
return $pieces . ( $last && $piece ? self::pack( $piece ) : null);
}
private function file ( $file, $piece_length ) {
if ( ! $handle = self::fopen( $file, $size = self::filesize( $file ) ) )
return self::set_error( new Exception( 'Failed to open file: "' . $file . '"' ) );
if ( self::is_url( $file ) )
$this->url_list( $file );
$path = explode( DIRECTORY_SEPARATOR, $file );
return array(
'length' => $size,
'name' => end( $path ),
'piece length' => $piece_length,
'pieces' => $this->pieces( $handle, $piece_length )
);
}
private function files ( $files, $piece_length ) {
if ( ! self::is_url( current( $files ) ) )
$files = array_map( 'realpath', $files );
sort( $files );
usort( $files, create_function( '$a,$b', 'return strrpos($a,DIRECTORY_SEPARATOR)-strrpos($b,DIRECTORY_SEPARATOR);' ) );
$first = current( $files );
$root = dirname( $first );
if ( $url = self::is_url( $first ) )
$this->url_list( dirname( $root ) . DIRECTORY_SEPARATOR );
$path = explode( DIRECTORY_SEPARATOR, dirname( $url ? $first : realpath( $first ) ) );
$pieces = null; $info_files = array(); $count = count( $files ) - 1;
foreach ( $files as $i => $file ) {
if ( $path != array_intersect_assoc( $file_path = explode( DIRECTORY_SEPARATOR, $file ), $path ) ) {
self::set_error( new Exception( 'Files must be in the same folder: "' . $file . '" discarded' ) );
continue;
}
if ( ! $handle = self::fopen( $file, $filesize = self::filesize( $file ) ) ) {
self::set_error( new Exception( 'Failed to open file: "' . $file . '" discarded' ) );
continue;
}
$pieces .= $this->pieces( $handle, $piece_length, $count == $i );
$info_files[] = array(
'length' => $filesize,
'path' => array_diff( $file_path, $path )
);
}
return array(
'files' => $info_files,
'name' => end( $path ),
'piece length' => $piece_length,
'pieces' => $pieces
);
}
private function folder ( $dir, $piece_length ) {
return $this->files( self::scandir( $dir ), $piece_length );
}
static private function char ( $data ) {
return empty( $data ) ?
false :
substr( $data, 0, 1 );
}
static public function format ( $size, $precision = 2 ) {
$units = array ('octets', 'Kb', 'Mb', 'Gb', 'Tb');
while( ( $next = next( $units ) ) && $size > 1024 )
$size /= 1024;
return round( $size, $precision ) . ' ' . ( $next ? prev( $units ) : end( $units ) );
}
static public function filesize ( $file ) {
if ( is_file( $file ) )
return (double) sprintf( '%u', @filesize( $file ) );
else if ( $content_length = preg_grep( $pattern = '#^Content-Length:\s+(\d+)$#i', (array) @get_headers( $file ) ) )
return (int) preg_replace( $pattern, '$1', reset( $content_length ) );
}
static public function fopen ( $file, $size = null ) {
if ( ( is_null( $size ) ? self::filesize( $file ) : $size ) <= 2 * pow( 1024, 3 ) )
return fopen( $file, 'r' );
elseif ( PHP_OS != 'Linux' )
return self::set_error( new Exception( 'File size is greater than 2GB. This is only supported under Linux' ) );
elseif ( ! is_readable( $file ) )
return false;
else
return popen( 'cat ' . escapeshellarg( realpath( $file ) ), 'r' );
}
static public function scandir ( $dir ) {
$paths = array();
foreach ( scandir( $dir ) as $item )
if ( $item != '.' && $item != '..' )
if ( is_dir( $path = realpath( $dir . DIRECTORY_SEPARATOR . $item ) ) )
$paths = array_merge( self::scandir( $path ), $paths );
else
$paths[] = $path;
return $paths;
}
static public function is_url ( $url ) {
return preg_match( '#^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$#i', $url );
}
static public function url_exists ( $url ) {
return self::is_url( $url ) ?
(bool) self::filesize ( $url ) :
false;
}
static public function is_torrent ( $file, $timeout = self::timeout ) {
return ( $start = self::file_get_contents( $file, $timeout, 0, 11 ) ) && $start === 'd8:announce' || $start === 'd10:created';
}
static public function file_get_contents ( $file, $timeout = self::timeout, $offset = null, $length = null ) {
if ( is_file( $file ) || ini_get( 'allow_url_fopen' ) ) {
$context = ! is_file( $file ) && $timeout ?
stream_context_create( array( 'http' => array( 'timeout' => $timeout ) ) ) :
null;
return ! is_null( $offset ) ? $length ?
@file_get_contents( $file, false, $context, $offset, $length ) :
@file_get_contents( $file, false, $context, $offset ) :
@file_get_contents( $file, false, $context );
} elseif ( ! function_exists( 'curl_init' ) )
return self::set_error( new Exception( 'Install CURL or enable "allow_url_fopen"' ) );
$handle = curl_init( $file );
if ( $timeout )
curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
if ( $offset || $length )
curl_setopt( $handle, CURLOPT_RANGE, $offset . '-' . ( $length ? $offset + $length -1 : null ) );
curl_setopt( $handle, CURLOPT_RETURNTRANSFER, 1 );
$content = curl_exec( $handle );
$size = curl_getinfo( $handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD );
curl_close( $handle );
return ( $offset && $size == -1 ) || ( $length && $length != $size ) ? $length ?
substr( $content, $offset, $length) :
substr( $content, $offset) :
$content;
}
static public function untier( $announces ) {
$list = array();
foreach ( (array) $announces as $tier ) {
is_array( $tier ) ?
$list = array_merge( $list, self::untier( $tier ) ) :
array_push( $list, $tier );
}
return $list;
}
public function upload($torrent){
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
if( ! defined( 'DATALIFEENGINE' ) ) {die( "Hacking attempt!" );}
$cron = false;
$_TIME = time () + ($config['date_adjust'] * 60);
$cron_time = $cache->get ( "cron" );
if (date ( "Y-m-d", $cron_time ) != date ( "Y-m-d", $_TIME )) $cron = true;
if($cron) {
$cache->set( "cron", $_TIME );
$db->query( "DELETE FROM " . USERPREFIX . "_banned WHERE days != '0' AND date < '$_TIME' AND users_id = '0'" );
$cache->delete('banned.php' );
if( intval( $config['max_image_days'] ) ) {
$thisdate = $_TIME - ($config['max_image_days'] * 3600 * 24);
$db->query( "SELECT images FROM " . PREFIX . "_images where date < '$thisdate' AND news_id = '0'" );
while ( $row = $db->get_row() ) {
$listimages = explode( "|||", $row['images'] );
if( $row['images'] != "" ) foreach ( $listimages as $dataimages ) {
$url_image = explode( "/", $dataimages );
if( count( $url_image ) == 2 ) {
$folder_prefix = $url_image[0] . "/";
$dataimages = $url_image[1];
} else {
$folder_prefix = "";
$dataimages = $url_image[0];
}
@unlink( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $dataimages );
@unlink( ROOT_DIR . "/uploads/posts/" . $folder_prefix . "thumbs/" . $dataimages );
}}
$db->free();
$db->query( "DELETE FROM " . PREFIX . "_images where date < '$thisdate' AND news_id = '0'" );
}
$cache->clear();
}
?>
+464
View File
@@ -0,0 +1,464 @@
<?PHP
if (! defined ( 'DATALIFEENGINE' )) {die ( "Hacking attempt!" );}
if (!isset ( $do ) AND isset ($_REQUEST['do']) ) $do = totranslit ( $_REQUEST['do'] ); elseif(isset ( $do )) $do = totranslit ( $do ); else $do = "";
if (!isset ( $subaction ) AND isset ($_REQUEST['subaction']) ) $subaction = $_REQUEST['subaction'];
if (isset ( $_REQUEST['doaction'] )) $doaction = $_REQUEST['doaction']; else $doaction = "";
if ($do == "tags" and ! $_GET['tag']) $do = "alltags";
$dle_module = $do;
if ($do == "" and ! $subaction and $year) $dle_module = "date";
elseif ($do == "") $dle_module = $subaction;
if ($subaction == '' AND $newsid) $dle_module = "showfull";
$dle_module = $dle_module ? $dle_module : "main";
if ($cstart < 0) $cstart = 0;
$CN_HALT = FALSE;
$allow_add_comment = FALSE;
$allow_active_news = FALSE;
$allow_comments = FALSE;
$allow_userinfo = FALSE;
$active = FALSE;
$newsmodule = FALSE;
switch ( $do ) {
case "search": if ($_REQUEST['mode'] == "advanced") $_REQUEST['full_search'] = 1; include SYSTEM_DIR . '/modules/search.php'; break;
case "stats": include SYSTEM_DIR . '/modules/stats.php';break;
case "forum": include SYSTEM_DIR.'/forum/main.php';break;
case "addnews": include SYSTEM_DIR . '/modules/addnews.php';break;
case "users": include SYSTEM_DIR.'/modules/users.php';break;
case "register": include SYSTEM_DIR . '/modules/register.php';break;
case "lostpassword": include SYSTEM_DIR . '/modules/lostpassword.php';break;
case "newslist": include SYSTEM_DIR.'/modules/newslist.php';break;
case "static": include SYSTEM_DIR . '/modules/static.php';break;
case "reputation": include SYSTEM_DIR.'/modules/reputation.php';break;
case "chat_history": include SYSTEM_DIR . '/modules/chat/modules.php';break;
case "tracker": include SYSTEM_DIR.'/modules/torrent/list.php';break;
case "table": include SYSTEM_DIR.'/modules/table.php';break;
case "favorites": if ($is_logged) {$config['allow_cache'] = false; include SYSTEM_DIR . '/modules/favorites.php';} else msgbox ( $lang['all_err_1'], $lang['fav_error'] );break;
case "feedback": include SYSTEM_DIR . '/modules/feedback.php';break;
case "lastcomments": include SYSTEM_DIR . '/modules/lastcomments.php';break;
case "pm": include SYSTEM_DIR . '/modules/pm.php';break;
case "rss": include SYSTEM_DIR . '/modules/rss.php';break;
default :
$is_main = 0;
$active = false;
$user_query = "";
$thisdate = date ( "Y-m-d H:i:s", (time () + ($config['date_adjust'] * 60)) );
if (intval ( $config['no_date'] )) $where_date = " AND date < '" . $thisdate . "'"; else $where_date = "";
$fixed = "fixed desc, ";
$config['news_number'] = intval ( $config['news_number'] );
$attachments = array ();
$news_sort_by = ($config['news_sort']) ? $config['news_sort'] : "date";
$news_direction_by = ($config['news_msort']) ? $config['news_msort'] : "DESC";
$allow_list = explode ( ',', $user_group[$member_id['user_group']]['allow_cats'] );
if ($allow_list[0] != "all") {
if ($config['allow_multi_category']) {$stop_list = "category regexp '[[:<:]](" . implode ( '|', $allow_list ) . ")[[:>:]]' AND ";
} else {$stop_list = "category IN ('" . implode ( "','", $allow_list ) . "') AND ";}
} else $stop_list = "";
if ($user_group[$member_id['user_group']]['allow_short']) $stop_list = "";
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date . " ORDER BY " . $fixed . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date;
$sql_news = "";
// ################ Âûâîä îòäåëüíîé êàòåãîðèè #################
if ($do == "cat" and $category != '' and $subaction == '') {
$newsmodule = true;
if (! $category_id) $category_id = 'not detected';
if ($allow_list[0] != "all") {if (! $user_group[$member_id['user_group']]['allow_short'] and ! in_array ( $category_id, $allow_list )) $category_id = 'not detected';}
$get_cats = get_sub_cats ( $category_id );
if ($cat_info[$category_id]['news_sort'] != "") $news_sort_by = $cat_info[$category_id]['news_sort'];
if ($cat_info[$category_id]['news_msort'] != "") $news_direction_by = $cat_info[$category_id]['news_msort'];
if ($cat_info[$category_id]['news_number']) $config['news_number'] = $cat_info[$category_id]['news_number'];
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$url_page = $config['http_home_url'] . get_url ( $category_id );
$user_query = "do=cat&amp;category=" . $cat_info[$category_id]['alt_name'];
if ($config['allow_multi_category']) {$where_category = "category regexp '[[:<:]](" . $get_cats . ")[[:>:]]'";
} else {
$get_cats = str_replace ( "|", "','", $get_cats );
$where_category = "category IN ('" . $get_cats . "')";
}
if (isset ( $_SESSION['dle_sort_cat'] )) $news_sort_by = $_SESSION['dle_sort_cat'];
if (isset ( $_SESSION['dle_direction_cat'] )) $news_direction_by = $_SESSION['dle_direction_cat'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE {$where_category} AND approve" . $where_date . " ORDER BY " . $fixed . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$where_category} AND approve" . $where_date;
} elseif ($do == 'lastnews') {
// ################ Âûâîä âñåõ ïîñëåäíèõ íîâîñòåé #################
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$url_page = $config['http_home_url'] . "lastnews";
$user_query = "do=lastnews";
if (isset ( $_SESSION['dle_sort_lastnews'] )) $news_sort_by = $_SESSION['dle_sort_lastnews']; else $news_sort_by = "date";
if (isset ( $_SESSION['dle_direction_lastnews'] )) $news_direction_by = $_SESSION['dle_direction_lastnews']; else $news_direction_by = "DESC";
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, approve, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}approve" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}approve" . $where_date;
} elseif ($do == 'tags') {
// ################ Ïîèñê íîâîñòåé ïî òåãó #################
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$tag = $db->safesql ( htmlspecialchars ( strip_tags ( stripslashes ( trim ( urldecode ( $_GET['tag'] ) ) ) ), ENT_QUOTES ) );
$url_page = $config['http_home_url'] . "tags/" . urlencode ( $tag );
$user_query = "do=tags&amp;tag=" . urlencode ( $tag );
if (isset ( $_SESSION['dle_sort_tags'] )) $news_sort_by = $_SESSION['dle_sort_tags'];
if (isset ( $_SESSION['dle_direction_tags'] )) $news_direction_by = $_SESSION['dle_direction_tags'];
$db->query ( "SELECT news_id FROM " . PREFIX . "_tags WHERE tag='{$tag}'" );
$tag_array = array ();
while ( $row = $db->get_row () ) {$tag_array[] = $row['news_id'];}
if (count ( $tag_array )) {$tag_array = "(" . implode ( ",", $tag_array ) . ")";
} else {$tag_array = "('undefined')";}
$db->free ();
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, approve, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}id IN {$tag_array} AND approve" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}id IN {$tag_array} AND approve" . $where_date;
$allow_active_news = true;
$tag_array = array ();
unset ( $tag_array );
} elseif ($subaction == 'userinfo') {
// ################ Âûâîä ïðîôèëÿ ïîëüçîâàòåëÿ #################
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$url_page = $config['http_home_url'] . "user/" . urlencode ( $user );
$user_query = "subaction=userinfo&user=" . urlencode ( $user );
if ($member_id['name'] == $user or $user_group[$member_id['user_group']]['allow_all_edit']) {
if (isset ( $_SESSION['dle_sort_userinfo'] )) $news_sort_by = $_SESSION['dle_sort_userinfo'];
if (isset ( $_SESSION['dle_direction_userinfo'] )) $news_direction_by = $_SESSION['dle_direction_userinfo'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, approve, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0' ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0'";
$allow_active_news = false;
} else {$allow_active_news = false;}
$cache->off();
} elseif ($subaction == 'allnews') {
// ################ Âûâîä âñåõ íîâîñòåé ïîëüçîâàòåëÿ #################
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$url_page = $config['http_home_url'] . "user/" . urlencode ( $user ) . "/news";
$user_query = "subaction=allnews&amp;user=" . urlencode ( $user );
if (isset ( $_SESSION['dle_sort_allnews'] )) $news_sort_by = $_SESSION['dle_sort_allnews'];
if (isset ( $_SESSION['dle_direction_allnews'] )) $news_direction_by = $_SESSION['dle_direction_allnews'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, approve, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}autor = '$user' AND approve" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}autor = '$user' AND approve" . $where_date;
$allow_active_news = true;
//$config['allow_cache'] = false;
} elseif ($subaction == 'newposts') {
// ################ Âûâîä íåïðî÷èòàííûõ íîâîñòåé #################
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$url_page = $config['http_home_url'] . "newposts";
$user_query = "subaction=newposts";
$thistime = date ( "Y-m-d H:i:s", $_TIME );
if (isset ( $_SESSION['member_lasttime'] )) {$lasttime = date ( "Y-m-d H:i:s", $_SESSION['member_lasttime'] );
} else {$lasttime = date ( "Y-m-d H:i:s", (time () + ($config['date_adjust'] * 60) - (3600 * 4)) );}
if (isset ( $_SESSION['dle_sort_newposts'] )) $news_sort_by = $_SESSION['dle_sort_newposts'];
if (isset ( $_SESSION['dle_direction_newposts'] )) $news_direction_by = $_SESSION['dle_direction_newposts'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}approve AND date between '$lasttime' and '$thistime' order by " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}approve AND date between '$lasttime' and '$thistime'";
$cache->off();
} else {
// ################ Íîâîñòè íà ãëàâíîé #################
if ($year == '' and $month == '' and $day == '') {
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$url_page = substr ( $config['http_home_url'], 0, strlen ( $config['http_home_url'] ) - 1 );
$user_query = "";
if (isset ( $_SESSION['dle_sort_main'] )) $news_sort_by = $_SESSION['dle_sort_main'];
if (isset ( $_SESSION['dle_direction_main'] )) $news_direction_by = $_SESSION['dle_direction_main'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date . " ORDER BY " . $fixed . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date;
}
// ################ Íîâîñòè çà ãîä #################
if ($year != '' and $month == '' and $day == '') {
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$url_page = $config['http_home_url'] . $year;
$user_query = "year=" . $year;
if (isset ( $_SESSION['dle_sort_date'] )) $news_sort_by = $_SESSION['dle_sort_date'];
if (isset ( $_SESSION['dle_direction_date'] )) $news_direction_by = $_SESSION['dle_direction_date'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-01-01'AND date < '{$year}-01-01' + INTERVAL 1 YEAR AND approve" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-01-01'AND date < '{$year}-01-01' + INTERVAL 1 YEAR AND approve" . $where_date;
}
// ################ Íîâîñòè çà ìåñÿö #################
if ($year != '' and $month != '' and $day == '') {
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$url_page = $config['http_home_url'] . $year . "/" . $month;
$user_query = "year=" . $year . "&amp;month=" . $month;
if (isset ( $_SESSION['dle_sort_date'] )) $news_sort_by = $_SESSION['dle_sort_date'];
if (isset ( $_SESSION['dle_direction_date'] )) $news_direction_by = $_SESSION['dle_direction_date'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-01'AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH AND approve" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-01'AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH AND approve" . $where_date;
}
// ################ Íîâîñòè çà äåíü #################
if ($year != '' and $month != '' and $day != '' and $subaction == '') {
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$url_page = $config['http_home_url'] . $year . "/" . $month . "/" . $day;
$user_query = "year=" . $year . "&amp;month=" . $month . "&amp;day=" . $day;
if (isset ( $_SESSION['dle_sort_date'] )) $news_sort_by = $_SESSION['dle_sort_date'];
if (isset ( $_SESSION['dle_direction_date'] )) $news_direction_by = $_SESSION['dle_direction_date'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR AND approve" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR AND approve" . $where_date;
}
// ################ Íîâîñòü öåëèêîì #################
if ($subaction != '' or $newsid) {
if (! $newsid) $sql_news = "SELECT id, autor, date, short_story, full_story, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, news_read, approve, votes, access, remote_addr, tags, metatitle FROM " . PREFIX . "_post WHERE alt_name ='$news_name' AND date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR LIMIT 0,1";
else $sql_news = "SELECT id, autor, date, short_story, full_story, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, news_read, approve, votes, access, remote_addr, tags, metatitle FROM " . PREFIX . "_post where id = '$newsid'";
if ($subaction == '') $subaction = "showfull";
}}
//Îòîáðàæåíèå ñóáêàòåãîðèé
if($category_id){ foreach($cat_info as $c) if($c['parentid']==$category_id) {
$cat_menu .= "» <a href=\"/".get_url($c['id'])."\" rel=\"index section\"><b>". $c['name'] . "</b></a><div></div>"; }
if ($cat_menu !='')
$cat_menu = "<div class=\"widget\"><div class=\"title\">Êàòåãîðèè</div><div class=\"text\">".$cat_menu."</div></div>";
}
//!Îòîáðàæåíèå ñóáêàòåãîðèé
if ( (intval($_GET['cstart']) == 1) && (strpos($_SERVER['REQUEST_URI'], '/page/1') !== false) ) {
$first_page_url = str_replace ( "/page/1", "", $_SERVER['REQUEST_URI'] );
header("HTTP/1.0 301 Moved Permanently");
header("Location: $first_page_url");
die("Redirect");
}
if (($subaction == "showfull" or $subaction == "addcomment") and ((! isset ( $category ) or $category == ""))) {
if ($_POST['subaction'] == "addcomment") {
$allow_add_comment = TRUE;
$allow_comments = TRUE;
$ajax_adds = false;
include_once (SYSTEM_DIR . '/modules/addcomments.php');
}
if ($subaction == "showfull") {
$allow_comments = TRUE;
include_once (SYSTEM_DIR . '/modules/show.full.php');
}
} else {
if ($subaction == 'userinfo') {
$allow_userinfo = TRUE;
include_once (SYSTEM_DIR . '/modules/profile.php');
} else {
$allow_active_news = TRUE;
}
//####################################################################################################################
// Ïðîñìîòð êðàòêèõ íîâîñòåé
//####################################################################################################################
$_SESSION['referrer'] = $_SERVER['REQUEST_URI'];
if ($do == "lastnews") {
$cache_prefix = "_lastnews";
} elseif ($subaction == 'allnews') {
$cache_prefix = "_allnews_". $user;
} elseif ($do == 'tags') {
$cache_prefix = "_tagscl_". $tag;
} else {
$cache_prefix = "_";
if ($month) $cache_prefix .= "month_" . $month;
if ($year) $cache_prefix .= "year_" . $year;
if ($day) $cache_prefix .= "day_" . $day;
if ($category) $cache_prefix .= "category_" . $category;
}
$cache_prefix .= "_tempate_" . $config['skin'];
if ($is_logged and ($user_group[$member_id['user_group']]['allow_edit'] and ! $user_group[$member_id['user_group']]['allow_all_edit'])) $cache->off();
if (isset($_SESSION['dle_no_cache']) AND $_SESSION['dle_no_cache']) $config['allow_cache'] = false;
if ($cstart) $cache_id = ($cstart / $config['news_number']) + 1; else $cache_id = "1";
if ($cache_id < 6 and ! isset ( $_POST['login'] )) $active = $cache->open( "news", $cache_id . $cache_prefix, true );
else $active = false;
if ($active) {
$tpl->result['content'] .= $active;
$active = null;
} else {
include_once (SYSTEM_DIR . '/modules/show.short.php');
if ($config['files_allow'] == "yes"){
if (strpos ( $tpl->result['content'], "[file=" ) !== false) {$tpl->result['content'] = show_file ( $tpl->result['content'], $attachments );}
if (strpos ( $tpl->result['content'], "[torrent=" ) !== false) {$tpl->result['content'] = show_torrent ( $tpl->result['content'], $attachments );}
}
if ($news_found and $cache_id < 6) $cache->save( "news", $tpl->result['content'], $cache_id . $cache_prefix, true );
}}}
/*
=====================================================
Âûâîä çàãîëîâêà ñòðàíèöû
=====================================================
*/
$titl_e = '';
$nam_e = '';
if ($do == "cat" and $category != '' and $subaction == '') {
//ðåøåíèå ïðîáëåìû ñ êàòåãîðèÿìè, ðåäèðåêò íà âåðíûé óðë, äîáàâëåíèå ñëåøà â êîíåö
if( $category_id AND $view_template != "rss") {
$re_cat = get_url( $category_id );
if ($re_cat != $_GET['category'] OR substr ( $_SERVER['REQUEST_URI'], - 1, 1 ) != '/' ) {
$re_url = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) );
$re_url = reset ( $re_url );
header("HTTP/1.0 301 Moved Permanently");
header("Location: {$re_url}{$re_cat}/");
die("Redirect");
}
}
//ðåøåíèå ïðîáëåìû ñ êàòåãîðèÿìè, ðåäèðåêò íà âåðíûé óðë, äîáàâëåíèå ñëåøà â êîíåö
$metatags['description'] = ($cat_info[$category_id]['descr'] != '') ? $cat_info[$category_id]['descr'] : $metatags['description'];
$metatags['keywords'] = ($cat_info[$category_id]['keywords'] != '') ? $cat_info[$category_id]['keywords'] : $metatags['keywords'];
if ($cat_info[$category_id]['metatitle'] != '') $metatags['header_title'] = $cat_info[$category_id]['metatitle']; else $nam_e = stripslashes ( $cat_info[$category_id]['name'] );
//$rss_url = $url_page . "/" . "rss.xml";
}
elseif ($subaction == "showfull") $rss_url = $config['http_home_url'] . "rss/comments/$newsid/";
elseif ($subaction == 'userinfo')$nam_e = $user;
elseif ($subaction == 'allnews') $nam_e = $lang['show_user_news'] . ' ' . $user;
elseif ($subaction == 'newposts') $nam_e = $lang['title_new'];
elseif ($do == 'stats') $nam_e = $lang['title_stats'];
elseif ($do == 'addnews') $nam_e = $lang['title_addnews'];
elseif ($do == 'register') $nam_e = $lang['title_register'];
elseif ($do == 'favorites') $nam_e = $lang['title_fav'];
elseif ($do == 'pm') $nam_e = $lang['title_pm'];
elseif ($do == 'feedback') $nam_e = $lang['title_feed'];
elseif ($do == 'lastcomments') $nam_e = $lang['title_last'];
elseif ($do == 'lostpassword') $nam_e = $lang['title_lost'];
elseif ($do == 'search') $nam_e = $lang['title_search'];
elseif ($do == 'reputation') $nam_e = 'Ðåïóòàöèÿ » '.$user;
elseif ($do == 'static') $titl_e = $static_descr;
elseif ($do == 'chat_history') $titl_e = " Èñòîðèÿ ñîîáùåíèé Ìèíè-÷àòà";
elseif ($do == 'tracker') $titl_e = "Ñïèñîê ðàçäà÷";
elseif ($do == 'lastnews') $nam_e = $lang['last_news'];
elseif ($do == 'tags') $nam_e = $tag;
elseif ($do == 'newslist') $metatags['title'] = $metatags['titles'].''.$cnt3.''.$cnt5.' » '.$config['home_title'];
else {
if ($year != '' and $month == '' and $day == '') $nam_e = $lang['title_date'] . ' ' . $year . ' ' . $lang['title_year'];
if ($year != '' and $month != '' and $day == '') $nam_e = $lang['title_date'] . ' ' . $r[$month - 1] . ' ' . $year . ' ' . $lang['title_year1'];
if ($year != '' and $month != '' and $day != '' and $subaction == '') $nam_e = $lang['title_date'] . ' ' . $day . '.' . $month . '.' . $year;
if (($subaction != '' or $newsid != '') and $news_found) $titl_e = $metatags['title'];
}
if (intval($_GET['cstart']) > 1 ){
$page_extra = ' &raquo; '.$lang['news_site'].' '.intval($_GET['cstart']);
} else $page_extra = '';
if ($nam_e) {
$metatags['title'] = $nam_e . $page_extra . ' &raquo; ' . $metatags['title'];
$rss_title = $metatags['title'];
} elseif ($titl_e) {
$metatags['title'] = $titl_e . $page_extra . ' &raquo; ' . $config['home_title'];
} else $metatags['title'] .= $page_extra;
if ( $metatags['header_title'] ) $metatags['title'] = stripslashes($metatags['header_title']) . $page_extra;
if (! $rss_url) {
$rss_url = $config['http_home_url'] . "rss/";
$rss_title = $config['home_title'];
//$rss_url .= $config['http_home_url'] . "comments.xml";
}
$metatags = <<<HTML
<title>{$metatags['title']}</title>
<meta http-equiv="Content-Type" content="text/html; charset={$config['charset']}" />
<meta name="description" content="{$metatags['description']}" />
<meta name="keywords" content="{$metatags['keywords']}" />
<link rel="shortcut icon" href="{$config['http_home_url']}favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" href="{$config['http_home_url']}system/opensearch.php" title="{$config['home_title']}" />\n
HTML;
if ($config['allow_rss']) $metatags .= <<<HTML
<link rel="alternate" type="application/rss+xml" title="{$rss_title}" href="{$rss_url}" />
HTML;
?>
+62
View File
@@ -0,0 +1,62 @@
<?php
@session_start ();
define ( 'DATALIFEENGINE', true );
define ( 'FILE_DIR', '../uploads/files/' );
define ( 'ROOT_DIR', '..' );
define ( 'SYSTEM_DIR', ROOT_DIR . '/system' );
@error_reporting ( E_ALL ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_NOTICE );
require SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';
require_once SYSTEM_DIR . '/modules/sitelogin.php';
require_once SYSTEM_DIR . '/classes/download.class.php';
$user_group = $cache->get( "usergroup" );
if( ! $user_group ) {$user_group = array ();
$db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row() ) {$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {$user_group[$row['id']][$key] = stripslashes($value);}
}
$cache->set( "usergroup", $user_group );
$db->free();
}
if (! $is_logged) {$member_id['user_group'] = 5;}
if (! $user_group[$member_id['user_group']]['allow_files']) die ( "Access denied" );
$_SERVER['HTTP_REFERER'] = clean_url ( $_SERVER['HTTP_REFERER'] );
$_SERVER['HTTP_HOST'] = clean_url ( $_SERVER['HTTP_HOST'] );
if ($_SERVER['HTTP_HOST'] != $_SERVER['HTTP_REFERER']) {
@header ( 'Location: ' . $config['http_home_url'] );
die ( "Access denied!!!<br /><br />Please visit <a href=\"{$config['http_home_url']}\">{$config['http_home_url']}</a>" );
}
$id = intval ( $_REQUEST['id'] );
if ($_REQUEST['area'] == "static") $row = $db->super_query ( "SELECT name, onserver FROM " . PREFIX . "_static_files WHERE id ='$id'" );
else $row = $db->super_query ( "SELECT name, onserver FROM " . PREFIX . "_files WHERE id ='$id'" );
if (! $row) die ( "Access denied" );
$config['files_max_speed'] = intval ( $config['files_max_speed'] );
$file = new download ( FILE_DIR . $row['onserver'], $row['name'], $config['files_force'], $config['files_max_speed'] );
if ($_REQUEST['area'] == "static") {
if ($config['files_count'] == "yes" and ! $file->range)
$db->query ( "UPDATE " . PREFIX . "_static_files SET dcount=dcount+1 WHERE id ='$id'" );
} else {
if ($config['files_count'] == "yes" and ! $file->range)
$db->query ( "UPDATE " . PREFIX . "_files SET dcount=dcount+1 WHERE id ='$id'" );
}
$db->close ();
$file->download_file ();
?>
+252
View File
@@ -0,0 +1,252 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
if (check_access($forum_config['post_captcha']))
{
if ($_REQUEST['sec_code'] !== $_SESSION['sec_code_session'] and isset($_SESSION['sec_code_session']))
{
$post_captcha = true;
$_SESSION['sec_code_session'] = FALSE;
}
}
else
{
$post_captcha = false;
}
include_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter(Array(), Array(), 1, 1);
$post_text = $parse->process($post_text);
$post_text = $db->safesql($parse->BB_Parse($post_text, FALSE));
$post_text = auto_wrap ($post_text);
if (strlen($post_text) > $forum_config['post_maxlen'])
{
$post_maxlen = true;
}
else
{
$post_maxlen = false;
}
$topic_title = $db->safesql(urldecode($topic_title));
if (!$is_logged)
{
$name = $db->safesql($parse->BB_Parse($parse->process($name), TRUE));
$mail = $db->safesql($parse->BB_Parse($parse->process($mail), TRUE));
$member_id['name'] = $name;
if ($name)
{
$db->query("SELECT name from " . USERPREFIX . "_users where LOWER(name) = '".strtolower($name)."'");
if (!$db->num_rows()){
$name_ok = true;
}else{
$name_ok = false;
$stop .= $f_lang['err_name'];
}
$db->free();
}
if ($mail)
{
if(preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $mail)){
$mail_ok = true;
}else{
$mail_ok = false;
$stop .= $f_lang['err_mail'];
}
}
if ($name_ok and $mail_ok)
{
$add_post_ok = true;
}
else
{
$add_post_ok = false;
}
}
else
{
$add_post_ok = true;
}
$_TIME = time()+($config['date_adjust']*60);
$topic_date = date ("Y-m-d H:i:s", $_TIME);
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
if ($post_text and $topic_id and $forum_id and $add_post_ok and !$post_captcha and !$post_maxlen)
{
$postcount = intval ($forums_array[$forum_id]['postcount']);
if ($forum_config['post_update'])
{
$row = $db->super_query("SELECT pid, topic_id, post_author, DATE_FORMAT(post_date,'%Y-%m-%d') as post_date, post_text, is_register, post_ip FROM " . PREFIX . "_forum_posts WHERE topic_id = '$topic_id' ORDER BY pid DESC LIMIT 0,1");
$post_id = $row['pid'];
if ($row['post_author'] == $member_id['name'] AND $row['is_register']) $update_post = true;
elseif ($row['ip'] == $_IP AND !$row['is_register'] AND !$is_logged) $update_post = true;
if ($row['post_date'] != date("Y-m-d", $_TIME)) $update_post = false;
}
if (!$update_post){
$db->query("INSERT INTO " . PREFIX . "_forum_posts (topic_id, post_date, post_author, post_text, post_ip, is_register, e_mail, is_count) values ('$topic_id', '$topic_date', '$member_id[name]', '$post_text', '$_IP', '$is_logged', '$mail', '$postcount')");
$new_pid = $db->insert_id();
// update table //
$db->query("UPDATE " . PREFIX . "_forum_topics SET post = post+1, last_date = '$topic_date', last_poster_name = '$member_id[name]', last_post_id = '$new_pid' WHERE tid = '$topic_id'");
$db->query("UPDATE " . PREFIX . "_forum_forums SET posts = posts+1, f_last_tid = '$topic_id', f_last_title = '$topic_title', f_last_date = '$topic_date', f_last_poster_name = '$member_id[name]', last_post_id = '$new_pid' WHERE id = '$forum_id'");
if ($is_logged)
{
if ($postcount)
{
$db->query("UPDATE " . PREFIX . "_users SET forum_post = forum_post+1 WHERE name = '$member_id[name]'");
}
$db->query("DELETE FROM " . PREFIX . "_forum_views WHERE topic_id = '$topic_id' and user_id != '$member_id[user_id]'");
}
if ($forum_config['set_sub_last_up'] and $is_parentid = $forums_array[$forum_id]['parentid'])
{
$db->query("UPDATE " . PREFIX . "_forum_forums SET f_last_tid = '$topic_id', f_last_title = '$topic_title', f_last_date ='$topic_date', f_last_poster_name = '$member_id[name]' WHERE id ='$is_parentid'");
}
}
else
{
$stop_subscription = true;
$post_text = $db->safesql($row['post_text'] . "<br /><br />" . stripslashes($post_text));
$db->query("UPDATE " . PREFIX . "_forum_posts set post_text = '{$post_text}' WHERE pid = '{$post_id}'");
$new_pid = $post_id;
}
if ($post_id)
{
if (stristr ($post_text, "[attachment="))
{
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files
WHERE topic_id = '$topic_id' and file_attach = '0'");
while ($att = $db->get_row($result))
{
if (stristr ($post_text, "[attachment=".$att['file_id']."]") OR stristr ($post_text, "[attachment=".$att['file_id'].":url]"))
{
$update_id[] = $att['file_id'];
}
}
if ($update_id)
{
$update_list = implode(',', $update_id);
$db->query("UPDATE " . PREFIX . "_forum_files SET topic_id = '$topic_id', post_id = '$new_pid', file_attach = '1' WHERE file_id IN ({$update_list})");
}
}
}
$cache->clear ('forum_show_last');
$topic_location = $forum_url."/topic_{$topic_id}/{$page}#post-{$new_pid}";
if (!$ajax_adds)
{
header("Location: {$topic_location}");
}
if ($forum_config['subscription'] AND !$stop_subscription)
{
$all_subscr = $db->query("SELECT name, email FROM ". PREFIX ."_forum_subscription AS t1 INNER JOIN ". PREFIX ."_users AS t2 ON t1.user_id = t2.user_id WHERE t1.topic_id = $topic_id and t1.user_id != '{$member_id['user_id']}'");
if ($db->num_rows($all_subscr))
{
include_once SYSTEM_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$topic_link = $a_forum_url."showtopic={$topic_id}&lastpost=1#reply";
$topic_link_del = $config['http_home_url']."?do=forum&act=subscription&code=del&selected_id={$topic_id}";
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='subscription_text' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
while ($mail_row = $db->get_row($all_subscr))
{
$mail_result = str_replace("{%username_to%}", $mail_row['name'], $mail_tpl['template']);
$mail_result = str_replace("{%username_from%}", $member_id['name'], $mail_result);
$mail_result = str_replace("{%topic_name%}", $topic_title, $mail_result);
$mail_result = str_replace("{%topic_link%}", $topic_link, $mail_result);
$mail_result = str_replace("{%topic_link_del%}", $topic_link_del, $mail_result);
$mail_title = "Óâåäîìëåíèå îá îòâåòàõ íà ïîäïèñàííóþ òåìó";
$mail->send ($mail_row['email'], $mail_title, $mail_result);
}
}
}
$cache->clear ('forum_show_last');
}
else
{
if (!$add_post_ok)
{
forum_msg($f_lang['all_info'], $stop);
$add_post_error = $stop;
}
elseif ($post_captcha)
{
forum_msg($f_lang['all_info'], $f_lang['captcha_stop']);
$add_post_error = $f_lang['ajax_stop_2'];
}
elseif ($post_maxlen)
{
forum_msg($f_lang['all_info'], $f_lang['maxlen_stop']);
$add_post_error = $f_lang['ajax_stop_4'];
}
else
{
forum_msg($f_lang['all_info'], $f_lang['values_error']);
$add_post_error = $f_lang['ajax_stop_3'];
}
}
?>
+325
View File
@@ -0,0 +1,325 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
$forum_id = intval($_REQUEST['forum_id']);
$postcount = intval ($forums_array[$forum_id]['postcount']);
$subscription = intval($_REQUEST['subscription']);
// Îòêðûòèå íîâîé òåìû ïðè ìèíèìóìå ñîîáùåíèé íà ôîðóìå ó þçåðà
if ($member_id['forum_post'] >= $forum_config['min_post'] OR $member_id['user_group'] < 2){
$access_topic = check_access($forums_array[$forum_id]['access_topic']);
}else{
$access_topic = false;
forum_msg($f_lang['all_info'], "Äëÿ îòêðûòèÿ íîâîé òåìû íóæíî èìåòü ìèíèìóì ".$forum_config['min_post']." ïîëåçíûõ ñîîáùåíèé íà ôîðóìå");
}
//Îòêðûòèå íîâîé òåìû ïðè ìèíèìóìå ñîîáùåíèé íà ôîðóìå ó þçåðà.
if ($access_topic)
{
if (!$_REQUEST['subaction'])
{
$access_upload = check_access($forums_array[$forum_id]['access_upload']);
$upload_var = array('area' => "topic", 'forum_id' => $forum_id, 'topic_id' => get_salt(),);
$tpl->set('[not-wysywyg]', "");
$tpl->set('{wysiwyg}','');
$tpl->set('[/not-wysywyg]',"");
include_once SYSTEM_DIR.'/forum/sources/components/bbcode.php';
$topic_action_add = $a_forum_url."act=add_topic&subaction=1";
$tpl->load_template($tpl_dir.'addtopic.tpl');
$tpl->set('{bbcode}',$bb_code);
$tpl->set('{topic_title}',"");
$tpl->set('{topic_descr}',"");
$tpl->set('{text}',"");
if ($is_logged)
{
$tpl->set_block("'\\[not-logged\\](.*?)\\[/not-logged\\]'si","");
}
else
{
$tpl->set('[not-logged]','');
$tpl->set('[/not-logged]','');
}
if (check_access($forum_config['tools_poll']))
{
$tpl->set('[poll]','');
$tpl->set('[/poll]','');
}
else
{
$tpl->set_block("'\\[poll\\](.*?)\\[/poll\\]'si","");
}
if (check_access($forum_config['topic_captcha']))
{
$tpl->set('[sec_code]',"");
$tpl->set('[/sec_code]',"");
$path = parse_url($config['http_home_url']);
$anti_bot = !defined('FORUM_SUB_DOMAIN') ? 'system/modules/' : '';
$tpl->set('{sec_code}',"<span id=\"dle-captcha\"><img src=\"".$path['path'].$anti_bot."antibot.php\" alt=\"${lang['sec_image']}\" border=\"0\"></span>");
}
else
{
$tpl->set('{sec_code}',"");
$tpl->set_block("'\\[sec_code\\](.*?)\\[/sec_code\\]'si","");
}
$tpl->copy_template = "<form method=\"post\" name=\"forum-post-form\" id=\"forum-post-form\" action=\"{$topic_action_add}\">".$tpl->copy_template."
<input type=\"hidden\" name=\"forum_id\" value=\"{$forum_id}\" />
<input type=\"hidden\" name=\"add_tid\" value=\"{$upload_var['topic_id']}\" /></form>
<div id=\"uploads-form\"></div>";
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
if (check_access($forum_config['topic_captcha']))
{
if ($_REQUEST['sec_code'] !== $_SESSION['sec_code_session'] and isset($_SESSION['sec_code_session']))
{
$topic_captcha = true;
$_SESSION['sec_code_session'] = FALSE;
}
}
else
{
$topic_captcha = false;
}
if (!$topic_captcha){
require_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter(Array(), Array(), 1, 1);
if (!$is_logged)
{
$name = $db->safesql($parse->process(trim($_POST['name'])));
$mail = $db->safesql($parse->process(trim($_POST['mail'])));
$member_id['name'] = $name;
$db->query("SELECT name from " . USERPREFIX . "_users where LOWER(name) = '".strtolower($name)."'");
if (!$db->num_rows() > 0)
{
$name_ok = true;
}
else
{
$name_ok = false;
}
$db->free();
if(preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $mail))
{
$mail_ok = true;
}
else
{
$mail_ok = false;
}
if ($name_ok and $mail_ok)
{
$access_add = true;
}
else
{
$access_add = false;
if (!$name_ok) $stop .= $f_lang['err_name'];
if (!$mail_ok) $stop .= $f_lang['err_mail'];
}
}
else
{
$access_add = true;
}
$topic_title = $db->safesql($parse->process($_POST['topic_title']));
$topic_descr = $db->safesql($parse->process($_POST['topic_descr']));
$topic_text = $parse->process($_POST['post_text']);
$topic_text = $db->safesql($parse->BB_Parse($topic_text, FALSE));
$topic_text = auto_wrap ($topic_text);
if (strlen($topic_text) > $forum_config['post_maxlen'])
{
$post_maxlen = true;
$stop .= $f_lang['ajax_stop_4'];
}
else
{
$post_maxlen = false;
}
if ($topic_title and $topic_text and $access_add and !$post_maxlen)
{
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
$vote_title = trim($db->safesql($parse->process($_POST['vote_title'])));
$frage = trim($db->safesql($parse->process($_POST['frage'])));
$vote_body = $db->safesql($parse->BB_Parse($parse->process($_POST['vote_body']), false));
$poll_multiple = intval($_POST['poll_multiple']);
$_TIME = time()+($config['date_adjust']*60);
$topic_date = date ("Y-m-d H:i:s", $_TIME);
if ($forum_config['meta_topic'])
{
$meta = forum_metatags($topic_title . ' ' . $topic_descr . ': ' . $topic_text);
}
else{ $meta = ""; }
$db->query("INSERT INTO " . PREFIX . "_forum_topics (forum_id, title, topic_descr, author_topic, start_date, last_date, last_poster_name, poll_title, frage, poll_body, multiple, meta_descr, meta_keywords) values ('$forum_id', '$topic_title', '$topic_descr', '$member_id[name]', '$topic_date', '$topic_date', '$member_id[name]', '$vote_title', '$frage', '$vote_body', '$poll_multiple', '$meta[description]', '$meta[keywords]')");
$topic_id = $db->insert_id();
$db->query("INSERT INTO " . PREFIX . "_forum_posts (topic_id, post_date, post_author, post_text, post_ip, is_register, e_mail, is_count) values ('$topic_id', '$topic_date', '$member_id[name]', '$topic_text', '$_IP', '$is_logged', '$mail', '$postcount')");
$new_pid = $db->insert_id();
set_first_post_id ($topic_id, $new_pid);
$db->query("UPDATE " . PREFIX . "_forum_forums SET topics = topics+1, f_last_tid = '$topic_id', f_last_title = '$topic_title', f_last_date ='$topic_date', f_last_poster_name = '$member_id[name]' WHERE id ='$forum_id'");
if ($forum_config['set_topic_post'] and $postcount and $is_logged)
{
$db->query("UPDATE " . PREFIX . "_users SET forum_post = forum_post+1 WHERE name = '$member_id[name]'");
}
if ($forum_config['set_sub_last_up'] and $is_parentid = $forums_array[$forum_id]['parentid'])
{
$db->query("UPDATE " . PREFIX . "_forum_forums SET f_last_tid = '$topic_id', f_last_title = '$topic_title', f_last_date = '$topic_date', f_last_poster_name = '$member_id[name]', last_post_id = '$new_pid' WHERE id = '$is_parentid'");
}
if ($subscription and $is_logged)
{
$db->query("SELECT * FROM " . PREFIX . "_forum_subscription WHERE topic_id = '$topic_id' and user_id = '{$member_id['user_id']}'");
if (!$db->num_rows() and $topic_id)
{
$db->query("INSERT INTO " . PREFIX . "_forum_subscription (user_id, topic_id) values ('{$member_id['user_id']}', '$topic_id')");
}
}
if ($_REQUEST['add_tid'])
{
if (stristr ($topic_text, "[attachment="))
{
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files
WHERE topic_id = '{$_REQUEST['add_tid']}' and file_attach = '0'");
while ($att = $db->get_row($result))
{
if (stristr($topic_text, "[attachment={$att['file_id']}]") OR stristr($topic_text, "/forum/files/{$att['onserver']}"))
{
$update_id[] = $att['file_id'];
}
}
if ($update_id)
{
$update_list = implode(',', $update_id);
$db->query("UPDATE " . PREFIX . "_forum_files SET topic_id = '$topic_id', post_id = '$new_pid', file_attach = '1' WHERE file_id IN ({$update_list})");
}
}
}
if ($forum_config['topic_email'])
{
$topic_link = $config['http_home_url']."?do=forum&showtopic={$topic_id}";
include_once SYSTEM_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='new_topic' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
$mail_result = str_replace("{%username%}", $member_id[name], $mail_tpl['template']);
$mail_result = str_replace("{%date%}", $topic_date, $mail_result);
$mail_result = str_replace("{%title%}", $topic_title, $mail_result);
$mail_result = str_replace("{%link%}", $topic_link, $mail_result);
$mail->send ($config['admin_mail'], "DLE Forum - NEW TOPIC", $mail_result);
}
if ($forum_config['mod_rewrite'])
{
$topic_location = $forum_url."/topic_".$topic_id;
}
else
{
$topic_location = $forum_url."showtopic=".$topic_id;
}
$cache->clear('forum_show_last');
header("Location: $topic_location");
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['topic_add_stop'], 'stop', "<br />".$stop);
}
}
else
{
if ($topic_captcha)
{
forum_msg($f_lang['all_info'], $f_lang['captcha_stop']);
}
}
}
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['f_msg'], $f_lang['topic_add_ndeny'], 'user_group', $group_name);
}
if ($forum_config['forum_bar'])
{
$bbr_fid = $forum_id;
$bbr_fname = $forums_array[$forum_id]['name'];
$category_id = $forums_array[$forum_id]['main_id'];
$bbr_cid = $category_id;
$bbr_name = $cats_array[$category_id]['cat_name'];
$bbr_app = $f_lang['app_newtopic'];
}
?>
+158
View File
@@ -0,0 +1,158 @@
<?php
$code = !empty($_POST['code']) ? $_POST['code'] : $_GET['code'];
$fid = intval($_REQUEST['fid']);
switch ($code)
{
// ********************************************************************************
// FORUM CALCULATOR
// ********************************************************************************
case "calc":
if (is_moderation($fid, 0, 0))
{
$posts_in_forum = '0';
$result_topics = $db->query("SELECT tid FROM " . PREFIX . "_forum_topics WHERE forum_id = '$fid'");
while ($row = $db->get_row($result_topics))
{
$forum_topic++;
$p_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_posts WHERE topic_id = '$row[tid]'");
$posts_in_forum = ($posts_in_forum + $p_count['count']);
}
if (!$forum_config['set_topic_post'])
{
$posts_in_forum = ($posts_in_forum - $forum_topic);
}
if ($forum_config['topic_sort']) $sort_type = "last_date";
else $sort_type = "tid";
$row1 = $db->super_query("SELECT * FROM ". PREFIX ."_forum_topics WHERE forum_id = '$fid' ORDER by $sort_type DESC");
$db->query("UPDATE " . PREFIX . "_forum_forums SET posts = '$posts_in_forum', topics = '$forum_topic', f_last_tid = '$row1[tid]', f_last_title = '$row1[title]', f_last_date ='$row1[last_date]', f_last_poster_name = '$row1[last_poster_name]' WHERE id = '$fid'");
header("Location: $_SERVER[HTTP_REFERER]");
}
else
{
header("Location: $_SERVER[HTTP_REFERER]");
}
break;
// ********************************************************************************
// USER
// ********************************************************************************
case "user":
$mname = $db->safesql($_REQUEST['mname']);
if ($mname)
{
$get_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE author_topic = '$mname' and hidden = 0");
$count_all = $get_count['count'];
}
if ($count_all){
if ($cstart)
{
$cstart = $cstart - 1;
$cstart = $cstart * $forum_config['topic_inpage'];
}
if ($forum_config['topic_sort'])
{
$sort_type = "last_date";
}
else
{
$sort_type = "tid";
}
// ********************************************************************************
// TOPIC VIEWS
// ********************************************************************************
if ($is_logged)
{
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]' and time > '$topic_a_time'");
$topic_views = array();
while ($row = $db->get_row($row_views))
{
$topic_views[$row['topic_id']] = '1';
}
}
else
{
$row_views = explode(",", $_COOKIE['dle_forum_views']);
foreach ($row_views as $value)
{
$topic_views[$value] = '1';
}
}
$config_inpage = $forum_config['topic_inpage'];
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_topics WHERE author_topic = '$mname' and hidden = 0 ORDER BY fixed, ".$sort_type." DESC LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
$icat = $forum_url."act=getforum&code=user&mname={$mname}&cstart=";
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
$tpl->load_template($tpl_dir.'forum.tpl');
$tpl->set('{forum}', $f_lang['app_user_topic'].': '.$mname);
$tpl->set('{subforums}','');
$tpl->set('{topics}', $tpl->result['topics']);
$tpl->set('{info}', $msg_info);
$tpl->set('{navigation}', $tpl->result['navigation']);
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si","");
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
$bbr_app = $f_lang['app_user_topic'];
break;
}
?>
+520
View File
@@ -0,0 +1,520 @@
<?php
/*
=====================================================
DLE Forum - by DLE Files Group
-----------------------------------------------------
http://dle-files.ru/
-----------------------------------------------------
File: moderation.php
=====================================================
Copyright (c) 2008,2010 DLE Files Group
=====================================================
*/
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$code = !empty($_POST['code']) ? $_POST['code'] : $_GET['code'];
$selectedtids = $_REQUEST['selected_id'];
$subaction = $_REQUEST['subaction'];
switch ($code)
{
// ********************************************************************************
// OPEN TOPIC
// ********************************************************************************
case "01":
if ($selectedtids and is_moderation(0, $selectedtids, 0) OR group_moderation($selectedtids, 'forum_topic_set'))
{
if (!moderator_value('open_topic', $forum_id, $m_member) AND !group_moderation($selectedtids, 'forum_topic_set')) die();
$selectedtids = explode(",",$selectedtids);
foreach($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$db->query("UPDATE " . PREFIX . "_forum_topics SET topic_status = '0' WHERE tid = '$topic_id'");
$db->query("UPDATE " . PREFIX . "_forum_posts SET hidden = '0' WHERE topic_id = '$topic_id' and hidden NOT IN (1,6)");
}
header("Location: $_SERVER[HTTP_REFERER]");
}
else
{
die("Hacking attempt!");
}
break;
// ********************************************************************************
// CLOSE TOPIC
// ********************************************************************************
case "02":
if ($selectedtids and is_moderation(0, $selectedtids, 0) OR group_moderation($selectedtids, 'forum_topic_set'))
{
if (!moderator_value('close_topic', $forum_id, $m_member) AND !group_moderation($selectedtids, 'forum_topic_set')) die();
$selectedtids = explode(",",$selectedtids);
foreach($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$db->query("UPDATE " . PREFIX . "_forum_topics SET topic_status = '1' WHERE tid = '$topic_id'");
$db->query("UPDATE " . PREFIX . "_forum_posts SET hidden = '2' WHERE topic_id = '$topic_id' and hidden NOT IN (1,6)");
}
header("Location: {$_SERVER['HTTP_REFERER']}");
}
else
{
die("Hacking attempt!");
}
break;
// ********************************************************************************
// DEL TOPIC
// ********************************************************************************
case "03":
if ($selectedtids and is_moderation(0, $selectedtids, 0) OR group_moderation($selectedtids, 'forum_topic_del'))
{
if (!moderator_value('delete_topic', $forum_id, $m_member) AND !group_moderation($selectedtids, 'forum_topic_del')) die();
$selectedtids = explode(",",$selectedtids);
foreach($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$row_topic = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$topic_id'");
$topic_id = $row_topic['tid'];
$forum_id = $row_topic['forum_id'];
$post_all = $row_topic['post'];
if (!$forum_config['set_topic_post'])
{
$post_all = ($post_all - 1);
}
if ($topic_id)
{
// user converting //
if ($forum_config['set_post_num_up'])
{
$query = $db->query("SELECT distinct post_author FROM " . PREFIX . "_forum_posts WHERE topic_id = '$topic_id'");
while ($row = $db->get_row($query))
{
if ($forum_config['set_topic_post'])
{
$topic = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE author_topic = '$row[post_author]'");
$topic_num = $topic['count'];
}
$post = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_posts WHERE post_author = '$row[post_author]'");
$post_num = $post['count'];
$update = ($topic_num + $post_num);
$db->query("UPDATE " . PREFIX . "_users SET forum_post = '$update' WHERE name ='$row[post_author]'");
}
}
// Óäàëåíèå âëîæåíèé âìåñòå ñ òåìîé
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE topic_id = '" . $topic_id . "'");
while ($row = $db->get_row($result)) {
if ($row['file_type'] == "file") {
unlink(UPLOAD_DIR."files/" . $row['onserver']);
} elseif ($row['file_type'] == "thumb") {
unlink(UPLOAD_DIR."thumbs/" . $row['onserver']);
unlink(UPLOAD_DIR."images/" . $row['onserver']);
} else {
unlink(UPLOAD_DIR."images/" . $row['onserver']);
}
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE topic_id = '" . $topic_id . "'");
// êîíåö óäàëåíèÿ âëîæåíèé âìåñòå ñ òåìîé
$db->query("DELETE FROM " . PREFIX . "_forum_posts WHERE topic_id = '$topic_id'");
$db->query("DELETE FROM " . PREFIX . "_forum_topics WHERE `tid` = '$topic_id'");
$new_result = $db->super_query("SELECT * FROM ". PREFIX ."_forum_topics WHERE forum_id = '$forum_id' ORDER by start_date DESC");
$db->query("UPDATE " . PREFIX . "_forum_forums SET topics = topics-1, posts = posts-$post_all, f_last_tid = '$new_result[tid]', f_last_title = '$new_result[title]', f_last_date = '$new_result[last_date]', f_last_poster_name = '$new_result[last_poster_name]' WHERE id ='$forum_id'");
$db->query("DELETE FROM " . PREFIX . "_forum_poll_log WHERE topic_id = '$topic_id'");
// del discuss id //
$db->query("UPDATE " . PREFIX . "_post SET news_tid = '0' WHERE news_tid = '$topic_id'");
// del attachment //
$db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE topic_id = '$topic_id'"); // and file_attach='1'
while($row = $db->get_row())
{
if ($row['file_type'] == "image")
{
@unlink(UPLOAD_DIR."images/".$row['onserver']);
}
elseif ($row['file_type'] == "thumb")
{
@unlink(UPLOAD_DIR."thumbs/".$row['onserver']);
@unlink(UPLOAD_DIR."images/".$row['onserver']);
}
else
{
@unlink(UPLOAD_DIR."files/".$row['onserver']);
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE file_id = '$row[file_id]'");
} // end - del attachment //
}
}
if ($forum_config['mod_rewrite'])
{
$forum_location = "{$forum_url}/forum_{$forum_id}";
}
else
{
$forum_location = "{$forum_url}showforum={$forum_id}";
}
header("Location: {$forum_location}");
}
else
{
die("Hacking attempt!");
}
break;
// ********************************************************************************
// EDIT TOPIC TITLE
// ********************************************************************************
case "04":
$selectedtids = intval($selectedtids);
if (!$subaction and is_moderation(0, $selectedtids, 0) OR !$subaction and group_moderation($selectedtids, 'forum_topic_edit'))
{
if (!moderator_value('edit_topic', $forum_id, $m_member) AND !group_moderation($selectedtids, 'forum_topic_edit')) die();
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '{$selectedtids}'");
$topic_action_add = $a_forum_url."act=moderation&code=04&subaction=save&selected_id={$selectedtids}";
require_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter();
$parse->safe_mode = true;
$topic_title = $parse->decodeBBCodes($row['title'], false);
$topic_descr = $parse->decodeBBCodes($row['topic_descr'], false);
$tpl->load_template($tpl_dir.'edittopic.tpl');
$tpl->set('{topic_title}', $topic_title);
$tpl->set('{topic_descr}', $topic_descr);
if (check_access($forum_config['tools_poll']))
{
$tpl->set('[poll]','');
$tpl->set('[/poll]','');
$tpl->set('{vote_title}', $parse->decodeBBCodes($row['poll_title'], false));
$tpl->set('{frage}', $parse->decodeBBCodes($row['frage'], false));
$tpl->set('{vote_body}', $parse->decodeBBCodes($row['poll_body'], false));
}
else
{
$tpl->set_block("'\\[poll\\](.*?)\\[/poll\\]'si","");
}
$tpl->copy_template = "<form method=\"post\" name=\"dle-comments-form\" id=\"dle-comments-form\" action=\"{$topic_action_add}\">".$tpl->copy_template."</form>";
$tpl->compile('dle_forum');
$tpl->clear();
}
if ($subaction == "save" and is_moderation(0, $selectedtids, 0) OR $subaction == "save" and group_moderation($selectedtids, 'forum_topic_edit'))
{
if (!moderator_value('edit_topic', $forum_id, $m_member) AND !group_moderation($selectedtids, 'forum_topic_edit')) die();
require_once SYSTEM_DIR.'/classes/parse.class.php';
$parse->safe_mode = true;
$parse = new ParseFilter(Array(), Array(), 1, 1);
$topic_title = $db->safesql($parse->process($_POST['topic_title']));
$topic_descr = $db->safesql($parse->process($_POST['topic_descr']));
$vote_title = trim($db->safesql($parse->process($_POST['vote_title'])));
$frage = trim($db->safesql($parse->process($_POST['frage'])));
$vote_body = $db->safesql($parse->BB_Parse($parse->process($_POST['vote_body']), false));
$poll_multiple = intval($_POST['poll_multiple']);
$db->query("UPDATE " . PREFIX . "_forum_topics SET title = '$topic_title', topic_descr = '$topic_descr', poll_title = '$vote_title', frage = '$frage', poll_body = '$vote_body', multiple = '$poll_multiple' WHERE tid = '$selectedtids'");
if ($forum_config['mod_rewrite'])
{
$topic_location = "{$forum_url}/topic_$selectedtids";
} else
{
$topic_location = "{$forum_url}showtopic=$selectedtids";
}
header("Location: $topic_location");
}
$bbr_app = "Ðåäàêòèðîâàíèå òåìû";
break;
// ********************************************************************************
// MOVE TOPIC
// ********************************************************************************
case "05":
if ($selectedtids and is_moderation(0, $selectedtids, 0))
{
if (!moderator_value('move_topic', $is_mod['forum_id'], $m_member)) die();
$move_fid = $_REQUEST['move_fid'];
if (!$subaction)
{
$topic_action_add = "{$a_forum_url}act=moderation&code=05&subaction=move&selected_id=$selectedtids";
$tpl->load_template($tpl_dir.'movetopic.tpl');
$tpl->set('{topic_title}', $topic_title);
$tpl->set('{forum}', $is_forum_name);
$tpl->set('{forum_list}', forum_list());
$tpl->copy_template = "<form method=\"post\" action=\"{$topic_action_add}\">".$tpl->copy_template."</form>";
$tpl->compile('dle_forum');
$tpl->clear();
}
if ($subaction == "move" and $selectedtids and $move_fid)
{
$tid = $selectedtids;
$selectedtids = explode(",",$selectedtids);
$new_post_count = 0;
$postcount = intval ($forums_array[$move_fid]['postcount']);
foreach ($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$db->query("UPDATE " . PREFIX . "_forum_topics SET forum_id = '$move_fid' WHERE tid = '$topic_id'");
$tid_count++;
$post = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_posts WHERE topic_id = '$topic_id'");
$post_count = $post_count + $post['count'];
$db->query("UPDATE " . PREFIX . "_forum_posts SET is_count = '$postcount' WHERE topic_id = '$topic_id'");
}
$post_count = $post_count - $tid_count;
if ($forum_config['topic_sort']) $sort_type = "last_date";
else $sort_type = "tid";
$row1 = $db->super_query("SELECT * FROM ". PREFIX ."_forum_topics WHERE forum_id = '{$is_mod['forum_id']}' ORDER by $sort_type DESC");
$row2 = $db->super_query("SELECT * FROM ". PREFIX ."_forum_topics WHERE forum_id = '$move_fid' ORDER by $sort_type DESC");
$db->query("UPDATE " . PREFIX . "_forum_forums SET posts = posts-$post_count, topics = topics-$tid_count, f_last_tid = '$row1[tid]', f_last_title = '$row1[title]', f_last_date ='$row1[last_date]', f_last_poster_name = '$row1[last_poster_name]' WHERE id = '{$is_mod['forum_id']}'");
$db->query("UPDATE " . PREFIX . "_forum_forums SET posts = posts+$post_count, topics = topics+$tid_count, f_last_tid = '$row2[tid]', f_last_title = '$row2[title]', f_last_date ='$row2[last_date]', f_last_poster_name = '$row2[last_poster_name]' WHERE id = '$move_fid'");
if ($forum_config['mod_rewrite'])
{
$topic_location = "{$forum_url}/topic_$tid";
$forum_location = "{$forum_url}/forum_$move_fid";
}
else
{
$topic_location = "{$forum_url}showtopic=$tid";
$forum_location = "{$forum_url}showforum=$move_fid";
}
if ($tid_count > 1)
{
header("Location: $forum_location");
}
else
{
header("Location: $topic_location");
}
}
$bbr_app = "Ïåðåìåùåíèå òåìû";
}
break;
// ********************************************************************************
// HIDDEN TOPIC
// ********************************************************************************
case "06":
if ($selectedtids and is_moderation(0, $selectedtids, 0))
{
$selectedtids = explode(",",$selectedtids);
foreach($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$db->query("UPDATE " . PREFIX . "_forum_topics SET hidden = '1' WHERE tid = '$topic_id'");
$db->query("UPDATE " . PREFIX . "_forum_posts SET hidden = '6' WHERE topic_id = '$topic_id' and hidden NOT IN (1,2)");
}
header("Location: {$_SERVER['HTTP_REFERER']}");
}
break;
// ********************************************************************************
// NOT HIDDEN TOPIC
// ********************************************************************************
case "07":
if ($selectedtids and is_moderation(0, $selectedtids, 0))
{
$selectedtids = explode(",",$selectedtids);
foreach($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$db->query("UPDATE " . PREFIX . "_forum_topics SET hidden = '0' WHERE tid = '$topic_id'");
$db->query("UPDATE " . PREFIX . "_forum_posts SET hidden = '0' WHERE topic_id = '$topic_id' and hidden NOT IN (1,2)");
}
header("Location: {$_SERVER['HTTP_REFERER']}");
}
break;
// ********************************************************************************
// FIXED TOPIC
// ********************************************************************************
case "08":
if ($selectedtids and is_moderation(0, $selectedtids, 0))
{
if (!moderator_value('pin_topic', $forum_id, $m_member)) die();
$selectedtids = explode(",",$selectedtids);
foreach($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$db->query("UPDATE " . PREFIX . "_forum_topics SET fixed = '0' WHERE tid = '$topic_id'");
}
header("Location: {$_SERVER['HTTP_REFERER']}");
}
break;
// ********************************************************************************
// NOT FIXED TOPIC
// ********************************************************************************
case "09":
if ($selectedtids and is_moderation(0, $selectedtids, 0))
{
if (!moderator_value('unpin_topic', $forum_id, $m_member)) die();
$selectedtids = explode(",",$selectedtids);
foreach($selectedtids as $topic_id)
{
$topic_id = intval($topic_id);
if ( $topic_id == 0 ) continue;
$db->query("UPDATE " . PREFIX . "_forum_topics SET fixed = '1' WHERE tid = '$topic_id'");
}
header("Location: {$_SERVER['HTTP_REFERER']}");
}
break;
// ********************************************************************************
// CALC
// ********************************************************************************
case "10":
$topic_id = intval($_REQUEST['tid']);
if ($topic_id and is_moderation(0, $topic_id, 0))
{
calk_topic_del ($topic_id);
header("Location: {$_SERVER['HTTP_REFERER']}");
}
break;
// ********************************************************************************
// Default
// ********************************************************************************
default:
header("Location: {$_SERVER['HTTP_REFERER']}");
break;
}
?>
+515
View File
@@ -0,0 +1,515 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$code = !empty($_POST['code']) ? $_POST['code'] : $_GET['code'];
$subaction = $_REQUEST['subaction'];
$selected_id = $_REQUEST['selected_id'];
switch ($code)
{
// ********************************************************************************
// ADD POST
// ********************************************************************************
case "add":
$forum_id = intval($_POST['forum_id']);
$topic_id = intval($_POST['topic_id']);
$page = intval($_REQUEST['page']);
$post_id = $db->safesql($_POST['post_id']);
$topic_title = $_POST['topic_ti'];
$post_text = $_POST['post_text'];
$name = $_POST['name'];
$mail = $_POST['mail'];
$check_write = check_access($forums_array[$forum_id]['access_write']);
if ($check_write)
{
require_once SYSTEM_DIR.'/forum/action/addpost.php';
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['all_info'], $f_lang['topic_write'], 'user_group', $group_name);
}
break;
// ********************************************************************************
// EDIT POST
// ********************************************************************************
case "02":
$pid = intval($_REQUEST['pid']);
$page = intval($_REQUEST['p']);
$post_n = intval($_REQUEST['pn']);
if ($pid)
{
if (is_moderation(0, 0, $pid, 'forum_post_edit'))
{
include_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter(Array(), Array(), 1, 1);
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_posts WHERE `pid` = '$pid'");
$post_text = $parse->decodeBBCodes($row['post_text'], false);
$topic_id = $row['topic_id'];
$fid = $db->super_query("SELECT forum_id FROM " . PREFIX . "_forum_topics WHERE tid = '$topic_id'");
$forum_id = $fid['forum_id'];
$access_upload = check_access($forums_array[$forum_id]['access_upload']);
$upload_var = array('area'=>"post", 'forum_id'=>$forum_id, 'topic_id'=>$topic_id, 'post_id'=>$pid);
if ($row['pid'])
{
$edit_post_action = $a_forum_url."act=post&code=03&pid=$pid&topic_id=$topic_id&p=$page&pn=$post_n";
$tpl->load_template($tpl_dir.'addpost.tpl');
$tpl->set('{title}', $f_lang['app_post_edit']);
$tpl->set('[not-wysywyg]', "");
$tpl->set('{wysiwyg}','');
$tpl->set('[/not-wysywyg]',"");
include_once SYSTEM_DIR.'/forum/sources/components/bbcode.php';
if (!$is_logged)
{
$tpl->set('[not-logged]','');
$tpl->set('[/not-logged]','');
}
else
{
$tpl->set_block("'\\[not-logged\\](.*?)\\[/not-logged\\]'si","");
}
$tpl->set_block("'\\[sec_code\\](.*?)\\[/sec_code\\]'si","");
$tpl->set('{bbcode}',$bb_code);
$tpl->set('{text}',$post_text);
$tpl->copy_template = "<form method=\"post\" name=\"forum-post-form\" id=\"forum-post-form\" action=\"{$edit_post_action}\">".$tpl->copy_template."</form><div id=\"uploads-form\"></div>";
$tpl->compile('dle_forum');
$tpl->clear();
}
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
break;
// ********************************************************************************
// SAVE POST
// ********************************************************************************
case "03":
$pid = intval($_REQUEST['pid']);
$topic_id = intval($_REQUEST['topic_id']);
$page = intval($_REQUEST['p']);
$post_n = intval($_REQUEST['pn']);
if (is_moderation(0, 0, $pid, 'forum_post_edit'))
{
include_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter(Array(), Array(), 1, 1);
$post_text = $parse->process($_POST['post_text']);
$post_text = $db->safesql($parse->BB_Parse($post_text, FALSE));
$post_text = auto_wrap ($post_text);
if (strlen($post_text) > $forum_config['post_maxlen'])
{
$post_maxlen = true;
}
else
{
$post_maxlen = false;
}
if ($post_text and !$post_maxlen)
{
$_TIME = time()+($config['date_adjust']*60);
$edit_info = ", edit_user = '{$member_id[name]}', edit_time = '{$_TIME}'";
$db->query("UPDATE " . PREFIX . "_forum_posts SET post_text = '$post_text' {$edit_info} WHERE pid = '$pid'");
check_attachment($pid, $post_text);
if ($forum_config['mod_rewrite'])
{
$topic_location = $forum_url."/topic_{$topic_id}/$page#post-$post_n";
}
else
{
$topic_location = $forum_url."showtopic=$topic_id&cstart=$page#post-$post_n";
}
header("Location: $topic_location");
}
else
{
if ($post_maxlen)
{
forum_msg($f_lang['f_msg'], $f_lang['maxlen_stop']);
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['topic_add_stop'], 'stop', '');
}
}
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
break;
// ********************************************************************************
// DEL POST
// ********************************************************************************
case "04":
if (is_moderation(0, 0, $selected_id, 'forum_post_del'))
{
$selected_id = explode(",", $selected_id);
foreach ($selected_id as $post_id)
{
$db->query("DELETE FROM " . PREFIX . "_forum_posts WHERE pid = '$post_id'");
// Óäàëåíèå âëîæåíèé âìåñòå ñ ñîîáùåíèåì
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE post_id = '" . $post_id . "'");
while ($row = $db->get_row($result)) {
if ($row['file_type'] == "file") {
unlink(UPLOAD_DIR."files/" . $row['onserver']);
} elseif ($row['file_type'] == "thumb") {
unlink(UPLOAD_DIR."thumbs/" . $row['onserver']);
unlink(UPLOAD_DIR."images/" . $row['onserver']);
} else {
unlink(UPLOAD_DIR."images/" . $row['onserver']);
}
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE post_id = '" . $post_id . "'");
// êîíåö óäàëåíèÿ âëîæåíèé âìåñòå ñ òåìîé
$update_id[] = $post_id;
$del_count++;
}
if ($update_id)
{
$update_list = implode(',', $update_id);
$db->query("UPDATE " . PREFIX . "_forum_files SET file_attach = '0' WHERE post_id IN ({$update_list})");
}
if ($is_mod['topic_id'] and $del_count)
{
calk_topic_del ($is_mod['topic_id'], $del_count);
}
if ($forum_config['mod_rewrite']) $topic_location = $forum_url."/topic_".$is_mod['topic_id'];
else $topic_location = $forum_url."showtopic=".$is_mod['topic_id'];
header("Location: $topic_location");
}
else break;
break;
// ********************************************************************************
// UN HIDDEN POST
// ********************************************************************************
case "05":
if ($selected_id and is_moderation(0, 0, $selected_id))
{
$selected_id = explode(",", $selected_id);
foreach ($selected_id as $post_id)
{
$db->query("UPDATE " . PREFIX . "_forum_posts SET hidden = '0' WHERE pid = '$post_id'");
}
header("Location: $_SERVER[HTTP_REFERER]");
}
else break;
break;
// ********************************************************************************
// HIDDEN POST
// ********************************************************************************
case "06":
if ($selected_id and is_moderation(0, 0, $selected_id))
{
$selected_id = explode(",", $selected_id);
foreach ($selected_id as $post_id)
{
$db->query("UPDATE " . PREFIX . "_forum_posts SET hidden = '1' WHERE pid = '$post_id'");
}
header("Location: $_SERVER[HTTP_REFERER]");
}
else break;
break;
// ********************************************************************************
// Combining POST
// ********************************************************************************
case "07":
if ($selected_id and is_moderation(0, 0, $selected_id, 'combining_post'))
{
$pid_list = $db->safesql($selected_id);
$db->query("SELECT * FROM " . PREFIX . "_forum_posts WHERE pid IN ($pid_list)");
$join_posts_error = false;
$post_author = array();
$posts_text = array();
$selected_id = array();
$topic_id = 0;
while ($row = $db->get_row())
{
$count++;
$selected_id[] = $row['pid'];
if ($count == 1)
{
$topic_id = $row['topic_id'];
}
if (!in_array($row['post_author'], $post_author))
{
$post_author[] = $row['post_author'];
}
if ($row['topic_id'] !== $topic_id)
{
$join_posts_error = true;
}
$posts_text[] = $row['post_text'];
}
if ($count > 1 and !$join_posts_error)
{
$new_post = implode("<br /><br />", $posts_text);
$new_post = $db->safesql($new_post);
foreach ($selected_id as $key => $value_pid)
{
$pid_count++;
if ($pid_count == 1)
{
$edit_info = ", edit_user = '{$member_id[name]}', edit_time = '{$_TIME}'";
$db->query("UPDATE " . PREFIX . "_forum_posts SET post_text = '$new_post' {$edit_info} WHERE pid = '$value_pid'");
}
else
{
$db->query("DELETE FROM " . PREFIX . "_forum_posts WHERE pid = '$value_pid'");
$del_count++;
}
}
$del_count = $del_count + 1;
calk_topic_del ($topic_id, $del_count);
if ($forum_config['mod_rewrite']) $topic_location = $forum_url . "/topic_" . $topic_id;
else $topic_location = $forum_url . "showtopic=" . $topic_id;
header("Location: $topic_location");
}
}
break;
// ********************************************************************************
// Move POST
// ********************************************************************************
case "08":
$new_topic = $_REQUEST['new_topic'];
$new_topic_id = 0;
if (intval($new_topic) != 0)
{
$new_topic_id = intval ($new_topic);
}
else
{
preg_match_all("#topic_([0-9]{1,10})#", $new_topic, $matches);
$new_topic_id = intval ($matches[1][0]);
if (!$new_topic_id)
{
preg_match_all("#showtopic=([0-9]{1,10})#", $new_topic, $matches);
$new_topic_id = intval ($matches[1][0]);
}
}
if ($selected_id and is_moderation(0, 0, $selected_id, 'move_post'))
{
if (!$subaction)
{
$action_moveposts = $a_forum_url."act=post&code=08&subaction=move&selected_id={$selected_id}";
$tpl->load_template($tpl_dir.'moveposts.tpl');
$tpl->copy_template = "<form method=\"post\" action=\"{$action_moveposts}\">".$tpl->copy_template."</form>";
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
if ($new_topic_id)
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = $new_topic_id");
$new_forum_id = $row['forum_id'];
if ($row['tid'])
{
// get info //
$post_id = intval($selected_id);
$row_post = $db->super_query("SELECT * FROM " . PREFIX . "_forum_posts WHERE pid = $post_id");
$old_topic_id = $row_post['topic_id'];
$row2 = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = $old_topic_id");
$old_forum_id = $row2['forum_id'];
// - //
if ($old_topic_id == $new_topic_id)
{
die("error");
}
$in_post_id = array();
$selected_id = explode(",", $selected_id);
foreach ($selected_id as $post_id)
{
$post_count++;
$in_post_id[] = $post_id;
}
$post_id_list = implode(',', $in_post_id);
$db->query("UPDATE " . PREFIX . "_forum_posts SET topic_id = $new_topic_id WHERE pid IN ({$post_id_list})");
if ($old_forum_id == $new_forum_id)
{
unset ($post_count);
}
calk_topic_del ($new_topic_id, $post_count, '+');
calk_topic_del ($old_topic_id, $post_count, '-');
if ($forum_config['mod_rewrite']) $topic_location = $forum_url . "/topic_" . $new_topic_id;
else $topic_location = $forum_url . "showtopic=" . $new_topic_id;
header("Location: $topic_location");
}
}
}
}
break;
// ********************************************************************************
// ERROR
// ********************************************************************************
default:
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
break;
}
?>
+352
View File
@@ -0,0 +1,352 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
$code = !empty($_POST['code']) ? $_POST['code'] : $_GET['code'];
$subaction = $_REQUEST['subaction'];
$tid = intval($_REQUEST['tid']);
$pid = intval($_REQUEST['pid']);
switch ($code)
{
// ********************************************************************************
// REPLY
// ********************************************************************************
case "reply":
$row_topic = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$tid'");
$forum_id = $row_topic['forum_id'];
$topic_title = stripslashes($row_topic['title']);
$topic_title_last = urlencode($topic_title);
$check_moderator = check_moderator($forums_array[$forum_id]['access_mod'], $forums_array[$forum_id]['moderators']);
$check_write = check_access($forums_array[$forum_id]['access_write']);
$page_n = @ceil(($row_topic['post'] + 1) / $forum_config['post_inpage']);
if ($row_topic['topic_status'] and !$check_moderator)
{
$topic_status = false;
}
else
{
$topic_status = true;
}
if ($check_write and $topic_status)
{
$access_upload = check_access($forums_array[$forum_id]['access_upload']);
$upload_var = array('area'=>"post", 'forum_id'=>$forum_id, 'topic_id'=>$tid, 'post_id'=>get_salt());
$tpl->load_template($tpl_dir.'addpost.tpl');
$tpl->set('{title}', $f_lang['app_reply']);
$tpl->set('[not-wysywyg]', "");
$tpl->set('{wysiwyg}','');
$tpl->set('[/not-wysywyg]',"");
include_once SYSTEM_DIR.'/forum/sources/components/bbcode.php';
if (!$is_logged)
{
$tpl->set('[not-logged]','');
$tpl->set('[/not-logged]','');
}
else
{
$tpl->set_block("'\\[not-logged\\](.*?)\\[/not-logged\\]'si","");
}
if (check_access($forum_config['post_captcha']))
{
$tpl->set('[sec_code]',"");
$tpl->set('[/sec_code]',"");
$path = parse_url($config['http_home_url']);
$anti_bot = !defined('FORUM_SUB_DOMAIN') ? 'system/modules/' : '';
$tpl->set('{sec_code}',"<span id=\"dle-captcha\"><img src=\"".$path['path'].$anti_bot."antibot.php\" alt=\"${lang['sec_image']}\" border=\"0\"></span>");
}
else
{
$tpl->set('{sec_code}',"");
$tpl->set_block("'\\[sec_code\\](.*?)\\[/sec_code\\]'si","");
}
$tpl->set('{bbcode}',$bb_code);
$tpl->set('{text}',"");
$add_post_action = $a_forum_url."act=post&code=add&page={$page_n}";
$tpl->copy_template = "<form method=\"post\" name=\"forum-post-form\" id=\"forum-post-form\" action=\"{$add_post_action}\">".$tpl->copy_template."
<input type=\"hidden\" name=\"topic_id\" id=\"topic_id\" value=\"{$tid}\" />
<input type=\"hidden\" name=\"topic_ti\" id=\"topic_id\" value=\"{$topic_title_last}\" />
<input type=\"hidden\" name=\"forum_id\" id=\"forum_id\" value=\"{$forum_id}\" />
<input type=\"hidden\" name=\"post_id\" id=\"post_id\" value=\"{$upload_var['post_id']}\" /></form>
<div id=\"uploads-form\"></div>";
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['all_info'], $f_lang['topic_write'], 'user_group', $group_name);
}
if ($forum_config['forum_bar'])
{
$bbr_fid = $forum_id;
$bbr_fname = $forums_array[$forum_id]['name'];
$category_id = $forums_array[$forum_id]['main_id'];
$bbr_cid = $category_id;
$bbr_name = $cats_array[$category_id]['cat_name'];
$bbr_tid = $tid;
$bbr_tname = $topic_title;
$bbr_app = $f_lang['app_reply'];
}
break;
// ********************************************************************************
// FORWARD
// ********************************************************************************
case "forward":
if ($is_logged)
{
if (!$subaction)
{
$result = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$tid'");
if ($result['tid'])
{
$topic_action_add = $a_forum_url."act=_topic&code=forward&subaction=send&tid={$tid}";
$tpl->load_template($tpl_dir.'send_frend.tpl');
$topic_link = $a_forum_url."showtopic={$tid}";
$tpl->set('{topic_title}', $result['title']);
$tpl->set('{topic_link}', $topic_link);
$tpl->set('{user_name}', $member_id['name']);
$tpl->copy_template = "<form method=\"post\" name=\"dle-comments-form\" id=\"dle-comments-form\" action=\"{$topic_action_add}\">".$tpl->copy_template."</form>";
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
}
else
{
$frend_name = strip_tags(stripslashes($_REQUEST['frend_name']));
$frend_mail = strip_tags(stripslashes($_REQUEST['frend_mail']));
$frend_title = strip_tags(stripslashes($_REQUEST['frend_title']));
$frend_text = strip_tags(stripslashes($_REQUEST['frend_text']));
if ($frend_name and $frend_mail and $frend_title and $frend_text)
{
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='frend_text' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
$mail_result = str_replace("{%username_from%}", $member_id['name'], $mail_tpl['template']);
$mail_result = str_replace("{%username_to%}", $frend_name, $mail_result);
$mail_result = str_replace("{%text%}", $frend_text, $mail_result);
include_once SYSTEM_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$mail->send ($frend_mail, $frend_title, $mail_result);
$topic_link = $a_forum_url."showtopic={$tid}";
forum_msg($f_lang['f_msg'], $f_lang['mail_send'], "link", $topic_link);
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['values_error']);
}
}
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['f_msg'], $f_lang['page_deny'], "user_group", $group_name);
}
$bbr_app = $f_lang['title_forward'];
break;
// ********************************************************************************
// PRINT
// ********************************************************************************
case "print":
$row_topic = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$tid'");
$forum_id = $row_topic['forum_id'];
$check_read = check_access($forums_array[$forum_id]['access_read']);
if ($check_read)
{
if ($row_topic['topic_descr'])
{
$row_topic['title'] = $row_topic['title'].', '.$row_topic['topic_descr'];
}
$result_posts = $db->query("SELECT p.*, u.* FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . USERPREFIX . "_users AS u ON p.post_author=u.name WHERE p.topic_id = '$tid' and p.hidden = '0' ORDER by pid");
while ($row = $db->get_row($result_posts))
{
$row['post_date'] = strtotime($row['post_date']);
$tpl->load_template($tpl_dir.'print/post.tpl');
$tpl->set('{author}', $row['post_author']);
$tpl->set('{post-date}', show_date($row['post_date']));
$tpl->set('{text}', $row['post_text']);
if ($member_id['forum_post'] >= $forum_config['post_hide'])
{
$tpl->set_block("'\[hide\](.*?)\[/hide\]'si","\\1");
}
else
{
$hide_info = "Âíèìàíèå! Ó âàñ íåò ïðàâ, äëÿ ïðîñìîòðà ñêðûòîãî òåêñòà. Íåîáõîäèìî $forum_config[post_hide] ñîîáùåíèé.";
$tpl->set_block("'\\[hide\\](.*?)\\[/hide\\]'si","<div class=\"quote\">".$hide_info."</div>");
}
$tpl->compile('posts');
$tpl->clear();
}
if (stristr ($tpl->result['posts'], "[attachment="))
{
require_once SYSTEM_DIR.'/forum/sources/components/attachment.php';
}
$tpl->load_template($tpl_dir.'print/topic.tpl');
$tpl->set('{topic_link}', $a_forum_url."showtopic=".$row_topic['tid']);
$tpl->set('{topic_title}', $row_topic['title']);
$tpl->set('{post_list}', $tpl->result['posts']);
$tpl->compile('topic_print');
$tpl->clear();
die ($tpl->result['topic_print']);
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
break;
// ********************************************************************************
// POST REPORT
// ********************************************************************************
case "report":
if ($is_logged AND !$forum_config['mod_report'])
{
if (!$subaction)
{
$report_action_add = $a_forum_url."act=_topic&code=report&subaction=add&tid={$tid}&pid={$pid}";
$tpl->load_template($tpl_dir.'report.tpl');
$tpl->copy_template = "<form method=\"post\" name=\"dle-comments-form\" id=\"dle-comments-form\" action=\"{$report_action_add}\">".$tpl->copy_template."</form>";
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
$report = strip_tags(stripslashes($_REQUEST['report']));
if ($tid AND $pid AND $report)
{
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='report_text' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
$topic_link = $a_forum_url."showtopic={$tid}";
$mail_result = str_replace("{%username_from%}", $member_id['name'], $mail_tpl['template']);
$mail_result = str_replace("{%text%}", $report, $mail_result);
$mail_result = str_replace("{%topic_link%}", $topic_link, $mail_result);
$mail_result = str_replace("{%post_id%}", $pid, $mail_result);
include_once SYSTEM_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$mail->send ($config['admin_mail'], "DLE Forum - REPORT", $mail_result);
forum_msg($f_lang['f_msg'], $f_lang['report_send'], "link", $topic_link);
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['values_error']);
}
}
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
break;
default:
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
break;
}
?>
+59
View File
@@ -0,0 +1,59 @@
<?php
include 'init.php';
$ajax_start = true;
$tpl = new dle_template;
$tpl->dir = ROOT_DIR.'/templates/'.$_REQUEST['skin'];
define('TEMPLATE_DIR', $tpl->dir);
$name = convert_unicode($_POST['name'], $config['charset']);
$mail = convert_unicode($_POST['mail'], $config['charset']);
$post_text = trim(convert_unicode($_POST['post_text'], $config['charset']));
$topic_title = convert_unicode($_POST['topic_title'], $config['charset']);
$topic_id = intval($_POST['topic_id']);
$forum_id = intval($_POST['forum_id']);
$post_id = $_POST['post_id'];
$ajax_adds = TRUE;
$access_mod = array(1);
require_once SYSTEM_DIR.'/forum/action/addpost.php';
$clear_value = "form.post_text.value = '';";
if(!$add_post_error){
$result_posts = $db->query("SELECT * FROM " . PREFIX . "_forum_posts LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_forum_posts.post_author=" . USERPREFIX . "_users.name WHERE " . PREFIX . "_forum_posts.topic_id = '$topic_id' ORDER BY pid DESC LIMIT 1");
$tid = $topic_id;
require_once SYSTEM_DIR.'/forum/sources/showposts.php';
$tpl->result['content'] = "<div id=\"blind-animation\" style=\"display:none\">".$tpl->result['posts']."<div>";
$tpl->result['content'] = str_replace('{THEME}', $config['http_home_url'].'templates/'.$_REQUEST['skin'], $tpl->result['content']);
$tpl->result['content'] .= <<<HTML
<script language='JavaScript' type="text/javascript">
var timeval = new Date().getTime();
var form = document.getElementById('forum-post-form');
{$clear_value}
</script>
HTML;
}
else
{
$tpl->result['content'] = "<script language=\"JavaScript\" type=\"text/javascript\">\n alert ('".$add_post_error."');\n </script>";
}
@header("Content-type: text/html; charset=".$config['charset']);
echo $tpl->result['content'];
?>
+208
View File
@@ -0,0 +1,208 @@
function ajax_post_edit ( p_id ){
if ( ! c_cache[ p_id ] || c_cache[ p_id ] == '' ){
c_cache[ p_id ] = $('#post-id-'+p_id).html();
}
ShowLoading('');
$.get( forum_ajax + "editpost.php", { id: p_id, action: "edit" }, function(data){
HideLoading('');
RunAjaxJS('post-id-'+p_id, data);
setTimeout(function() {
$("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $("#post-id-" + p_id).offset().top - 70}, 700);
}, 100);
});
return false;
};
function ajax_cancel_post_edit( p_id ){
if ( c_cache[ p_id ] != "" )
{$("#post-id-"+p_id).html(c_cache[ p_id ]);}
return false;
};
function ajax_save_post_edit( c_id ){
var post_txt = '';
comm_edit_id = c_id;
post_txt = $('#forum_post_'+c_id).val();
ShowLoading('');
$.post(forum_ajax + "editpost.php", { id: c_id, post_text: post_txt, action: "save" }, function(data){
HideLoading('');
$("#post-id-"+c_id).html(data);
});
return false;
};
function doAddPost(){
var form = document.getElementById('forum-post-form');
if (form.post_text.value == '' || form.post_text.value == ''){alert ( dle_req_field );return false;}
ShowLoading('');
$.post(forum_ajax + "addpost.php", { topic_id: form.topic_id.value, forum_id: form.forum_id.value, post_id: form.post_id.value, topic_title: form.topic_title.value, name: form.name.value, mail: form.mail.value, post_text: form.post_text.value, skin: dle_skin }, function(data){
HideLoading('');
RunAjaxJS('ajax-post', data);
if (data != 'error' && document.getElementById('blind-animation')) {
$("html"+( ! $.browser.opera ? ",body" : "")).animate({scrollTop: $("#ajax-post").offset().top - 70}, 1100);
setTimeout(function() { $('#blind-animation').show('blind',{},0)}, 0);
}
});
};
function postDelete(url){
var agree=confirm( 'Âû äåéñòâèòåëüíî õîòèòå óäàëèòü ýòî ñîîáùåíèå?' );
if (agree)
document.location=url;
};
function topicDelete(url){
var agree=confirm( 'Âû äåéñòâèòåëüíî õîòèòå óäàëèòü ýòó òåìó?' );
if (agree)
document.location=url;
};
function rowDelete(url){
var agree=confirm( 'Âû äåéñòâèòåëüíî õîòèòå óäàëèòü ýòó çàïèñü?' );
if (agree)
document.location=url;
};
function TopicMenu( tid, forum_url, moderation ){
var menu=new Array();
if (moderation)
{
menu[0]='<a href="' + forum_url + 'act=moderation&code=calc&tid=' + tid + '">Ïåðåñ÷èòàòü âñå â òåìå</a>';
}
menu[1]='<a href="' + forum_url + 'act=subscription&code=add&tid=' + tid + '">Ïîäïèñêà íà òåìó</a>';
menu[2]='<a href="' + forum_url + 'act=_topic&code=forward&tid=' + tid + '">Ñîîáùèòü äðóãó</a>';
menu[3]='<a href="' + forum_url + 'act=_topic&code=print&tid=' + tid + '">Âåðñèÿ äëÿ ïå÷àòè</a>';
return menu;
};
function ForumMenu( fid, moderation, forum_url ){
var menu=new Array();
if (moderation){
menu[0]='<a href="' + forum_url + 'showforum=' + fid + '&code=hidden">Ïîêàçàòü âñå ñêðûòûå òåìû</a>';
menu[1]='<a href="' + forum_url + 'act=getforum&code=calc&fid=' + fid + '">Ïåðåñ÷èòàòü âñå â ôîðóìå</a>';
}
menu[3]='<a href="' + forum_url + 'showforum=' + fid + '&code=today">Àêòèâíûå òåìû</a>';
menu[4]='<a href="' + forum_url + 'showforum=' + fid + '&code=noreply">Òåìû áåç îòâåòîâ</a>';
return menu;
};
function PostEditMenu( pid, forum_url, page, post_n ){
var menu=new Array();
menu[0]='<a onclick="ajax_post_edit(\'' + pid + '\'); return false;" href="#">' + menu_short + '</a>';
menu[1]='<a href="' + forum_url + 'act=post&code=02&pid=' + pid + '&p=' + page + '&pn=' + post_n + '">' + menu_full + '</a>';
return menu;
};
function FUserMenu( url, m_id, group, forum_url ){
var menu=new Array();
menu[0]='<a href="' + dle_root + 'user/' + url + '">' + menu_profile + '</a>';
menu[1]='<a href="' + dle_root + 'index.php?do=pm&doaction=newpm&user=' + m_id + '">' + menu_send + '</a>';
menu[2]='<a href="' + forum_url + 'act=getforum&code=user&mname=' + url + '">Íàéòè òåìû ïîëüçîâàòåëÿ</a>';
if (group == '1') {
menu[3]='<a onclick="window.open(\'' + dle_root + dle_admin + '?mod=editusers&action=edituser&id=' + m_id + '\', \'User\',\'toolbar=0,location=0,status=0, left=0, top=0, menubar=0,scrollbars=yes,resizable=0,width=540,height=500\'); return false;" href="#">' + menu_uedit + '</a>';
}
return menu;
};
function navigation(pages_count, url){
var page = prompt("Ïåðåéòè ê ñòðàíèöå", "");
if (page)
{
if (pages_count >= page)
{
window.location.href = url + page;
}
}
};
function PostLink(link){
url = window.location;
var enterCause = prompt("Êîïèðîâàíèå ïðÿìîé ññûëêè", url + "#post-" + link);
};
function select_id( sid ){
var saved = new Array();
var clean = new Array();
var add = 1;
tmp = document.modform.selected_id.value;
if( tmp != "" )
{
saved = tmp.split(",");
}
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == sid )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
if ( add )
{
clean[ clean.length ] = sid;
}
newvalue = clean.join(',');
document.modform.selected_id.value = newvalue;
};
function ShowHide( name, open ){
if (document.getElementById( name ).style.display != "none")
{
document.getElementById( name ).style.display = "none";
}
else
{
document.getElementById( name ).style.display = "";
}
if (open)
{
document.getElementById( name ).style.display = "";
}
};
function PostPreviewCompleted(){
var post_main_obj = document.getElementById( 'post-preview' );
var post_box_top = _get_obj_toppos( post_main_obj );
if ( post_box_top )
{
scroll( 0, post_box_top - 70 );
}
};
function PostPreview(){
var post_text = "";
post_text = document.getElementById('forum-post-form').post_text.value;
if (post_text == ''){alert('Çàïîëíèòå âñå íåîáõîäèìûå ïîëÿ');return false}
ShowLoading('');
$.post(forum_ajax + "post.preview.php", { post_text: post_text, skin: dle_skin}, function(data){
HideLoading('');
$("#post-preview").html(data);
});
};
function uploadsform(open_url){
$("#uploads-form").remove();
ShowLoading('');
$.post(forum_ajax + "uploads.form.php", {open_url: open_url}, function(data){
HideLoading('');
$("body").append( data );
$('#uploads-form').dialog({
autoOpen: true,
width: 470,
buttons: {
"Çàêðûòü": function() {
$(this).dialog("close");
$("#uploads-form").remove();
}}});
});
return false;
};
function forum_ins(name){
var input = document.getElementById('forum-post-form').post_text;
if (dle_txt!= "")
{
input.value += dle_txt;
}
else
{
input.value += "[b]"+name+"[/b],"+"\n";
}
};
function CtrlEnter(event, form){
if((event.ctrlKey) && ((event.keyCode == 0xA)||(event.keyCode == 0xD)))
{
form.submit.click();
}
};
+104
View File
@@ -0,0 +1,104 @@
<?php
include 'init.php';
if (!$is_logged){die ("error");}
$id = intval($_REQUEST['id']);
if (!$id OR !is_moderation(0, 0, $id, 'forum_post_edit'))
{
die ("error");
}
include_once SYSTEM_DIR.'/classes/parse.class.php';
$parse = new ParseFilter(Array(), Array(), 1, 1);
// ********************************************************************************
// EDIT POST
// ********************************************************************************
if ($_REQUEST['action'] == "edit")
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_posts WHERE pid = $id");
if ($id != $row['pid']) die ("error");
$topic_id = $row['topic_id'];
$upload_var = array('area'=>"post", 'forum_id'=>$forum_id, 'topic_id'=>$topic_id, 'post_id'=>$id);
$ajax_post_id = $id;
$upload_var['reply'] = "reply";
$post_text = $parse->decodeBBCodes($row['post_text'], false);
$upload_var['bb_width'] = '99%';
include_once SYSTEM_DIR.'/forum/sources/components/bbcode.php';
$bb_code = str_replace ("{THEME}", $config['http_home_url']."templates/".$config['skin'], $bb_code);
$buffer = <<<HTML
<form method="post" name="forum_post_form_{$id}" id="forum_post_form_{$id}" action="">
<div>{$bb_code}</div>
<textarea id="forum_post_{$id}" name="forum_post_{$id}" onclick="setNewField(this.name, document.forum_post_form_{$id})" style="width:99%; height:150px;font-family:verdana; font-size:11px; border:1px solid #E0E0E0">{$post_text}</textarea><br>
<div align="right" style="width:99%;"><input class=bbcodes title="$lang[bb_t_apply]" type=button onclick="ajax_save_post_edit('{$id}'); return false;" value="$lang[bb_b_apply]">
<input class=bbcodes title="$lang[bb_t_cancel]" type=button onclick="ajax_cancel_post_edit('{$id}'); return false;" value="$lang[bb_b_cancel]">
</div>
</form>
HTML;
}
// ********************************************************************************
// SAVE POST
// ********************************************************************************
elseif ($_REQUEST['action'] == "save")
{
$post_text = trim(convert_unicode($_POST['post_text'], $config['charset']));
$post_text = $parse->process($post_text);
$post_text = $parse->BB_Parse($post_text, FALSE);
if (!$post_text) die ("error");
$post_text = auto_wrap ($post_text);
if (strlen($post_text) > $forum_config['post_maxlen'])
{
die ("<script language=\"JavaScript\" type=\"text/javascript\">\n alert ('The length of the message exceeds the limit!');\n </script>");
}
$edit_info = ", edit_user = '{$member_id[name]}', edit_time = '{$_TIME}'";
$post_text = $db->safesql($post_text);
$db->query("UPDATE " . PREFIX . "_forum_posts SET post_text = '$post_text' {$edit_info} WHERE pid = $id");
$post_text = preg_replace ("'\[hide\](.*?)\[/hide\]'si","\\1", $post_text);
check_attachment($pid, $post_text);
if (stristr ($post_text, "[attachment="))
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_posts WHERE pid = $id");
$tid = $row['topic_id'];
$ajax_edit_attach = TRUE;
require_once SYSTEM_DIR.'/forum/sources/components/attachment.php';
}
$buffer = stripslashes($post_text);
$buffer = stripslashes($buffer);
}
else die ("error");
@header("Content-type: text/html; charset=".$config['charset']);
echo $buffer;
?>
+130
View File
@@ -0,0 +1,130 @@
<?php
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
@session_start();
define('DATALIFEENGINE', true);
define('ROOT_DIR', '../../..');
define('SYSTEM_DIR', ROOT_DIR.'/system');
include SYSTEM_DIR.'/data/config.php';
include SYSTEM_DIR.'/data/forum_config.php';
include_once ROOT_DIR.'/language/'.$config['langs'].'/website.lng';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR.'/modules/functions.php';
require_once SYSTEM_DIR.'/classes/templates.class.php';
require_once SYSTEM_DIR.'/forum/sources/components/init.php';
$_TIME = time () + ($config['date_adjust'] * 60);
$_REQUEST['skin'] = totranslit($_REQUEST['skin'], false, false);
if (! @is_dir( ROOT_DIR . '/templates/' . $_REQUEST['skin'] ))
{
$_REQUEST['skin'] = $config['skin'];
}
$user_group = $cache->get ("usergroup");
if (!$user_group)
{
$user_group = array ();
$db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
while ($row = $db->get_row())
{
$user_group[$row['id']] = array ();
foreach ($row as $key => $value)
{
$user_group[$row['id']][$key] = $value;
}
}
$cache->set ("usergroup", $user_group);
$db->free();
}
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR . '/modules/sitelogin.php';
if (!$is_logged)
{
$member_id['user_group'] = 5;
}
if ($member_id['banned'])
{
die ("Hacking attempt!");
}
if (!function_exists('convert_unicode'))
{
function decode_to_utf8 ($int=0)
{
$t = '';
if ( $int < 0 )
{
return chr(0);
}
else if ( $int <= 0x007f )
{
$t .= chr($int);
}
else if ( $int <= 0x07ff )
{
$t .= chr(0xc0 | ($int >> 6));
$t .= chr(0x80 | ($int & 0x003f));
}
else if ( $int <= 0xffff )
{
$t .= chr(0xe0 | ($int >> 12));
$t .= chr(0x80 | (($int >> 6) & 0x003f));
$t .= chr(0x80 | ($int & 0x003f));
}
else if ( $int <= 0x10ffff )
{
$t .= chr(0xf0 | ($int >> 18));
$t .= chr(0x80 | (($int >> 12) & 0x3f));
$t .= chr(0x80 | (($int >> 6) & 0x3f));
$t .= chr(0x80 | ($int & 0x3f));
}
else
{
return chr(0);
}
return $t;
}
function convert_unicode ($t, $to = 'windows-1251')
{
$to = strtolower($to);
if ($to == 'utf-8') {
$t = preg_replace( '#%u([0-9A-F]{1,4})#ie', "decode_to_utf8(hexdec('\\1'))", utf8_encode($t) );
$t = urldecode ($t);
} else {
$t = preg_replace( '#%u([0-9A-F]{1,4})#ie', "'&#' . hexdec('\\1') . ';'", $t );
$t = urldecode ($t);
$t = @html_entity_decode($t, ENT_NOQUOTES, $to);
}
return $t;
}
}
$tpl_dir = 'forum/';
?>
+148
View File
@@ -0,0 +1,148 @@
<?php
/*
=====================================================
DLE Forum - by DLE Files Group
-----------------------------------------------------
http://dle-files.ru/
-----------------------------------------------------
File: poll.php
=====================================================
Copyright (c) 2008,2010 DLE Files Group
=====================================================
*/
include 'init.php';
function votes ($all, $ansid) {
$data = array();
$alldata = array();
if ($all !="") {
$all = explode("|", $all);
foreach ($all as $vote) {
list($answerid, $answervalue) = explode(":", $vote);
$data[$answerid] = intval($answervalue);
}
}
foreach ($ansid as $id) {
$data[$id] ++;
}
foreach ($data as $key => $value) {
$alldata[] = intval($key).":".intval($value);
}
$alldata = implode("|", $alldata);
return $alldata;
}
function get_votes ($all) {
$data = array();
if ($all != "") {
$all = explode("|", $all);
foreach ($all as $vote) {
list($answerid, $answervalue) = explode(":", $vote);
$data[$answerid] = intval($answervalue);
}
}
return $data;
}
$topic_id = intval($_REQUEST['topic_id']);
$answers = explode(" ", trim($_REQUEST['answer']));
$buffer = "";
$vote_skin = strip_tags($_REQUEST['vote_skin']);
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
if ($is_logged)
$log_id = intval($member_id['user_id']);
else
$log_id = $_IP;
$poll = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '{$topic_id}'");
$log = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_poll_log WHERE topic_id = '{$topic_id}' AND member ='{$log_id}'");
if ($log['count'] AND $_REQUEST['action'] != "list") $_REQUEST['action'] = "results";
$votes = "";
if ($_REQUEST['action'] == "vote") {
$votes = votes ($poll['answer'], $answers);
$db->query("UPDATE ".PREFIX."_forum_topics set answer='$votes', poll_count=poll_count+".count($answers)." WHERE tid = '{$topic_id}'");
$db->query("INSERT INTO ".PREFIX."_forum_poll_log (topic_id, member) VALUES('{$topic_id}', '$log_id')");
$_REQUEST['action'] = "results";
}
if ($_REQUEST['action'] == "results") {
if ($votes == "") {$votes = $poll['answer']; $allcount = $poll['poll_count'];} else { $allcount = count($answers) + $poll['poll_count']; }
$answer = get_votes ($votes);
$body = explode("<br />", stripslashes($poll['poll_body']));
$pn = 0;
for ($i = 0; $i < sizeof($body); $i++) {
$num = $answer[$i];
if (!$num) $num = 0;
++$pn; if ($pn > 5) $pn = 1;
if ($allcount != 0) $proc = (100 * $num) / $allcount;
else $proc = 0;
$proc = round($proc, 0);
$buffer .= <<<HTML
{$body[$i]} - {$num} ({$proc}%)<br />
<img src="{$config['http_home_url']}templates/{$vote_skin}/images/poll{$pn}.gif" height="10" width="{$proc}%" style="border:1px solid black"><br />
HTML;
}
}
elseif ($_REQUEST['action'] == "list") {
$body = explode("<br />", stripslashes($poll['poll_body']));
if (!$poll['multiple']){
for ($v = 0; $v < sizeof($body); $v++) {
if (!$v) $sel = "checked"; else $sel = "";
$buffer .= <<<HTML
<div><input name="dle_poll_votes" id="dle_poll_votes" type="radio" $sel value="{$v}"><label for="dle_poll_votes">{$body[$v]}</label></div>
HTML;
}
} else {
for ($v = 0; $v < sizeof($body); $v++) {
$buffer .= <<<HTML
<div><input name="dle_poll_votes[]" id="dle_poll_votes" type="checkbox" value="{$v}"><label for="dle_poll_votes">{$body[$v]}</label></div>
HTML;
}
}
} else die("error");
@header("Content-type: text/css; charset=".$config['charset']);
echo $buffer;
?>
+38
View File
@@ -0,0 +1,38 @@
<?php
include 'init.php';
require_once SYSTEM_DIR.'/classes/parse.class.php';
if (!@is_dir(ROOT_DIR.'/templates/'.$_REQUEST['skin']) OR $_REQUEST['skin'] == "") die ("Hacking attempt!");
$tpl = new dle_template;
$tpl->dir = ROOT_DIR.'/templates/'.$_REQUEST['skin'];
define('TEMPLATE_DIR', $tpl->dir);
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
$_POST['post_text'] = convert_unicode($_POST['post_text'], $config['charset']);
$parse = new ParseFilter(Array(), Array(), 1, 1);
$post_text = $parse->process($_POST['post_text']);
$post_text = $parse->BB_Parse($post_text, FALSE);
if( function_exists( "get_magic_quotes_gpc" ) && get_magic_quotes_gpc() ) $post_text = stripslashes( $post_text );
$tpl->load_template('forum/msg.tpl');
$tpl->set('{title}', "Preview");
$tpl->set('{msg}', $post_text);
$tpl->compile('content');
$tpl->clear();
$tpl->result['content'] = str_replace('{THEME}', $config['http_home_url'].'templates/'.$_REQUEST['skin'], $tpl->result['content']);
@header("Content-type: text/css; charset=".$config['charset']);
echo $tpl->result['content'];
?>
+34
View File
@@ -0,0 +1,34 @@
<?php
include 'init.php';
$open_url = convert_unicode($_REQUEST['open_url'], $config['charset']);
echo <<<HTML
<script language="javascript" type="text/javascript">
$('#uploads-form').dialog({
autoOpen: true,
width: 470,
buttons: {
"Close": function() {
$(this).dialog("close");
$("#uploads-form").remove();
}
}
});
</script>
HTML;
$content = <<<HTML
<iframe id="_AddUpload" src="{$open_url}" frameborder="0" width="100%" height="220px"></iframe>
HTML;
@header("Content-type: text/html; charset=".$config['charset']);
@header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
@header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
@header( "Cache-Control: no-store, no-cache, must-revalidate" );
@header( "Cache-Control: post-check=0, pre-check=0", false );
@header( "Pragma: no-cache" );
echo "<div id='uploads-form' title='Çàãðóçêà ôàéëîâ íà ñåðâåð' style='display:none'>".$content."</div>";
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

+377
View File
@@ -0,0 +1,377 @@
<?php
$f_lg = array(
'm_forum' => "Welcome to admincp of DLE Forum",
'm_stats' => "Main forum stats",
'm_new_cat' => "Category",
'm_new_cat2' => "Create new category",
'm_new_forum' => "Forum",
'm_new_forum2' => "New forum title",
'm_content' => "Management",
'm_content2' => "Editing, list category and forums",
'm_rank' => "Rank",
'm_rank2' => "Create and edit users rank",
'm_tools' => "Settings",
'm_tools2' => "Settings of main forum function",
'm_discuss' => "Discuss",
'm_discuss2' => "Settings of button - Discuss on forum",
'm_email' => "System Messages",
'm_email2' => "Manage system messages.",
'm_service' => "Service",
'm_service2' => "Forum servise tools",
'm_usergroup' => "User group settings",
'm_usergroup2' => "Manage user group",
'm_help' => "Help",
'm_help2' => "Forum Help",
'forum_version' => "Version DLE Forum:",
'licence_info' => "Licence type:",
'forum_status' => "Forum_status:",
'forum_topic' => "Forum topics:",
'forum_posts' => "Forum Posts:",
'forum_online' => "Online",
'forum_offline' => "Offline",
'forum_db_size' => "Database size:",
'forum_files' => "Files size:",
'forum_cache' => "Cache size:",
'clear_cache' => "Clear cache",
'check_updates' => "Check for updates",
'msg_updates' => "check updates",
'no_update' => "Cannot connect to the server. Try again later.",
'cat_new' => "Create Category",
'cat_edit' => "Edit Category",
'cat_name' => "Category title",
'cat_ok_add1' => "Category was created",
'cat_ok_add2' => "Category was successfully created!",
'cat_ok_edit1' => "Category was edited",
'cat_ok_edit2' => "Category was successfully edited!",
'cat_err_name' => "Enter category title!",
'cat_button' => "Create category",
'forum_new' => "Create new forum",
'forum_mset' => "Main settings",
'forum_name' => "Forum title",
'forum_descr' => "Forum description",
'forum_cat' => "Category",
'forum_for' => "Subforum ?",
'password' => "Password",
'forum_icon' => "Forum Icon",
'forum_icon_hint' => "Icon prefix.<br />f_new_X.gif<br />f_nonew_X.gif<br />fc_new_X.gif<br />fc_nonew_X.gif<br />where X prefix.",
'forum_rules' => "Rules",
'forum_rules1' => "Title",
'forum_rules2' => "Text",
'forum_access' => "Access settings",
'forum_ok_add1' => "Forum was created",
'forum_ok_add2' => "Forum was successfully created!",
'forum_err_name' => "Enter forum title",
'forum_button' => "Create forum",
'forum_edit' => "Edit forum",
'forum_ok_edit1' => "Forum was edited",
'forum_ok_edit2' => "Forum was successfully edited!",
'java_add_forum' => "Add forum",
'java_sort' => "Sort",
'java_sort_f' => "Sort forums",
'java_edit' => "Edit",
'java_ssort' => "Subforums",
'java_access' => "Access",
'java_moderator' => "Add moderator",
'java_del' => "Delete",
'access_for_f' => "New access for all forums of this category",
'access_forum_group' => "Group",
'access_forum_mod' => "Moderation",
'access_forum_topic' => "Topic creation",
'access_forum_write' => "Topic write",
'access_forum_read' => "Topic read",
'access_forum_upload' => "Upload files",
'access_forum_download' => "Download files",
'titles_main' => "Users rank",
'titles_name' => "User rank",
'titles_pots' => "Required messages",
'titles_pips' => "Stars",
'titles_action' => "Action",
'titles_add' => "Add rank",
'titles_nname' => "Rank title",
'titles_npost' => "Minimum messages",
'titles_npips' => "Total stars",
'titles_edit' => "Edit rank",
'titles_uadd' => "Add rank to user",
'titles_uname' => "User name",
'titles_urname' => "User Rank",
'titles_error_name' => "User with this name not found!",
'button_add' => "Add",
'button_edit' => "Edit",
'button_save' => "Save",
'button_sort' => "Sort",
'error' => "Error",
'error_x' => "Full all Fields!",
'label_edit' => "edit",
'label_del' => "delete",
'db_prev' => "go back",
'tools_menu' => "Forum settings",
'tools_global' => "Forum global settings",
'tools_name' => "Forum Title:",
'tools_name_' => "Example: \"Forum DLE Files Group\"",
'tools_url' => "URL with folder of forum:",
'tools_url_' => "Example: http://forum.dle-files.ru",
'tools_mrewrite' => "Enable search engine friendly URLs?",
'tools_wysiwyg' => "Enable WYSIWYG editor",
'tools_offline' => "Disable Forum",
'tools_offline_' => "Enable or disable access to your forum.",
'tools_timestamp' => "Time zone offset:",
'tools_timestamp2' => "<a onClick=\"javascript:Help('date')\" class=main href=\"#\">help on this function</a>",
'tools_sessions' => "register sessions?",
'tools_sessions_' => "It is necessary for modules &laquo;Online&raquo;, &laquo;who view forum&raquo;, &laquo;who read topic&raquo;...",
'tools_ses_time' => "Time without any action of user",
'tools_ses_time_' => "After this time user status will be set as offline? (in minutesõ)",
'tools_stats' => "Enable block with statistic of forum?",
'tools_online' => "Show Online?",
'tools_online_' => "shows online users.",
'tools_forum_bar' => "Enable Forumbar?",
'tools_forum_bar_' => "shows user's current location on the forum e.g. category, topic...",
'tools_show' => "Topics and messages",
'tools_topics' => "Topics limit, in list of forum",
'tools_topics_' => "Default — 25",
'tools_hot' => "Limit of messages in topic",
'tools_hot_' => "Default — 30",
'tools_posts' => "Limit of messages, per topic page",
'tools_posts_' => "Default — 20",
'tools_mhide' => "Number of messages to view hiden text",
'tools_mhide_' => "To view text between tags <b>[HIDE] [/HIDE]</b>.",
'tools_abc_topic' => "Maximum title simbols",
'tools_post_update' => "mix messages?",
'tools_post_update2' => "If author of last or new message is the same the new message will be mix with old message and shows like one post .",
'tools_last_plink' => "Link to last topic page",
'tools_last_plink_' => "shows link to last topic page in block last post.",
'tools_hide_forum' => "Hide forums?",
'tools_hide_forum_' => "Hide forums for for one or another group.",
'tools_topic_sort' => "Sort topics by date?",
'tools_topic_sort_' => "Topics will be sort by date of last post.",
'tools_topic_email' => "E-mail notification of new topic creation",
'tools_pr_imp' => "Pinned Topics prefix",
'tools_pr_vote' => "Topics with vote prefix",
'tools_pr_modr' => "Topics without moderation prefix",
'tools_pr_sub_f' => "Subforum prefix",
'tools_safety' => "Safety settings",
'tools_complaint' => "Disable module &laquo;Report&raquo;?",
'tools_flood' => "Flood control",
'tools_flood_' => "Number of seconds user must wait before being able to post another message.
leave empty to disable.",
'tools_search_captcha' => "Enable security code for search",
'tools_preventions' => "Warn system",
'tools_prevntn_on' => "Warn",
'tools_prevntn_on_' => "Enable warn system?",
'tools_prevntn_max' => "Maximum warns",
'tools_prevntn_max_' => "Maximun number of warn to block user.",
'tools_prevntn_group' => "Group with disable warn",
'tools_prevntn_g_show' => "Moderators",
'tools_prevntn_g_show_' => "Usergroup with access to view users warn magazine.",
'tools_prevntn_show' => "Access to user to view warn?",
'tools_prevntn_show_' => "With module enable user cant view warn status.",
'tools_prevntn_show_all' => "Acces to users to view all users warn status?",
'tools_prevntn_show_all_' => "With module enable user cant view all users warn status .",
'tools_prevntn_show_gr' => "Show warn status in group with disable warn?",
'tools_warn_day' => "Warn limit to one user",
'tools_warn_day2' => "number of warn by moderator in one day.",
'tools_modules' => "Modules tools",
'tools_mod_icq' => "ICQ status",
'tools_mod_icq_' => "module shows ICQ icon.",
'tools_mod_rank' => "Rank",
'tools_mod_rank_' => "module shows user rank by number of messages.",
'tools_subscr' => "Subscrition",
'tools_subscr_' => "after answer in topic user will receive e-mail.",
'tools_reputation' => "Reputation",
'tools_reputation_' => "Enable users reputation.",
'tools_poll' => "Poll",
'tools_poll_' => "usergroup with access to poll in topics.",
'tools_ses_forum' => "Show who view forum?",
'tools_ses_topic' => "Show who read topic?",
'tools_discuss' => "Button 'Discuss in forum'",
'tools_disc_on' => "Enable module",
'tools_disc_on_' => "Enable module &laquo;Discuss in forum&raquo;.",
'tools_disc_title' => "Topic title",
'tools_disc_title_' => "Topic title, what will be created by presing on the button.",
'tools_disc_opt_1' => "News title",
'tools_disc_opt_2' => "Title by template",
'tools_disc_t_tpl' => "Template title",
'tools_disc_t_tpl_' => "example: <b>article: {post_title}</b>",
'tools_disc_post' => "Topic Description",
'tools_disc_post_' => "Topic Description, what will be created by presing on the button.",
'tools_disc_opt_3' => "Short news",
'tools_disc_opt_4' => "Full news",
'tools_disc_opt_5' => "Template",
'tools_disc_p_tpl' => "Template of topic description",
'tools_disc_p_tpl_' => "example: <b>[url={post_link}]{post_title}[/url]</b><br />If field is fill,when wthat text will be main description.",
'tools_speed' => "Speed tools",
'tools_t_as_p' => "Created topic as user message?",
'tools_t_as_p_' => "if yes, when if user create topic it will be count as message post in user status.",
'tools_sp_num' => "Count number of messages?",
'tools_sp_num_' => "if yes, example, with deleted user topic or message will be recount number of post in user status. if no,when user messages will be count in known time.",
'tools_sp_num_date' => "messages count days",
'tools_sp_num_date_' => "example: one every day.",
'tools_new_t_day' => "Time of active topic",
'tools_new_t_day_' => "After this time without any answer in topic the topic will be old. example: 5 days.",
'tools_sp_sublast' => "Refresh forum with answer in subforums?",
'tools_sp_sublast_' => "shows last post in forum with answer in subforum.",
'tools_uploads' => "Upload files on server settings",
'tools_upload' => "Enable file uploads on server",
'tools_upload_' => "Usergroup with access to upload any file.",
'tools_upload_type' => "File types to upload",
'tools_upload_type_' => "Enter file types separated by comma.",
'tools_img_upl' => "allow to users upload images",
'tools_img_max_size' => "Maximum image size",
'tools_img_max_size_' => "Enter maximum image size in kb",
'tools_thumb_size' => "Auto resize large images:",
'tools_thumb_size_' => "Auto resize large images on upload (in Pixels).",
'tools_jpeg_quality' => "JPEG image compression:",
'tools_jpeg_quality_' => "Compression is applied to all uploaded JPEG images.",
'tools_img_width' => "Auto resize linked images",
'tools_img_width_' => "Enter maximum image size for tag [img] [/img], to disable this function enter 0.",
'tools_licence' => "Licence",
'tools_licence_key' => "Licence key",
'tools_licence_key_' => "Enter Licence key.",
'tools_copyright' => "CopyRight",
'tools_copyright2' => "Show CopyRight?",
'tools_licence_name' => "Show &laquo;Registered to...&raquo;",
'tools_licence_name_' => "Example: DLE Files Group 2008",
't_f_save' => "Settings are saved",
't_f_save1' => "Settings are successfully saved",
'mail_subscr' => "E-Mail messages settings, For sibscrition",
'mail_subscr_' => "<b>{%username_to%}</b> - Name<br /><b>{%username_from%}</b> - From<br /><b>{%topic_name%}</b> - Topic title<br /><b>{%topic_link%}</b> - Topic link<br /><b>{%topic_link_del%}</b> - Subscrition link",
'mail_frend' => "E-Mail messages settings, Send to friend",
'mail_frend_' => "<b>{%username_to%}</b> - Name<br /><b>{%username_from%}</b> - From<br /><b>{%text%}</b> - message text",
'mail_report' => "E-Mail messages settings, For reports",
'mail_report_' => "<b>{%username_from%}</b> - Name<br /><b>{%text%}</b> - message text<br /><b>{%topic_link%}</b> - topic link<br /><b>{%post_id%}</b> - message ID<br />",
'mail_new_topic' => "E-Mail messages settings, New topic created",
'mail_new_topic_' => "<b>{%username%}</b> - Topic author<br /><b>{%date%}</b> - date of creation<br /><b>{%title%}</b> - tpic title<br /><b>{%link%}</b> - topic link",
'email_ok' => "Settings are saved",
'email_ok2' => "Settings are successfully saved!",
'trial_info' => "<b>Warring!</b><br>You using not activated version of script with limits you must enter the licence key.<br>Activation of script on <a href='http://dle-files.ru/'>http://dle-files.ru</a>",
'trial_login' => "Login:",
'trial_key' => "Key:",
'trial_act' => "Activate",
'licence_trial' => "Free version",
'licence_full' => "Licence activated",
'trial_limit' => "This trial version of Dle Forum has expired.",
'group_list' => "Usergroup list",
'group_name' => "Group Name",
'group_users' => "Users",
'group_sel1' => "Edit",
'group_sel2' => "Delete",
'group_sel3' => "Cannot delete",
'group_edit' => "Edit group:",
'group_colour' => "Group color",
'group_colour_' => "Usergroup color. (example: #CC0000)",
'group_offline' => "Allow to view offline forum",
'group_post_edit' => "Can edit own posts?",
'group_post_del' => "Can delete own posts?",
'group_topic_set' => "Can open/close own topics?",
'group_topic_edit' => "Can edit own topics?",
'group_topic_del' => "Can delete own topics?",
'group_vote' => "Can poll?",
'group_flood' => "Enable Flood-control to this group?",
'group_html' => "Allow HTML in messages?",
'group_filter' => "Enable to this group word filter?",
'group_moderation' => "Moderation settings",
'group_edit_ok' => "Edit group",
'group_edit_ok2' => "Group was edited!",
'mod_edit_topic' => "Can change topics title?",
'mod_del_topic' => "Can delete topics/polls?",
'mod_edit_post' => "Can edit messages?",
'mod_del_post' => "Can delete messages",
'mod_open_topic' => "Can open topics?",
'mod_close_topic' => "Can close topics?",
'mod_move_topic' => "Can move topics?",
'mod_fixed_topic' => "Can pin topics?",
'mod_defixed_topic' => "Can unpin topics?",
'mod_warn_users' => "Can use warn user?",
'mod_multi_moderation' => "Can use multi moderation?",
'mod_search_user' => "User search",
'mod_search_name' => "Enter username:",
'mod_config_set' => "Moderation settings",
'mod_add' => "Moderator was added",
'mod_add2' => "Moderator was successfully added!",
'mod_edit_ok' => "Moderator was changed",
'mod_edit_ok2' => "Moderator was successfully changed!",
'button_search' => "Search",
'discuss_name' => "Category settings",
'discuss_cat_id' => "Category ID",
'discuss_category' => "Category",
'discuss_forum_id' => "Forum ID",
'discuss_forum' => "Forum",
'discuss_config' => "Topic description settings",
'discuss_t_text' => "Description",
'svce_full' => "(Leave empty if you want to clean all)",
'yes' => "Yes",
'no' => "No",
'button_start' => "Start",
'activation_send' => "Sending ...",
'trial_act1' => "Cannot connect to the server. Try again later.",
'trial_act2' => "Entered data not correspond to necessary.",
'trial_act3' => "Thank you! Your script was activated",
'trial_act4' => "Server fault Try again later.",
// add for 2.3 //
'tools_abc_last' => "The maximum length of the title of the topic in the block «Last Post»",
'tools_abc_last1' => "The maximum permitted length of the title of the topic in the block «Last Post»",
'tools_topic_captcha' => "Security code for a new topic",
'tools_topic_captcha1' => "User groups to which you want to include security code (CAPTCHA). You can select more than one group.",
'tools_post_captcha' => "Security code for new posts",
'tools_post_captcha1' => "User groups to which you want to include security code (CAPTCHA). You can select more than one group.",
'rep_edit_group' => "Moderators reputation",
'rep_edit_group2' => "Groups of users who may log Moderate reputation. You can select more than one group.",
'tools_post_maxlen' => "The maximum number of characters in the message",
'tools_post_maxlen2' => "Specify the maximum number of characters that can polzvatel to use when writing messages in the forum",
'tools_auto_wrap' => "Automatic distribution of long words",
'tools_auto_wrap2' => "In case of exceeding a specified number of characters",
);
?>
+117
View File
@@ -0,0 +1,117 @@
<?php
// ********************************************************************************
// DLE Forum v.2.2
// ********************************************************************************
$f_lang = array(
'f_msg' => "Forum message",
'f_404' => "Reference, is «dead» or deleted. <a href=\"javascript:history.go(-1)\">go back</a>",
'page_deny' => "Members, of group <b>{user_group}</b>, cannot view this page.",
'all_info' => "Information",
'values_error' => "All fields are required! <a href=\"javascript:history.go(-1)\">go back</a>",
'subforums' => " - ïîäôîðóìû",
'forum_read' => "Members, of group <b>{user_group}</b>, cannot view this forum.",
'topic_read' => "Members, of group <b>{user_group}</b>, cannot view this topic.",
'topic_write' => "Members, of group <b>{user_group}</b>, cannot leave post on this forum.",
'forum_down' => "Members, of group <b>{user_group}</b>, cannot download files on this forum.",
'is_topics' => "<center><b>Not found. it is poseble that in this forum not exist any topic, or the topic are to old and was deleted.</b></center>",
'search_nresult' => "The search did not return any results. <a href=\"javascript:history.go(-1)\">search again?</a>",
'search_error' => " You have entered less than 4 characters!. <a href=\"javascript:history.go(-1)\">search again?</a>",
'topic_yes' => "With answers",
'topic_no' => "Without answers",
'topic_closed' => "Topic closed",
'last_post' => "<b>Last. post:</b>",
'mtf_op' => "Option",
'mtf_01' => " - Open",
'mtf_02' => " - Close",
'mtf_03' => " - Delete",
'mtf_05' => " - Move",
'mtf_06' => " - Hide",
'mtf_07' => " - Publish",
'mtf_08' => " - Pin",
'mtf_09' => " - Unpin",
'time_heute' => "Today",
'time_gestern' => "Yesterday",
'fs_new' => "There are new messages",
'fs_nonew' => "There are not new messages",
'fl_topic' => "<br /><b>Topic:</b>",
'fl_author' => "<br /><b>Author:</b>",
'fl_nopost' => "There are not messages",
'fl_c_forum' => "<i>Closed forum</i>",
'err_mail' => "E-mail address is incorrect!.",
'err_name' => "You have entered the name of a registered user. If you are this user you must login first.",
'topic_add_stop' => "Fill out all required fields! {stop} <a href=\"javascript:history.go(-1)\">go back</a>",
'topic_add_ndeny' => "Members, of group <b>{user_group}</b>, cannot open topics on this forum.",
'app_warn' => "Warn",
'app_rep' => "Reputation",
'app_subscr' => "Subscrition",
'app_getnew' => "New Messages",
'app_newtopic' => "New Topic",
'app_reply' => "Reply",
'app_user_topic' => "User topics",
'app_post_edit' => "Edit message",
'app_search' => "Search",
'search_result' => "Search result",
'u_log_empty' => "<hr><center><b>User magazine is empty.</b></center>",
'f_reply' => "Fast reply",
'getnew_title' => "Messages sice you last visited",
'all_read_link' => "Read all",
'subscr_not' => "<center><b>you dont have Subscrition on any topic.</b></center>",
'search_result' => "Search result",
'search_topic' => "The search did not return any results. <a href='javascript:history.go(-1)'>go back</a>",
'report_send' => "report was successfully send. <a href=\"{link}\">go back</a>",
'mail_send' => "mail was successfully send <a href=\"{link}\">go back</a>",
'title_forward' => "Send mail to friend",
'edit_info' => "Message was edited by",
'err_name' => "<Li>Check spelling entered name!</Li>",
'err_mail' => "<Li>Check spelling entered e-mail!</Li>",
'h_post' => "<b>Message hiden</b>",
'flood_stop' => "Flood protection is active, write your message in {time} seconds. <a href='javascript:history.go(-1)'>go back</a>",
'discuss_no_cat' => " choise forum for this category of news. <a href=\"javascript:history.go(-1)\">go back</a>",
'discuss_off' => "This function is turned of. to create forum login forum. <a href=\"javascript:history.go(-1)\">go back</a>",
// add for 2.3 //
'captcha_stop' => "Security code does not match the display! <a href=\"javascript:history.go(-1)\">Âåðíóòüñÿ íàçàä</a>",
'maxlen_stop' => "The length of the message exceeds the limit! <a href=\"javascript:history.go(-1)\">Âåðíóòüñÿ íàçàä</a>",
'ajax_stop_1' => "He was activated flood control!",
'ajax_stop_2' => "Security code does not match the display!",
'ajax_stop_3' => "Çàïîëíèòå âñå íåîáõîäèìûå ïîëÿ!",
'ajax_stop_4' => "The length of the message exceeds the limit!",
'topic_last_p' => "By the last report:",
'last_visit' => "<b>Since returning, the last time you were here</b>",
'reg_name' => "<br />Registered to ",
);
?>
+413
View File
@@ -0,0 +1,413 @@
<?php
$f_lg = array(
'm_forum' => "Добро пожаловать в админцентр DLE Forum",
'm_stats' => "Общая статистика форума",
'm_new_cat' => "Категория",
'm_new_cat2' => "Создание новой категории",
'm_new_forum' => "Форум",
'm_new_forum2' => "Создание нового форума",
'm_content' => "Управление",
'm_content2' => "Редактирование, сортировка категорий и форумов",
'm_rank' => "Звания",
'm_rank2' => "Создание и редактирование званий пользователей",
'm_tools' => "Настройка",
'm_tools2' => "Настройка общих параметров форума",
'm_discuss' => "Обсудить",
'm_discuss2' => "Настройка кнопки - Обсудить на форуме",
'm_email' => "Шаблоны E-Mail сообщений",
'm_email2' => "Настройка шаблонов E-Mail сообщений, которые отсылает форум.",
'm_service' => "Обслуживание",
'm_service2' => "Инструменты обслуживания форума",
'm_usergroup' => "Настройка групп пользователей",
'm_usergroup2' => "Управление группами пользователей на форуме, назначение прав доступа для этих групп",
'm_help' => "Справка",
'm_help2' => "Помощь и Документация по форуму",
'forum_version' => "Версия DLE Forum:",
'licence_info' => "Тип лицензии скрипта:",
'forum_status' => "Режим работы форума:",
'forum_topic' => "Общее количество тем:",
'forum_posts' => "Общее количество сообщений:",
'forum_online' => "Включен",
'forum_offline' => "Выключен",
'forum_db_size' => "Общий размер базы данных форума:",
'forum_files' => "Общий размер прикрепленных файлов:",
'forum_cache' => "Общий размер кеша:",
'clear_cache' => "Очистить кеш",
'check_updates' => "Проверить наличие обновлений",
'msg_updates' => "Проверка обновлений",
'no_update' => "Не удалось подключится к удаленному серверу.",
'cat_new' => "Создание новой категории",
'cat_edit' => "Редактирование категории",
'cat_name' => "Название категории",
'cat_ok_add1' => "Категория создана",
'cat_ok_add2' => "Категория успешно создана!",
'cat_ok_edit1' => "Категория отредактирована",
'cat_ok_edit2' => "Категория успешно отредактирована!",
'cat_err_name' => "Введите название категории!",
'cat_button' => "Создать категорию",
'forum_new' => "Создание нового форума",
'forum_mset' => "Основные настройки",
'forum_name' => "Название форума",
'forum_descr' => "Описание форума",
'forum_cat' => "Категория",
'forum_for' => "Подфорум ?",
'password' => "Пароль",
'forum_icon' => "Иконка форума",
'forum_icon_hint' => "Префикс для иконки.<br />f_new_X.gif<br />f_nonew_X.gif<br />fc_new_X.gif<br />fc_nonew_X.gif<br />Где X префикс.",
'forum_rules' => "Правила",
'forum_rules1' => "Заголовок",
'forum_rules2' => "Текст",
'forum_access' => "Настройки доступа",
'forum_ok_add1' => "Форум создан",
'forum_ok_add2' => "Форум успешно создан!",
'forum_err_name' => "Введите название форума!",
'forum_button' => "Создать форум",
'forum_edit' => "Редактирование форума",
'forum_ok_edit1' => "Форум отредактирован",
'forum_ok_edit2' => "Форум успешно отредактирован!",
'java_add_forum' => "Добавить форум",
'java_sort' => "Сортировать",
'java_sort_f' => "Сортировать форумы",
'java_edit' => "Редактировать",
'java_ssort' => "Подфорумы",
'java_access' => "Задать права доступа",
'java_moderator' => "Добавить модератора",
'java_del' => "Удалить",
'access_for_f' => "Новые права доступа для всех форумов данной категории",
'access_forum_group' => "Группа",
'access_forum_mod' => "Модерация",
'access_forum_topic' => "Создание тем",
'access_forum_write' => "Ответ в темах",
'access_forum_read' => "Чтение тем",
'access_forum_upload' => "Загрузка файлов",
'access_forum_download' => "Скачивание файлов",
'titles_main' => "Звания пользователей",
'titles_name' => "Звание посетителя",
'titles_pots' => "Требуется сообщений",
'titles_pips' => "Звездочки",
'titles_action' => "Действие",
'titles_add' => "Добавление звания",
'titles_nname' => "Название звания",
'titles_npost' => "Минимальное количество сообщений ",
'titles_npips' => "Количество звездочек",
'titles_edit' => "Редактирование звания",
'titles_uadd' => "Добавление звания пользователю",
'titles_uname' => "Имя пользователя",
'titles_urname' => "Звание пользователя",
'titles_error_name' => "Пользователь с таким именем не найден!",
'button_add' => "Добавить",
'button_edit' => "Редактировать",
'button_save' => "Сохранить",
'button_sort' => "Отсортировать",
'error' => "Ошибка",
'error_x' => "Заполните все поля!",
'label_edit' => "правка",
'label_del' => "удалить",
'db_prev' => "Вернуться назад",
'tools_menu' => "Настройка параметров форума",
'tools_global' => "Глобальные Настройки форума",
'tools_name' => "Название форума:",
'tools_name_' => "Например: \"Форум DLE Files Group\"",
'tools_url' => "URL к папке с форумом:",
'tools_url_' => "Например: http://forum.dle-files.ru (без слеша)",
'tools_mrewrite' => "Включить ЧПУ?",
'tools_mrewrite_' => "Если 'Да', то ссылки будут иметь вид http://yourdomain.com/forum/topic_1",
'tools_wysiwyg' => "Включить WYSIWYG редактор",
'tools_wysiwyg2' => "Если Да то будет включен WYSIWYG редактор, если нет то будут использоваться BBCODES",
'tools_offline' => "Выключить форум",
'tools_offline_' => "Перевести форум в состояние offline, для проведения технических работ.",
'tools_timestamp' => "Формат времени:",
'tools_timestamp2' => "<a onClick=\"javascript:Help('date')\" class=main href=\"#\">помощь по работе функции</a>",
'tools_sessions' => "Регистрировать сессии?",
'tools_sessions_' => "Добавляет 1-2 запроса. Необходимо для модулей &laquo;Online&raquo;, &laquo;кто просматривает форум&raquo;, &laquo;кто читает тему&raquo;...",
'tools_ses_time' => "Период отсутствия активности пользователя",
'tools_ses_time_' => "Через сколько минут считать пользователя в offline? (в минутах)",
'tools_stats' => "Показывать блок со статистикой форума?",
'tools_stats_' => "Показывает блок со статистикой в нижней части главной страницы форума.",
'tools_online' => "Показывать Online?",
'tools_online_' => "Показывает в блоке со статистикой сколько человек на форуме.",
'tools_forum_bar' => "Показывать блок с местом положения на форуме?",
'tools_forum_bar_' => "Показывает название категории, форума…",
'tools_show' => "Темы и Сообщения",
'tools_topics' => "Количество тем, отображаемых в списке тем форума",
'tools_topics_' => "По умолчанию — 25",
'tools_hot' => "Количество сообщений в теме, необходимых для присвоения статуса «горячей»?",
'tools_hot_' => "По умолчанию — 30",
'tools_posts' => "Количество сообщений, размещаемых на одной странице темы",
'tools_posts_' => "По умолчанию — 20",
'tools_mhide' => "Кол-во сообщений для просмотра скрытого текста",
'tools_mhide_' => "Просмотр текста между тегами <b>[HIDE] [/HIDE]</b>.",
'tools_abc_topic' => "Максимальная длина заголовка тем",
'tools_abc_topic_' => "Максимальная разрешенная длина заголовка тем.",
'tools_post_update' => "Склеивать сообщения?",
'tools_post_update2' => "Если автор последнего и нового сообщения один и тот же, то сообщение склеится.",
'tools_last_plink' => "Ссылка на последнюю страницу темы",
'tools_last_plink_' => "Показывать ссылку на последнюю страницу темы в блоке Последнее сообщение.",
'tools_hide_forum' => "Скрывать форумы?",
'tools_hide_forum_' => "Скрывать форумы не доступные для просмотра определенной группой.",
'tools_topic_sort' => "Сортировать темы по дате?",
'tools_topic_sort_' => "Темы будут сортироваться по дате последнего ответа.",
'tools_topic_email' => "Отсылать E-Mail уведомление при создании темы",
'tools_topic_email_' => "Если 'Да', при создании темы на форуме, на E-Mail модератору будет отправлено соответствующее уведомление.",
'tools_pr_imp' => "Префикс важных тем",
'tools_pr_imp_' => "Текст, отображаемый перед названием темы с таким статусом. Важная тема всегда в верхней части списка всех тем в форуме.",
'tools_pr_vote' => "Префикс опросов",
'tools_pr_vote_' => "Текст, отображаемый перед названием темы с таким статусом. Все темы, в которых есть опрос, отмечаются так.",
'tools_pr_modr' => "Префикс тем без модерации",
'tools_pr_modr_' => "Текст, отображаемый перед названием темы с таким статусом. Все темы, которые ожидают модерацию, отмечаются так.",
'tools_pr_sub_f' => "Префикс подфорумов",
'tools_pr_sub_f_' => "Текст, отображаемый перед выводом подфорумов.",
'tools_safety' => "Настройки Безопасности",
'tools_complaint' => "Отключить кнопку &laquo;Жалоба&raquo;?",
'tools_complaint_' => "Отключить возможность вашим пользователям подавать жалобу о некорректном сообщении.",
'tools_flood' => "Флуд-контроль — интервал в секундах между возможностью публиковать сообщения",
'tools_flood_' => "Время, которое пользователи буду ждать перед возможность опубликовать еще одно сообщение после опубликованного.
Вы можете оставить поле пустым для отключения флуд-контроля.",
'tools_search_captcha' => "Код безопасности для поиска",
'tools_search_captcha_' => "Группы пользователей для которых нужно включить код безопасности (CAPTCHA). Можно выбрать более одной группы.",
'tools_preventions' => "Система Предупреждений",
'tools_prevntn_on' => "Предупреждения",
'tools_prevntn_on_' => "Включить систему предупреждений?",
'tools_prevntn_max' => "Максимальный уровень предупреждений",
'tools_prevntn_max_' => "Максимальное количество предупреждений для блокировки пользователя.",
'tools_prevntn_group' => "Защищенные группы",
'tools_prevntn_group_' => "Группы пользователей, к которым невозможно применять предупреждения.
Можно выбрать более одной группы.",
'tools_prevntn_g_show' => "Модераторы",
'tools_prevntn_g_show_' => "Группы пользователей, которые могут просматривать журнал предупреждений. Можно выбрать более одной группы.",
'tools_prevntn_show' => "Разрешить пользователям видеть свой уровень предупреждений?",
'tools_prevntn_show_' => "Если включено, то пользователи смогут видеть свой текущий уровень предупреждений.",
'tools_prevntn_show_all' => "Разрешить пользователям видеть чужой уровень предупреждений?",
'tools_prevntn_show_all_' => "Если включено, то пользователи смогут видеть друг у друга уровень предупреждений.",
'tools_prevntn_show_gr' => "Показывать у защищенных групп уровень предупреждений?",
'tools_prevntn_show_gr_' => "Если включено, то у пользователей защищенных групп можно видеть текущий уровень предупреждений.",
'tools_warn_day' => "Предупреждения одному пользователю",
'tools_warn_day2' => "Сколько раз за день модератор может ставить предупреждение одному пользователю?",
'tools_modules' => "Управление Модулями",
'tools_mod_icq' => "Статус ICQ",
'tools_mod_icq_' => "Модуль показывает статус-картинку пользователя ICQ.",
'tools_mod_rank' => "Звание Rank",
'tools_mod_rank_' => "Модуль показывает звание посетителя на сайте, в зависимости от кол-ва сообщений.",
'tools_subscr' => "Подписка на темы",
'tools_subscr_' => "После ответа в подписанную тему, будет отправлено письмо на e-mail.",
'tools_reputation' => "Репутация",
'tools_reputation_' => "Разрешить посетителям менять друг другу репутацию.",
'tools_poll' => "Опросы",
'tools_poll_' => "Группы пользователей, к которым разрешено создавать опросы в темах. Можно выбрать более одной группы.",
'tools_ses_forum' => "Показывать, кто просматривает форум?",
'tools_ses_forum_' => "Увеличивает количество запросов на 1 при каждом просмотре форума.",
'tools_ses_topic' => "Показывать, кто читает тему?",
'tools_ses_topic_' => "Увеличивает количество запросов на 1 при каждом просмотре темы.",
'tools_discuss' => "Кнопка 'Обсудить на форуме'",
'tools_disc_on' => "Включить модуль",
'tools_disc_on_' => "Включить модуль &laquo;Обсудить на форуме&raquo;.",
'tools_disc_title' => "Название темы",
'tools_disc_title_' => "Название темы, которая будет создана при нажатии на кнопку.",
'tools_disc_opt_1' => "Название новости",
'tools_disc_opt_2' => "Название по шаблону",
'tools_disc_t_tpl' => "Шаблон названия",
'tools_disc_t_tpl_' => "Например: <b>Статья: {post_title}</b>",
'tools_disc_post' => "Содержание темы",
'tools_disc_post_' => "Содержание темы, которая будет создана при нажатии на кнопку.",
'tools_disc_opt_3' => "Краткая новость",
'tools_disc_opt_4' => "Полная новость",
'tools_disc_opt_5' => "Шаблон",
'tools_disc_p_tpl' => "Шаблон содержания темы",
'tools_disc_p_tpl_' => "Например: <b>[url={post_link}]{post_title}[/url]</b><br />Если поле заполнено, то этот текст будет под основным содержанием.",
'tools_speed' => "Настройки Быстродействия",
'tools_t_as_p' => "Считать созданную тему за сообщение?",
'tools_t_as_p_' => "Если да, то при создании темы, посетителю прибавиться одно сообщение на форуме.",
'tools_sp_num' => "Вычитать кол-во сообщений сразу?",
'tools_sp_num_' => "Если да, то например, при удалении темы или сообщения будет пересчет кол-ва сообщений у посетителя. Если нет, то подсчет кол-ва сообщений у посетителя будет производиться раз в определенный срок.",
'tools_sp_num_date' => "Срок пересчета сообщений",
'tools_sp_num_date_' => "Через сколько дней пересчитывать кол-во сообщений у посетителя. Например: раз в день.",
'tools_new_t_day' => "Срок активности темы",
'tools_new_t_day_' => "Через сколько дней тема устареет, если посетитель ее не прочитал. Например: 5 дней.",
'tools_sp_sublast' => "Обновлять форум при ответе в подфоруме?",
'tools_sp_sublast_' => "Будет обновляться блок последнее сообщение, при ответе в подфоруме.",
'tools_uploads' => "Настройка загрузки файлов на сервер",
'tools_upload' => "Разрешить загрузку файлов на сервер",
'tools_upload_' => "Группы пользователей, которым будет разрешена загрузка не только картинок на сервер, но и других файлов.",
'tools_upload_type' => "Расширение файлов, допустимых к загрузке",
'tools_upload_type_' => "Укажите через запятую расширения файлов, которые разрешено закачивать.",
'tools_img_upl' => "Разрешить пользователям загружать картинки",
'tools_img_upl_' => "Вы можете разрешить или запретить пользователям загружать изображения на сервер.",
'tools_img_max_size' => "Максимально допустимый объём изображения",
'tools_img_max_size_' => "Введите максимальный объём загружаемого изображения (в килобайтах)",
'tools_thumb_size' => "Размер уменьшенной копии загруженного изображения:",
'tools_thumb_size_' => "Максимальный размер в пикселях любой из сторон загружаемой картинки при превышении которого будет создаваться уменьшенная копия.",
'tools_jpeg_quality' => "Качество сжатия .jpg изображения:",
'tools_jpeg_quality_' => "Качество сжатия JPEG картинки при копировании на сервер.",
'tools_img_width' => "Автоматическое изменение размера для удаленных изображений",
'tools_img_width_' => "Укажите максимальную ширину картинки для тега [img] [/img], после которой изображение будет пропорционально уменьшено, до указанного размера. Для отключения автоматического уменьшения введите 0.",
'tools_licence' => "Лицензия",
'tools_licence_key' => "Регистрационный ключ",
'tools_licence_key_' => "Введите Регистрационный ключ.",
'tools_copyright' => "CopyRight",
'tools_copyright2' => "Отображать CopyRight?",
'tools_licence_name' => "Показывать &laquo;Зарегистрировано на...&raquo;",
'tools_licence_name_' => "Примеры: DLE Files Group 2008",
't_f_save' => "Настройки сохранены",
't_f_save1' => "Настройки системы были успешно сохранены",
'mail_subscr' => "Настройка E-Mail сообщения, которое отсылается при ответе в подписанную тему",
'mail_subscr_' => "<b>{%username_to%}</b> - имя получателя<br /><b>{%username_from%}</b> - имя отправителя<br /><b>{%topic_name%}</b> - название темы<br /><b>{%topic_link%}</b> - ссылка на тему<br /><b>{%topic_link_del%}</b> - ссылка для отписки от темы",
'mail_frend' => "Настройка E-Mail сообщения, которое отсылается при отправке письма другу",
'mail_frend_' => "<b>{%username_to%}</b> - имя получателя<br /><b>{%username_from%}</b> - имя отправителя<br /><b>{%text%}</b> - текст сообщения",
'mail_report' => "Настройка E-Mail сообщения, которое отсылается при отправке жалобы на сообщение",
'mail_report_' => "<b>{%username_from%}</b> - имя отправителя<br /><b>{%text%}</b> - текст сообщения<br /><b>{%topic_link%}</b> - ссылка на тему<br /><b>{%post_id%}</b> - ID сообщения<br />",
'mail_new_topic' => "Настройка E-Mail сообщения, которое отсылается при создании новой темы",
'mail_new_topic_' => "<b>{%username%}</b> - автор темы<br /><b>{%date%}</b> - дата создания<br /><b>{%title%}</b> - название темы<br /><b>{%link%}</b> - ссылка на тему",
'email_ok' => "Обновление шаблонов завершено",
'email_ok2' => "Шаблоны для писем успешно обновлены!",
'trial_info' => "<b>Внимание!</b><br>Вы используете неактивированную версию скрипта для снятия установленных ограничений, вам необходимо ввести ключ активации.<br>Активация скрипта проходит на сервере <a href='http://dle-files.ru/'>http://dle-files.ru</a>",
'trial_login' => "Логин:",
'trial_key' => "Ключ:",
'trial_act' => "Активировать",
'licence_trial' => "Бесплатная версия",
'licence_full' => "Лицензия активирована",
'trial_limit' => "Были превышены лимиты бесплатной версии скрипта. Дальнейшая работа невозможна.",
'group_list' => "Список групп пользователей",
'group_name' => "Название группы",
'group_users' => "Пользователей",
'group_sel1' => "Редактировать",
'group_sel2' => "Удалить",
'group_sel3' => "Удалить невозможно",
'group_edit' => "Редактирование группы:",
'group_colour' => "Цвет группы",
'group_colour_' => "Цвет группы при отображение в списке активных пользователей. (Например: #CC0000)",
'group_offline' => "Разрешить просмотр отключенного форума?",
'group_post_edit' => "Могут редактировать свои сообщения?",
'group_post_del' => "Могут удалять свои сообщения?",
'group_topic_set' => "Могут открывать/закрывать свои темы?",
'group_topic_edit' => "Могут изменять названия и описания своих тем?",
'group_topic_del' => "Могут удалять свои темы?",
'group_vote' => "Могут голосовать (где разрешено)?",
'group_flood' => "Применять к пользователям данной группы флуд-контроль?",
'group_html' => "Могут использовать HTML в сообщениях?",
'group_filter' => "Применять к пользователям данной группы фильтры плохих слов?",
'group_moderation' => "Настройки модерации",
'group_edit_ok' => "Редактирование группы",
'group_edit_ok2' => "Изменения в группу успешно внесены!",
'mod_edit_topic' => "Может изменять название чужих тем?",
'mod_del_topic' => "Может удалять чужие темы/голосования?",
'mod_edit_post' => "Может редактировать чужие сообщения?",
'mod_del_post' => "Может удалять чужие сообщения?",
'mod_open_topic' => "Может открывать темы?",
'mod_close_topic' => "Может закрывать темы?",
'mod_move_topic' => "Может перемещать темы?",
'mod_fixed_topic' => "Может закреплять темы?",
'mod_defixed_topic' => "Может опускать темы?",
'mod_warn_users' => "Может предупреждать других пользователей?",
'mod_multi_moderation' => "Может использовать мульти-модерацию?",
'mod_search_user' => "Поиск пользователя",
'mod_search_name' => "Введите имя пользователя:",
'mod_config_set' => "Настройки модерации",
'mod_add' => "Модератор добавлен",
'mod_add2' => "Модератор успешно добавлен!",
'mod_edit_ok' => "Модератор изменен",
'mod_edit_ok2' => "Модератор успешно изменен!",
'button_search' => "Найти",
'discuss_name' => "Настройка соответствий категорий",
'discuss_cat_id' => "ID Категории",
'discuss_category' => "Категория",
'discuss_forum_id' => "ID Форума",
'discuss_forum' => "Форум",
'discuss_config' => "Настройка содержания темы",
'discuss_t_text' => "Содержание",
'svce_full' => "(Оставьте поле пустым, если хотите очистить весь журнал)",
'yes' => "Да",
'no' => "Нет",
'button_start' => "Запустить",
'activation_send' => "Отправка ...",
'trial_act1' => "Не удалось установить подключение к удаленному серверу.",
'trial_act2' => "Введенные данные не соответствуют необходимым.",
'trial_act3' => "Благодарим вас за покупку нашего скрипта!",
'trial_act4' => "Сбой в работе сервера. Повторите попытку позднее.",
// add for 2.3 //
'tools_abc_last' => "Максимальная длина названия темы в блоке «Последнее сообщение»",
'tools_abc_last1' => "Максимальная разрешенная длина названия темы в блоке «Последнее сообщение»",
'tools_topic_captcha' => "Код безопасности для новых тем",
'tools_topic_captcha1' => "Группы пользователей для которых нужно включить код безопасности (CAPTCHA). Можно выбрать более одной группы.",
'tools_post_captcha' => "Код безопасности для новых сообщений",
'tools_post_captcha1' => "Группы пользователей для которых нужно включить код безопасности (CAPTCHA). Можно выбрать более одной группы.",
'rep_edit_group' => "Модераторы репутации",
'rep_edit_group2' => "Группы пользователей которые могут модерировать журнал репутации. Можно выбрать более одной группы.",
'tools_post_maxlen' => "Максимальное количество символов в сообщениях",
'tools_post_maxlen2' => "Укажите максимальное количество символов, которое может использовать пользватель при написании сообщений на форуме",
'tools_auto_wrap' => "Автоматическая разбивка длинных слов",
'tools_auto_wrap2' => "В случае превышения заданного числа символов",
// add for 2.4 //
'forum_posts_conf' => "Настройки сообщений",
'forum_postcount' => "Включить счетчик сообщений?",
'forum_fixpost' => "Закреплять первое сообщение?",
'meta_description' => "Описание (Description) форума:",
'meta_description2' => "Краткое описание, не более 200 символов",
'meta_keywords' => "Ключевые слова (Keywords) для форума:",
'meta_keywords2' => "Введите через запятую основные ключевые слова для вашего форума",
'meta_topic' => "Создавать мета теги для тем:",
'meta_topic2' => "Будут создаваться мета описание и ключевые слова для тем",
'check_updates' => "Проверка обновлений",
'check_updates_start' => "Подождите идет подключение к удаленному серверу ...",
// add for 2.5 //
'group_youtube' => "Могут использовать тег youtubе?",
'group_youtube2' => "Данный тег предназначен для публикации видео на форуме с таких видеохранилищ как youtube.com и rutube.ru.",
'group_flash' => "Могут использовать тег flash?",
'group_flash2' => "Данный тег предназначен для вставки флеш роликов в формате swf.",
'mod_combining_post' => "Разрешить склеивать сообщения?",
'mod_move_post' => "Разрешить переносить сообщения из одной темы в другую?",
'forum_banner' => "Управление рекламными материалами",
'forum_banner2' => "Код баннера",
'tools_bot_agent' => "Показывать ботов?",
'tools_bot_agent2' => "Регистрировать сессии поисковых ботов.",
'forum_q_reply' => "Отображать форму быстрого ответа?",
'forum_i_edit' => "Отображать информацию о редактирование сообщения?",
);
?>
+123
View File
@@ -0,0 +1,123 @@
<?php
// ********************************************************************************
// DLE Forum v.2.2
// ********************************************************************************
$f_lang = array(
'f_msg' => "Сообщение форума",
'f_404' => "Ссылка, по которой вы попали на эту страницу является «мертвой» или удаленной. <a href=\"javascript:history.go(-1)\">Вернуться назад</a>",
'page_deny' => "Посетители, находящиеся в группе <b>{user_group}</b>, не могут просматривать данную страницу.",
'all_info' => "Информация",
'values_error' => "Заполните все необходимые поля! <a href=\"javascript:history.go(-1)\">Вернуться назад</a>",
'subforums' => " - подфорумы",
'forum_read' => "Посетители, находящиеся в группе <b>{user_group}</b>, не могут просматривать данный форум.",
'topic_read' => "Посетители, находящиеся в группе <b>{user_group}</b>, не могут просматривать данную тему.",
'topic_write' => "Посетители, находящиеся в группе <b>{user_group}</b>, не могут оставлять ответы в данном форуме.",
'forum_down' => "Посетители, находящиеся в группе <b>{user_group}</b>, не могут скачивать файлы из данного форума.",
'is_topics' => "<center><b>Не найдено ни одной темы. Возможно в этом форуме нет тем, либо они более стары и не соответствуют текущей сортировке.</b></center>",
'search_nresult' => "К сожалению, Ваш поиск не дал никаких результатов.<br />Попробуйте расширить параметры поиска, используя другое ключевое слово. <a href=\"javascript:history.go(-1)\">Повторить поиск?</a>",
'search_error' => " Введено пустое поле для поиска или строка поиска содержит менее 4 символов, в связи с чем поиск был приостановлен. <a href=\"javascript:history.go(-1)\">Повторить поиск?</a>",
'topic_yes' => "Есть ответы",
'topic_no' => "Нет ответов",
'topic_closed' => "Тема закрыта",
'last_post' => "<b>Посл. сообщение:</b>",
'mtf_op' => "Опции",
'mtf_01' => " - Открыть",
'mtf_02' => " - Закрыть",
'mtf_03' => " - Удалить",
'mtf_05' => " - Переместить",
'mtf_06' => " - Скрыть",
'mtf_07' => " - Опубликовать",
'mtf_08' => " - Закрепить",
'mtf_09' => " - Открепить",
'time_heute' => "Сегодня",
'time_gestern' => "Вчера",
'fs_new' => "Есть новые сообщения",
'fs_nonew' => "Нет новых сообщений",
'fl_topic' => "<br /><b>Тема:</b>",
'fl_author' => "<br /><b>Автор:</b>",
'fl_nopost' => "Нет сообщений",
'fl_c_forum' => "<i>Закрытый форум</i>",
'err_mail' => "Вы ввели неверный E-Mail адрес.",
'err_name' => "Вы ввели имя зарегистрированного пользователя. Если Вы есть этот пользователь, то Вам необходимо авторизироваться на сайте.",
'topic_add_stop' => "Заполните все необходимые поля! {stop} <a href=\"javascript:history.go(-1)\">Вернуться назад</a>",
'topic_add_ndeny' => "Посетители, находящиеся в группе <b>{user_group}</b>, не могут открывать темы в данном форуме.",
'app_warn' => "Предупреждения",
'app_rep' => "Репутация",
'app_subscr' => "Текущие подписки",
'app_getnew' => "Новые сообщения",
'app_newtopic' => "Новая тема",
'app_reply' => "Ответ",
'app_user_topic' => "Темы пользователя",
'app_post_edit' => "Редактирование сообщения",
'app_search' => "Поиск",
'search_result' => "Результат поиска",
'u_log_empty' => "<hr><center><b>Журнал пользователя пуст.</b></center>",
'f_reply' => "Быстрый ответ",
'getnew_title' => "Сообщения с Вашего последнего посещения",
'all_read_link' => "Прочитано",
'subscr_not' => "<center><b>Вы не подписаны ни на одну тему.</b></center>",
'search_result' => "Результаты поиска",
'search_topic' => "К сожалению, Ваш поиск не дал никаких результатов. <a href='javascript:history.go(-1)'>Назад</a>",
'report_send' => "Жалоба успешно отправлена. <a href=\"{link}\">Вернуться назад</a>",
'mail_send' => "Письмо успешно отправлено <a href=\"{link}\">Вернуться назад</a>",
'title_forward' => "Отправка письма другу",
'edit_info' => "Сообщение отредактировал",
'err_name' => "<Li>Проврете правильность ввода имени!</Li>",
'err_mail' => "<Li>Проврете правильность ввода e-mail!</Li>",
'h_post' => "<b>Сообщение скрыто</b>",
'flood_stop' => "Был активирован флуд-контроль, напишите ваше сообщение через {time} секунд. <a href='javascript:history.go(-1)'>Назад</a>",
'discuss_no_cat' => "Для данной категории новостей не задан форум. <a href=\"javascript:history.go(-1)\">Вернуться назад</a>",
'discuss_off' => "Данная функция отключена. Для создания темы зайдите на форум. <a href=\"javascript:history.go(-1)\">Вернуться назад</a>",
// add for 2.3 //
'captcha_stop' => "Код безопасности не соответствует отображённому! <a href=\"javascript:history.go(-1)\">Вернуться назад</a>",
'maxlen_stop' => "Длинна сообщения превышает допустимый предел! <a href=\"javascript:history.go(-1)\">Вернуться назад</a>",
'ajax_stop_1' => "Был активирован флуд-контроль!",
'ajax_stop_2' => "Код безопасности не соответствует отображённому!",
'ajax_stop_3' => "Заполните все необходимые поля!",
'ajax_stop_4' => "Длинна сообщения превышает допустимый предел!",
'topic_last_p' => "К последнему сообщению:",
'last_visit' => "<b>С возвращением, последний раз вы были здесь:</b>",
'reg_name' => "<br />Зарегистрировано на ",
// add for 2.4 //
'moderators' => "Модераторы:",
'spoiler_title' => "Показать / Скрыть текст",
'i_quote' => "Цитата:",
);
?>
+197
View File
@@ -0,0 +1,197 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
$act = $_REQUEST['act'];
require_once SYSTEM_DIR.'/forum/sources/components/init.php';
switch ($act)
{
// ********************************************************************************
// SHOW INDEX
// ********************************************************************************
case "":
if ($forum_config['hide_forum']){
$access_hide = "and access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
}else{
$access_hide = "";
}
$result_content = $db->query("SELECT * FROM " . PREFIX . "_forum_category LEFT JOIN ". PREFIX ."_forum_forums ON ". PREFIX ."_forum_category.sid= ". PREFIX ."_forum_forums.main_id WHERE parentid = '0' {$access_hide} ORDER BY posi, position");
for ($i = 0; $row = $db->get_row($result_content); $i = $row['sid'])
{
if ($row['name'])
{
if (!$fcache->open('sub-'.$row['id']))
{
if ($sub_forums_array != 'empty')
{
foreach ($sub_forums_array as $value)
{
if ($row['id'] == $value['parentid'])
{
$symbol_count++;
if ($symbol_count > 1) $symbol = ", ";
$sub_forums .= link_forum($value['id'], $value['name'], $symbol);
}
}
}
$fcache->save('sub-'.$row['id'], $sub_forums);
}
else { $sub_forums = $fcache->open('sub-'.$row['id']); }
if (!$fcache->open('moder-'.$row['id']))
{
foreach ($forum_moderators as $moderators)
{
if ($moderators['forum_id'] == $row['id'] and $moderators['member_name'])
{
$mod_count++;
if ($mod_count > 1) $mod_symbol = ", ";
$moderators_list .= $mod_symbol . link_user($moderators['member_name']);
}
}
$fcache->save('moder-'.$row['id'], $moderators_list);
}
else { $moderators_list = $fcache->open('moder-'.$row['id']); }
$forum_link = link_forum($row['id'], $row['name']);
$tpl->load_template($tpl_dir.'forums.tpl');
$tpl->set('{forum_id_rss}', $forum_url."/rss/forum_".$row['id'].".xml");
$tpl->set('{status}', forum_status ($row['f_last_date'], $row['password'], $row['icon']));
$tpl->set('{name}', $forum_link);
$tpl->set('{description}', stripslashes($row['description']));
if ($sub_forums){$tpl->set('{forums}', '<br />' . $forum_config['forum_pr_sub'].' '.$sub_forums);
} else {$tpl->set('{forums}', '');}
if ($moderators_list){$tpl->set('{moderators}', '<br />' . $f_lang['moderators'] . ' ' . $moderators_list);
} else {$tpl->set('{moderators}', '');}
$tpl->set('{topics}', $row['topics']);
$tpl->set('{post}', $row['posts']);
$tpl->set('{last}', forum_last ($row['f_last_tid'], $row['f_last_title'], $row['f_last_poster_name'], $row['f_last_date'], $row['password'], $row['id'], $row['access_read'], $row['last_post_id']));
$tpl->compile("forums_{$row['main_id']}");
$tpl->clear();
unset ($sub_forums);
unset ($symbol_count);
unset ($symbol);
unset ($moderators_list);
unset ($mod_count);
unset ($mod_symbol);
}
if ($row['sid'] != $start_id){
$category_link = link_category($start_id, $start_name);
$tpl->load_template($tpl_dir.'category.tpl');
$tpl->set('{category}', $category_link);
$tpl->set('{forums}', $tpl->result["forums_{$start_id}"]);
$tpl->compile('dle_forum');
$tpl->clear();
}
$start_id = $row['sid'];
$start_name = stripslashes($row['cat_name']);
}
$category_link = link_category($start_id, $start_name);
$tpl->load_template($tpl_dir.'category.tpl');
$tpl->set('{category}', $category_link);
$tpl->set('{forums}', $tpl->result["forums_{$start_id}"]);
$tpl->compile('dle_forum');
$tpl->clear();
if ($forum_config['stats']){require_once SYSTEM_DIR.'/forum/sources/modules/stats.php';}
break;
case "category": require_once SYSTEM_DIR.'/forum/sources/category.php'; break;
case "forum": require_once SYSTEM_DIR.'/forum/sources/showforum.php'; break;
case "topic": require_once SYSTEM_DIR.'/forum/sources/showtopic.php'; break;
case "add_topic": require_once SYSTEM_DIR.'/forum/action/addtopic.php'; break;
case "getforum": require_once SYSTEM_DIR.'/forum/action/forum.php'; break;
case "getnew": require_once SYSTEM_DIR.'/forum/sources/modules/getnew.php'; break;
case "search": require_once SYSTEM_DIR.'/forum/sources/modules/search.php'; break;
case "subscription": require_once SYSTEM_DIR.'/forum/sources/modules/subscription.php'; break;
case "moderation": require_once SYSTEM_DIR.'/forum/action/moderation.php'; break;
case "post": require_once SYSTEM_DIR.'/forum/action/post.php'; break;
case "_topic": require_once SYSTEM_DIR.'/forum/action/topic.php'; break;
case "user_posts": require_once SYSTEM_DIR.'/forum/sources/shapeshifter/forum_posts.php'; break;
// ********************************************************************************
// ATTACHMENT
// ********************************************************************************
case "attachment":
$file_id = intval($_REQUEST['id']);
if ($file_id)
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_files WHERE file_id = '$file_id'");
if ($row['file_id'])
{
if (count($forums_array))
{
$access_download = $forums_array[$row['forum_id']]['access_download'];
if (check_access($access_download))
{
if ($row['file_type'] == "file"){
$FILE_DIR = "files";
} else {
$FILE_DIR = "images";
}
$db->query("UPDATE " . PREFIX . "_forum_files SET dcount = dcount+1 WHERE file_id = '$file_id'");
@header("Location: {$config['http_home_url']}uploads/forum/{$FILE_DIR}/{$row['onserver']}");
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['f_msg'], $f_lang['forum_down'], 'user_group', $group_name);
}
}
}
else
{
@header("HTTP/1.0 404 Not Found");
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
}
else
{
@header("HTTP/1.0 404 Not Found");
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
break;
}
if ($forum_config['forum_bar'])
{
$forum_bar = "<a href=\"{$forum_url}/\">".$forum_config['forum_title']."</a>";
if ($bbr_cid and $bbr_name){$forum_bar .= " &raquo; ".link_category($bbr_cid, $bbr_name);}
if ($bbr_fname and $bbr_fid){$forum_bar .= " &raquo; ".link_forum($bbr_fid, $bbr_fname);}
if ($bbr_tname and $bbr_tid){$forum_bar .= " &raquo; ".link_topic($bbr_tid, $bbr_tname);}
if ($bbr_app){$forum_bar .= " &raquo; ".$bbr_app."</a>";}
$forum_bar = stripslashes($forum_bar);
}
if (!defined('FORUM_SUB_DOMAIN')){require_once SYSTEM_DIR . $compile_php;}
if ($forum_config['meta_descr'] and !$meta_topic){$metatags['description'] = $forum_config['meta_descr'];}
if ($forum_config['meta_keywords'] and !$meta_topic){$metatags['keywords'] = $forum_config['meta_keywords'];}
?>
+142
View File
@@ -0,0 +1,142 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if (intval($cid))
{
if ($forum_config['hide_forum'])
{
$access_hide = "and access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
}
else
{
$access_hide = "";
}
$category_name = stripslashes($cats_array[$cid]['cat_name']);
if ($category_name)
{
$result = $db->query("SELECT * FROM ". PREFIX ."_forum_forums WHERE main_id = $cid and parentid = 0 {$access_hide} ORDER by position");
while ($row = $db->get_row($result))
{
if (!$fcache->open('sub-'.$row['id']))
{
if ($sub_forums_array != 'empty')
{
foreach ($sub_forums_array as $value)
{
if ($row['id'] == $value['parentid'])
{
$symbol_count++;
if ($symbol_count > 1) $symbol = ", ";
$sub_forums .= link_forum($value['id'], $value['name'], $symbol);
}
}
}
$fcache->save('sub-'.$row['id'], $sub_forums);
}
else { $sub_forums = $fcache->open('sub-'.$row['id']); }
if (!$fcache->open('moder-'.$row['id']))
{
foreach ($forum_moderators as $moderators)
{
if ($moderators['forum_id'] == $row['id'] and $moderators['member_name'])
{
$mod_count++;
if ($mod_count > 1) $mod_symbol = ", ";
$moderators_list .= $mod_symbol . link_user($moderators['member_name']);
}
}
$fcache->save('moder-'.$row['id'], $moderators_list);
}
else { $moderators_list = $fcache->open('moder-'.$row['id']); }
$tpl->load_template($tpl_dir.'forums.tpl');
$tpl->set('{status}', forum_status ($row['f_last_date'], $row['password'], $row['icon']));
$tpl->set('{name}', link_forum($row['id'], $row['name']));
$tpl->set('{description}', stripslashes($row['description']));
if ($sub_forums)
{
$tpl->set('{forums}', '<br />'.$forum_config['forum_pr_sub'].' '.$sub_forums);
}
else { $tpl->set('{forums}', ''); }
if ($moderators_list)
{
$tpl->set('{moderators}', '<br />' . $f_lang['moderators'] . ' ' . $moderators_list);
}
else { $tpl->set('{moderators}', ''); }
$tpl->set('{topics}', $row['topics']);
$tpl->set('{post}', $row['posts']);
$tpl->set('{forum_id_rss}', $forum_url."/rss/forum_".$row['id'].".xml");
$tpl->set('{last}', forum_last ($row['f_last_tid'], $row['f_last_title'], $row['f_last_poster_name'], $row['f_last_date'], $row['password'], $row['id'], $row['access_read'], $row['last_post_id']));
$tpl->compile('forums');
$tpl->clear();
unset ($sub_forums);
unset ($symbol_count);
unset ($symbol);
unset ($moderators_list);
unset ($mod_count);
unset ($mod_symbol);
}
$tpl->load_template($tpl_dir.'category.tpl');
$tpl->set('{category}', $category_name);
$tpl->set('{forums}', $tpl->result['forums']);
$tpl->compile('dle_forum');
$tpl->clear();
$metatags['title'] = $forum_config['forum_title'].' &raquo; '.$category_name;
if ($forum_config['forum_bar'])
{
$bbr_cid = $cid;
$bbr_name = $category_name;
}
}
else
{
@header("HTTP/1.0 404 Not Found");
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
}
else
{
@header("HTTP/1.0 404 Not Found");
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
?>
@@ -0,0 +1,48 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$get_attachment = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE topic_id = '$tid' and file_attach = '1'");
while ($row = $db->get_row($get_attachment))
{
if ($row['file_type'] == "image")
{
$img_full = $config['http_home_url'].'uploads/forum/images/'.$row['onserver'];
$attachment = "<img src=\"{$img_full}\" border=\"0\">";
}
elseif ($row['file_type'] == "thumb")
{
$img_full = $config['http_home_url'].'uploads/forum/images/'.$row['onserver'];
$img_thumb = $config['http_home_url'].'uploads/forum/thumbs/'.$row['onserver'];
$hs_expand = "onClick=\"return hs.expand(this)\"";
$attachment = "<a href=\"{$img_full}\" {$hs_expand}><img src=\"{$img_thumb}\" border=\"0\"></a>";
}
else
{
$attachment_down = $a_forum_url."act=attachment&id=".$row['file_id'];
$attachment = "<a href=\"$attachment_down\">{$row['file_name']}</a> ({$row['dcount']} | ".mksize($row['file_size']).")";
//$onserver_url = "{$config['http_home_url']}uploads/forum/files/{$row['onserver']}";
}
if (!$ajax_edit_attach){
$tpl->result['posts'] = str_replace('[attachment='.$row['file_id'].']', $attachment, $tpl->result['posts']);
//$tpl->result['posts'] = preg_replace("#\[attachment={$row['file_id']}:(.*)\]#i", $onserver_url, $tpl->result['posts']);
}
else{
$post_text = str_replace('[attachment='.$row['file_id'].']', $attachment, $post_text);
//$post_text = preg_replace("#\[attachment={$row['file_id']}:(.*)\]#i", $onserver_url, $post_text);
}
}
?>
+179
View File
@@ -0,0 +1,179 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if (!defined('FORUM_SUB_DOMAIN'))
{
$color_html_dir = "{THEME}/bbcodes";
} else
{
$color_html_dir = $forum_config['forum_url']."/ajax";
}
$uploads_script_dir = $config['http_home_url']."system/forum/sources/modules";
if (!$upload_var['bb_width']) $bb_width = "460px";
else $bb_width = $upload_var['bb_width'];
$i = 0;
$output = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"120\"><tr>";
$smilies = explode(",", $config['smilies']);
foreach($smilies as $smile)
{
$i++; $smile = trim($smile);
$output .= "<td style=\"padding:2px;\" align=\"center\"><a href=\"#\" onClick=\"ins_smile(':$smile:'); return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"".$config['http_home_url']."system/data/emoticons/$smile.gif\" /></a></td>";
if ($i%3 == 0) $output .= "</tr><tr>";
}
$output .= "</tr></table>";
if ($ajax_post_id)
{
$ajax_post_id = '_'.$ajax_post_id;
$addform = "document.forum_post_form".$ajax_post_id;
}
else
{
$addform = "document.getElementById( 'forum-post-form' )";
}
$startform = "post_text".$ajax_post_id;
$add_id = false;
if ($access_upload AND $forum_config['tools_upload'] OR $access_upload AND $forum_config['img_upload'])
{
$tag_upload = "<div id=\"b_code\" class=\"editor_button\" onclick=\"window_upload()\"><img title=\"Çàãðóçêà ôàéëîâ è èçîáðàæåíèé íà ñåðâåð\" src=\"{THEME}/bbcodes/upload.gif\" width=\"23\" height=\"25\" border=\"0\"></div>";
}
if (!$upload_var['reply']){
$code = <<<HTML
<div style="width:{$bb_width}; height:50px; border:1px solid #BBB; background-image:url('{THEME}/bbcodes/bg.gif');">
<div id="b_b" class="editor_button" onclick="simpletag('b')"><img title="$lang[bb_t_b]" src="{THEME}/bbcodes/b.gif" width="23" height="25" border="0"></div>
<div id="b_i" class="editor_button" onclick="simpletag('i')"><img title="$lang[bb_t_i]" src="{THEME}/bbcodes/i.gif" width="23" height="25" border="0"></div>
<div id="b_u" class="editor_button" onclick="simpletag('u')"><img title="$lang[bb_t_u]" src="{THEME}/bbcodes/u.gif" width="23" height="25" border="0"></div>
<div id="b_s" class="editor_button" onclick="simpletag('s')"><img title="$lang[bb_t_s]" src="{THEME}/bbcodes/s.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_emo" class="editor_button" onclick="ins_emo();"><img title="$lang[bb_t_emo]" src="{THEME}/bbcodes/emo.gif" width="23" height="25" border="0"></div>
<div id="b_color" class="editor_button" onclick="ins_color();"><img src="{THEME}/bbcodes/color.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick="tag_url()"><img title="$lang[bb_t_url]" src="{THEME}/bbcodes/link.gif" width="23" height="25" border="0"></div>
<div class="editor_button" onclick="tag_email()"><img title="$lang[bb_t_m]" src="{THEME}/bbcodes/email.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick=tag_image()><img title="$lang[bb_b_img]" src="{THEME}/bbcodes/image.gif" width="23" height="25" border="0"></div>
{$tag_upload}
<div class="editor_button" onclick="tag_video()"><img title="$lang[bb_t_video]" src="{THEME}/bbcodes/mp.gif" width="23" height="25" border="0"></div>
<div class="editor_button" onclick="tag_audio()"><img src="{THEME}/bbcodes/mp3.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick="tag_flash()"><img src="{THEME}/bbcodes/flash.gif" width="23" height="25" border="0" alt="" /></div>
<div class="editor_button" onclick="tag_media()"><img src="{THEME}/bbcodes/youtube.gif" width="23" height="25" border="0" alt="" /></div>
<div class="editor_button" style="padding-top:4px;width:120px;"><select name="bbfont" class="editor_button" onchange="insert_font(this.options[this.selectedIndex].value, 'font')"><option value='0'>{$lang['bb_t_font']}</option><option value='Arial'>Arial</option><option value='Arial Black'>Arial Black</option><option value='Century Gothic'>Century Gothic</option><option value='Courier New'>Courier New</option><option value='Georgia'>Georgia</option><option value='Impact'>Impact</option><option value='System'>System</option><option value='Tahoma'>Tahoma</option><option value='Times New Roman'>Times New Roman</option><option value='Verdana'>Verdana</option></select></div>
<div class="editor_button" style="padding-top:4px;width:65px;"><select name="bbsize" class="editor_button" onchange="insert_font(this.options[this.selectedIndex].value, 'size')"><option value='0'>{$lang['bb_t_size']}</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option></select></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_left" class="editor_button" onclick="simpletag('left')"><img title="$lang[bb_t_l]" src="{THEME}/bbcodes/l.gif" width="23" height="25" border="0"></div>
<div id="b_center" class="editor_button" onclick="simpletag('center')"><img title="$lang[bb_t_c]" src="{THEME}/bbcodes/c.gif" width="23" height="25" border="0"></div>
<div id="b_right" class="editor_button" onclick="simpletag('right')"><img title="$lang[bb_t_r]" src="{THEME}/bbcodes/r.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_quote" class="editor_button" onclick="simpletag('quote')"><img title="$lang[bb_t_quote]" src="{THEME}/bbcodes/quote.gif" width="23" height="25" border="0"></div>
<div id="b_code" class="editor_button" onclick="simpletag('code')"><img title="$lang[bb_t_code]" src="{THEME}/bbcodes/code.gif" width="23" height="25" border="0"></div>
<div id="b_hide" class="editor_button" onclick="simpletag('hide')"><img title="$lang[bb_t_hide]" src="{THEME}/bbcodes/hide.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_spoiler" class="editor_button" onclick="spoiler()"><img src="{THEME}/bbcodes/spoiler.gif" width="23" height="25" border="0"></div>
<iframe width="154" height="104" id="cp" src="{$color_html_dir}/color.html" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; display: none; position: absolute;"></iframe>
<div id="dle_emo" style="visibility:hidden; display: none; position: absolute; width:140px; height: 124px; overflow: auto; border: 1px solid #BBB; background:#E9E8F2;filter: alpha(opacity=95, enabled=1) progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3);">{$output}</div>
HTML;
}
else {
$code = <<<HTML
<div style="width:{$bb_width}; height:25px; border:1px solid #BBB; background-image:url('{THEME}/bbcodes/bg.gif');">
<div id="b_b" class="editor_button" onclick="simpletag('b')"><img title="$lang[bb_t_b]" src="{THEME}/bbcodes/b.gif" width="23" height="25" border="0"></div>
<div id="b_i" class="editor_button" onclick="simpletag('i')"><img title="$lang[bb_t_i]" src="{THEME}/bbcodes/i.gif" width="23" height="25" border="0"></div>
<div id="b_u" class="editor_button" onclick="simpletag('u')"><img title="$lang[bb_t_u]" src="{THEME}/bbcodes/u.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_emo" class="editor_button" onclick="ins_emo();"><img title="$lang[bb_t_emo]" src="{THEME}/bbcodes/emo.gif" width="23" height="25" border="0"></div>
<div id="b_color" class="editor_button" onclick="ins_color();"><img src="{THEME}/bbcodes/color.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick="tag_url()"><img title="$lang[bb_t_url]" src="{THEME}/bbcodes/link.gif" width="23" height="25" border="0"></div>
<div class="editor_button" onclick="tag_email()"><img title="$lang[bb_t_m]" src="{THEME}/bbcodes/email.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div class="editor_button" onclick=tag_image()><img title="$lang[bb_b_img]" src="{THEME}/bbcodes/image.gif" width="23" height="25" border="0"></div>
{$tag_upload}
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_quote" class="editor_button" onclick="simpletag('quote')"><img title="$lang[bb_t_quote]" src="{THEME}/bbcodes/quote.gif" width="23" height="25" border="0"></div>
<div id="b_code" class="editor_button" onclick="simpletag('code')"><img title="$lang[bb_t_code]" src="{THEME}/bbcodes/code.gif" width="23" height="25" border="0"></div>
<div id="b_hide" class="editor_button" onclick="simpletag('hide')"><img title="$lang[bb_t_hide]" src="{THEME}/bbcodes/hide.gif" width="23" height="25" border="0"></div>
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
<div id="b_spoiler" class="editor_button" onclick="spoiler()"><img src="{THEME}/bbcodes/spoiler.gif" width="23" height="25" border="0"></div>
<iframe width="154" height="104" id="cp" src="{$color_html_dir}/color.html" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; display: none; position: absolute;"></iframe>
<div id="dle_emo" style="visibility:hidden; display: none; position: absolute; width:140px; height: 124px; overflow: auto; border: 1px solid #BBB; background:#E9E8F2;filter: alpha(opacity=95, enabled=1) progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3);">{$output}</div>
HTML;
}
if ( stristr( $_SERVER['REQUEST_URI'], "pages.php" ) ) {
$script_code = @file_get_contents(SYSTEM_DIR."/ajax/bbcodes.js");
$script_code .= <<<HTML
-->
</SCRIPT>
HTML;
} else {
$script_code = <<<HTML
-->
</SCRIPT>
<script type="text/javascript" src="{$config['http_home_url']}system/ajax/bbcodes.js"></script>
HTML;
}
$bb_code = <<<HTML
<SCRIPT type=text/javascript>
<!--
var text_enter_url = "$lang[bb_url]";
var text_enter_page = "$lang[bb_page]";
var text_enter_url_name = "$lang[bb_url_name]";
var text_enter_page_name = "$lang[bb_page_name]";
var text_enter_image = "$lang[bb_image]";
var text_enter_email = "$lang[bb_email]";
var text_code = "$lang[bb_code]";
var text_quote = "$lang[bb_quote]";
var error_no_url = "$lang[bb_no_url]";
var error_no_title = "$lang[bb_no_title]";
var error_no_email = "$lang[bb_no_email]";
var prompt_start = "$lang[bb_prompt_start]";
var img_title = "$lang[bb_img_title]";
var email_title = "$lang[bb_email_title]";
var text_pages = "$lang[bb_bb_page]";
var image_align = "{$config['image_align']}";
var selField = "{$startform}";
var fombj = {$addform};
function window_upload()
{
uploadsform('{$uploads_script_dir}/uploads.php?area={$upload_var['area']}&fid={$upload_var['forum_id']}&tid={$upload_var['topic_id']}&pid={$upload_var['post_id']}');
}
{$script_code}
{$code}
HTML;
?>
@@ -0,0 +1,104 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if ($check_moderator)
{
if (moderator_value('edit_topic', $forum_id, $m_member))
{
$topic_option .= "<option value=\"04\"> - Ðåäàêòèðîâàòü çàãîëîâîê</option>";
}
if (moderator_value('move_topic', $forum_id, $m_member))
{
$topic_option .= "<option value=\"05\"> - Ïåðåìåñòèòü òåìó</option>";
}
if (moderator_value('close_topic', $forum_id, $m_member) and !$row_topic['topic_status'])
{
$topic_option .= "<option value=\"02\"> - Çàêðûòü òåìó</option>";
}
if (moderator_value('open_topic', $forum_id, $m_member) and $row_topic['topic_status'])
{
$topic_option .= "<option value=\"01\"> - Îòêðûòü òåìó</option>";
}
if (moderator_value('pin_topic', $forum_id, $m_member) and $row_topic['fixed'])
{
$topic_option .= "<option value=\"08\"> - Çàêðåïèòü òåìó</option>";
}
if (moderator_value('unpin_topic', $forum_id, $m_member) and !$row_topic['fixed'])
{
$topic_option .= "<option value=\"09\"> - Îòêðåïèòü òåìó</option>";
}
if (!$row_topic['hidden'])
{
$topic_option .= "<option value=\"06\"> - Ñêðûòü òåìó</option>";
}
else
{
$topic_option .= "<option value=\"07\"> - Îïóáëèêîâàòü òåìó</option>";
}
if (moderator_value('delete_topic', $forum_id, $m_member))
{
$topic_option .= "<option value=\"03\"> - Óäàëèòü òåìó</option>";
}
if($topic_option)
{
$topic_option = "<option value=\"-1\">Îïöèè ìîäåðàòîðà</option>".$topic_option;
}
$posts_option = "<option value=\"00\">Ñîîáùåíèÿ</option>";
if (moderator_value('combining_post', $forum_id, $m_member))
{
$posts_option .= "<option value=\"07\"> - Îáúåäèíèòü ñîîáùåíèÿ</option>";
}
if (moderator_value('move_post', $forum_id, $m_member))
{
$posts_option .= "<option value=\"08\"> - Ïåðåìåñòèòü ñîîáùåíèÿ</option>";
}
$posts_option .= "<option value=\"05\"> - Îïóáëèêîâàòü ñîîáùåíèÿ</option>";
$posts_option .= "<option value=\"06\"> - Ñêðûòü ñîîáùåíèÿ</option>";
if (moderator_value('mass_prune', $forum_id, $m_member))
{
$posts_option .= "<option value=\"04\"> - Óäàëèòü ñîîáùåíèÿ</option>";
}
}
else
{
if ($user_group[$member_id['user_group']]['forum_topic_edit'] AND $member_id['name'] == $row_topic['author_topic'])
{
$topic_option .= "<option value=\"04\"> - Ðåäàêòèðîâàòü çàãîëîâîê</option>";
}
if ($user_group[$member_id['user_group']]['forum_topic_set'] AND $member_id['name'] == $row_topic['author_topic']){
if ($row_topic['topic_status']){
$topic_option .= "<option value=\"01\"> - Îòêðûòü òåìó</option>";
}else{
$topic_option .= "<option value=\"02\"> - Çàêðûòü òåìó</option>";
}
}
if ($user_group[$member_id['user_group']]['forum_topic_del'] AND $member_id['name'] == $row_topic['author_topic'])
{
$topic_option .= "<option value=\"03\"> - Óäàëèòü òåìó</option>";
}
if ($topic_option)
{
$topic_option = "<option value=\"-1\">Îïöèè ìîäåðàòîðà</option>".$topic_option;
}
}
?>
@@ -0,0 +1,777 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
// ********************************************************************************
// FORUM sessions
// ********************************************************************************
function forum_sessions ($act_forum = 0, $act_topic = 0)
{
global $db, $act, $forum_config, $member_id;
$id = $db->safesql($_COOKIE['dle_forum_sessions']);
$ip = $db->safesql($_SERVER['REMOTE_ADDR']);
if (!$id) { $id = session_id(); }
$browser = $db->safesql($_SERVER['HTTP_USER_AGENT']);
$member_name = $member_id['name'];
$BOT_AGENT = array(
'Googlebot' => "Google Bot",
'Mediapartners' => "Google MP",
'msnbot' => "MSN Bot",
'yahoo' => "Yahoo Bot",
'yandex' => "Yandex Bot",
'rambler' => "Rambler Bot",
'aport' => "Aport Bot",
'webalta' => "WebAlta Bot",
);
if (intval($member_id['user_group']) == "0"){ $member_id['user_group'] = "5"; }
if ($member_id['user_group'] == "5" and $forum_config['bot_agent'])
{
foreach ($BOT_AGENT as $bot => $bot_name)
{
if ( stristr ($browser, $bot) )
{
$member_name = $bot_name;
$id = md5 ($bot);
break;
}
}
}
$time = time();
$stime = time() - ($forum_config['session_time'] * 60);
if ($id)
{
$row = $db->super_query("SELECT id FROM " . PREFIX . "_forum_sessions WHERE id = '$id' AND ip = '$ip'");
}
if (!$row['id'])
{
set_cookie ('dle_forum_sessions', session_id(), 365);
$where_mn = $member_name ? " OR member_name = '$member_name'" : "";
$db->query("DELETE FROM " . PREFIX . "_forum_sessions WHERE running_time < '$stime' OR id = '$id'".$where_mn);
$db->query("INSERT INTO " . PREFIX . "_forum_sessions (id, member_name, member_id, user_group, ip, browser, running_time, location, act_forum, act_topic) VALUES ('$id', '$member_name', '$member_id[user_id]', '$member_id[user_group]', '$ip', '$browser', '$time', '$act', '$act_forum', '$act_topic')");
}
else
{
$db->query("UPDATE " . PREFIX . "_forum_sessions SET member_name = '$member_name', member_id = '$member_id[user_id]', user_group = '$member_id[user_group]', running_time = '$time', location = '$act', act_forum = '$act_forum', act_topic = '$act_topic' WHERE id = '$id'");
}
}
// ********************************************************************************
// FORUM Online
// ********************************************************************************
function get_forum_online ($type = false, $value = false)
{
global $db, $forum_config, $user_group, $forum_online;
$stime = time() - ($forum_config['session_time'] * 60);
if ($type and $value)
{
$WHERE = "".$type." = '$value' and";
}
$sessions = $db->query("SELECT member_name, user_group FROM " . PREFIX . "_forum_sessions WHERE {$WHERE} running_time > '$stime'");
$forum_online['member_count'] = 0;
$forum_online['guest_count'] = 0;
while ($row = $db->get_row($sessions))
{
$forum_online['all_count']++;
if ($row['member_name'] AND $row['user_group'] !== "5")
{
$forum_online['member_count']++;
$symbol_count++;
if ($symbol_count > 1) $symbol = ", ";
$group_span = $user_group[$row['user_group']]['colour'];
$forum_online['member_list'] .= $symbol.link_user($row['member_name'], "<span style=\"color:{$group_span}\">".$row['member_name']."</span>");
}
else
{
$forum_online['guest_count']++;
if ($row['member_name'])
{
$symbol_count++;
if ($symbol_count > 1) $symbol = ", ";
$forum_online['member_list'] .= $symbol . $row['member_name'];
}
}
}
if ($forum_online['all_count'] > $forum_config['_max_online_'])
{
global $fcache;
$max_online = array ('count' => $forum_online['all_count'], 'time' => $GLOBALS['_TIME']);
$fcache->set('online', $max_online);
$fcache->delete('stats');
}
}
// ********************************************************************************
// SHOW DATE
// ********************************************************************************
function show_date ($date)
{
global $f_lang, $forum_config, $_TIME;
if (date(Ymd, $date) == date(Ymd, $_TIME))
{
$show_date = $f_lang['time_heute'].langdate(", H:i", $date);
}
elseif (date(Ymd, $date) == date(Ymd, ($_TIME - 86400)))
{
$show_date = $f_lang['time_gestern'].langdate(", H:i", $date);
}
else
{
$show_date = langdate($forum_config['timestamp'], $date);
}
return ($show_date);
}
// ********************************************************************************
// FORUM STATUS
// ********************************************************************************
function forum_status ($last_date, $close = false, $icon = false)
{
global $member_id, $lasttime, $f_lang;
$last_date = strtotime($last_date);
if ($icon)
{
$icon = "_".$icon;
}
if ($last_date > $lasttime)
{
if (!$close)
{
$image = "f_new{$icon}.gif"; $alt = $f_lang['fs_new'];
}
else
{
$image = "fc_new{$icon}.gif"; $alt = $f_lang['fs_new'];
}
}
else
{
if (!$close)
{
$image = "f_nonew{$icon}.gif"; $alt = $f_lang['fs_nonew'];
}
else
{
$image = "fc_nonew{$icon}.gif"; $alt = $f_lang['fs_nonew'];
}
}
$topic_info = "<img src='{THEME}/forum/images/".$image."' border='0' alt='$alt'>";
return($topic_info);
}
// ********************************************************************************
// FORUM LAST
// ********************************************************************************
function forum_last ($topic_id, $title, $last_user, $last_date, $password = false, $fid = false, $access_read = false, $last_pid = 0)
{
global $forum_config, $f_lang, $_TIME, $member_id;
$title = stripslashes($title);
$last_date = strtotime($last_date);
$last_date_info = show_date($last_date);
$h_title = $f_lang['topic_last_p'].' '.$title;
if ($forum_config['last_abc'])
{
if (strlen($title) > $forum_config['last_abc'])
{
$title = substr($title, 0, $forum_config['last_abc']).'...';
}
}
if ($password AND md5($password) !== $_COOKIE["dle_forum_{$fid}"])
{
$link_topic = $f_lang['fl_c_forum'];
}
elseif (!check_access($access_read))
{
$link_topic = $f_lang['fl_c_forum'];
}
else
{
if ($forum_config['mod_rewrite']) { $p_sn = "/last#post-{$last_pid}"; } else { $p_sn = "&lastpost=1#post-{$last_pid}"; }
$link_topic = link_topic($topic_id . $p_sn, $title, $h_title);
}
$last_date_info .= $f_lang['fl_topic'].' '.$link_topic;
$last_date_info .= $f_lang['fl_author'].' '.link_user($last_user);
if (!$last_user or !$last_date){ $last_date_info = $f_lang['fl_nopost']; }
return($last_date_info);
}
// ********************************************************************************
// TOPIC STATUS
// ********************************************************************************
function topic_status ($topic_id, $last_date, $post, $topic_status, $frage)
{
global $topic_views, $forum_config, $member_id, $f_lang, $topic_a_time;
$last_date = strtotime($last_date);
if ($last_date > $topic_a_time AND $last_date > $member_id['forum_time']) $topic_views_time = 1;
if ($post >= $forum_config['topic_hot']) $topic_hot = 1;
if (!$topic_views[$topic_id] AND $topic_views_time)
{
$image = 'topic.gif'; $alt = $f_lang['topic_yes'];
if ($topic_hot) $image = 'hot_topic.gif'; $alt = $f_lang['topic_yes'];
if ($frage) $image = 'dlet_poll.gif'; $alt = $f_lang['topic_yes'];
}
else
{
$image = 'new_topic.gif'; $alt = $f_lang['topic_no'];
if ($topic_hot) $image = 'hot_topic_no.gif'; $alt = $f_lang['topic_no'];
if ($frage) $image = 'dlet_poll_no.gif'; $alt = $f_lang['topic_no'];
}
if ($topic_status == 1){$image = 'dlet_closed.gif'; $alt = $f_lang['topic_closed'];}
return ("<img src='{THEME}/forum/images/".$image."' border='0' alt='$alt'>");
}
// ********************************************************************************
// TOPIC LAST
// ********************************************************************************
function topic_last ($topic_id, $last_user, $last_date, $posts, $last_pid = 0)
{
global $forum_config, $f_lang, $_TIME;
$last_date = strtotime($last_date);
$last_date_info = show_date($last_date);
if ($forum_config['last_plink'])
{
$last_page = @ceil(($posts + 1) / $forum_config['post_inpage']);
if (!$last_page) $last_page = 1;
if ($forum_config['mod_rewrite']) { $p_sn = '/'; } else { $p_sn = '&cstart='; }
$last_date_info .= "<br />".link_topic($topic_id . $p_sn . $last_page . "#post-{$last_pid}", $f_lang['last_post'])." ".link_user($last_user)."<br />";
}
else
{
$last_date_info .= "<br />{$f_lang['last_post']} ".link_user($last_user)."<br />";
}
if (!$last_user or !$last_date){$last_date_info = $f_lang['fl_nopost'];}
return($last_date_info);
}
// ********************************************************************************
// CHECK ACCESS
// ********************************************************************************
function check_access ($value = false)
{
global $member_id;
$value = explode(":", $value);
$check = in_array($member_id['user_group'], $value);
if ($check) return true;
else return false;
}
// ********************************************************************************
// CHECK MODERATOR
// ********************************************************************************
function check_moderator($value, $moderators)
{
global $member_id, $m_member;
$value = explode(":", $value);
$check = in_array($member_id['user_group'], $value);
if (!$check and $moderators)
{
$moderators = explode(":", $moderators);
$check = in_array($member_id['user_id'], $moderators);
$m_member = true;
}
if ($check) return true;
else return false;
}
// ********************************************************************************
// MODERATOR VALUE
// ********************************************************************************
function moderator_value($value, $forum_id, $m_member = false)
{
global $member_id, $forum_moderators;
if ($forum_moderators == "a:0:{}") return false;
if ($forum_moderators)
{
if ($m_member)
{
$search = 'member_id';
$search_value = $member_id['user_id'];
}
else
{
$search = 'group_id';
$forum_id = '0';
$search_value = $member_id['user_group'];
}
foreach ($forum_moderators as $key => $val)
{
if ($forum_moderators[$key]['forum_id'] == $forum_id)
{
if ($forum_moderators[$key][$search] == $search_value)
{
if ($forum_moderators[$key][$value])
{
return true;
}
}
}
}
}
return false;
}
// ********************************************************************************
// IS MODERATION
// ********************************************************************************
function is_moderation($forum_id = 0, $topic_id = 0, $post_id = 0, $value = '')
{
global $db, $member_id, $user_group, $m_member, $is_mod; //$forum_id
$forum_id = intval($forum_id);
$topic_id = intval($topic_id);
$post_id = intval($post_id);
if ($post_id)
{
$get_post = $db->super_query("SELECT * FROM " . PREFIX . "_forum_posts WHERE pid = '$post_id'");
$topic_id = $get_post['topic_id'];
$is_mod['topic_id'] = $get_post['topic_id'];
$is_mod['author'] = $get_post['post_author'];
if ($member_id['name'] == $get_post['post_author'] AND $user_group[$member_id['user_group']][$value] AND !$get_post['hidden'])
{
return true;
$topic_id = false;
}
}
if ($topic_id)
{
if (!$forum_id)
{
$get_topic = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$topic_id'");
if ($get_topic['tid'] != $topic_id) return false;
$forum_id = $get_topic['forum_id'];
}
$is_mod['forum_id'] = $get_topic['forum_id'];
$get_forum = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = '$forum_id'");
if (check_moderator($get_forum['access_mod'], $get_forum['moderators']))
{
return true;
}
}
if (!$post_id and !$topic_id)
{
$get_forum = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = '$forum_id'");
if (check_moderator($get_forum['access_mod'], $get_forum['moderators']))
{
return true;
}
}
return false;
}
// ********************************************************************************
// GROUP MODERATION
// ********************************************************************************
function group_moderation ($topic_id = 0, $value = false)
{
global $db, $member_id, $user_group;
if (intval($topic_id))
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$topic_id'");
if ($member_id['name'] == $row['author_topic'])
{
foreach ($user_group as $key => $val)
{
if ($user_group[$key]['id'] == $member_id['user_group'])
{
if ($user_group[$key][$value])
{
return true;
}
}
}
}
}
return false;
}
// ********************************************************************************
// FORUM MSG
// ********************************************************************************
function forum_msg($title, $msg_text, $tpl_found = false, $tpl_set = false)
{
global $tpl, $tpl_dir;
$tpl->load_template($tpl_dir.'msg.tpl');
$tpl->set('{title}', $title);
$tpl->set('{msg}', $msg_text);
if ($tpl_found)
{
$tpl->set("{".$tpl_found."}", $tpl_set);
}
$tpl->compile('dle_forum');
$tpl->clear();
}
// ********************************************************************************
// Get Salt
// ********************************************************************************
function get_salt()
{
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
for($i=0;$i < 9; $i++)
{
$key_salt .= $salt{rand(0,33)};
}
return ($key_salt);
}
// ********************************************************************************
// Strip Data
// ********************************************************************************
function strip_data ($text)
{
$quotes = array( "\x27", "\x22", "\x60", "\t","\n","\r","'",",","/","\\","¬",";",":","@","~","[","]","{","}","=",")","(","*","&","^","%","$","<",">","?","!", '"' );
$text = trim(strip_tags ($text));
$text = str_replace($quotes, '', $text);
return $text;
}
// ********************************************************************************
// hilites
// ********************************************************************************
function hilites ($search, $txt)
{
$r = preg_split('((>)|(<))', $txt, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0; $i < count($r); $i++)
{
if ($r[$i] == "<")
{
$i++; continue;
}
$r[$i] = preg_replace("#($search)#i", "<span style='background-color:yellow;'><font color='red'>\\1</font></span>", $r[$i]);
}
return join("", $r);
}
// ********************************************************************************
// FORUM LIST
// ********************************************************************************
function forum_list(){
global $db;
$select_list = "<select name=\"move_fid\">";
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_category LEFT JOIN ". PREFIX ."_forum_forums ON ". PREFIX ."_forum_category.sid=". PREFIX ."_forum_forums.main_id ORDER BY posi, position");
for ($i = 0, $totalcount = 0; $row = $db->get_row($result); $i = $row['sid'], $chcount++)
{
if ($row['sid'] != $i)
{
$row['cat_name'] = stripslashes($row['cat_name']);
$select_list .= "<option value=\"0\">{$row['cat_name']}</option>";
}
if ($row['name'])
{
$row['name'] = stripslashes($row['name']);
$select_list .= "<option value=\"{$row['id']}\"> -- {$row['name']}</option>";
}
}
$select_list .= "</select>";
return ($select_list);
}
// ********************************************************************************
// CHECK ATTACHMENT
// ********************************************************************************
function check_attachment($post_id, $sources)
{
global $db;
$post_id = intval($post_id);
if (!$post_id OR !$sources) return false;
$query = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE post_id = '$post_id'");
while ($row = $db->get_row($query))
{
if (stristr($sources, "[attachment={$row['file_id']}]") OR stristr($sources, "/forum/files/{$row['onserver']}"))
{
$file_attach_y[] = $row['file_id'];
}
else
{
$file_attach_n[] = $row['file_id'];
}
}
if ($file_attach_y)
{
$update_list_y = implode(',', $file_attach_y);
$db->query("UPDATE " . PREFIX . "_forum_files SET file_attach = '1' WHERE file_id IN ({$update_list_y})");
}
if ($file_attach_n)
{
$update_list_n = implode(',', $file_attach_n);
$db->query("UPDATE " . PREFIX . "_forum_files SET file_attach = '0' WHERE file_id IN ({$update_list_n})");
}
}
// ********************************************************************************
// File Type
// ********************************************************************************
function file_type($name)
{
$type = explode ('.', $name);
$type = end ($type);
return ($type);
}
// ********************************************************************************
// Auto Wrap
// ********************************************************************************
function auto_wrap($post)
{
global $forum_config;
if (!$forum_config['auto_wrap']) return $post;
$post = preg_split('((>)|(<))', $post, -1, PREG_SPLIT_DELIM_CAPTURE);
$n = count($post);
for ($i = 0; $i < $n; $i++)
{
if ($post[$i] == "<")
{
$i++; continue;
}
$post[$i] = preg_replace("#([^\s\n\r]{".intval($forum_config['auto_wrap'])."})#i", "\\1<br />", $post[$i]);
}
$post = join("", $post);
return $post;
}
// ********************************************************************************
// Forum Metatags
// ********************************************************************************
function forum_metatags($story)
{
global $db;
$keyword_count = 20;
$newarr = array ();
$headers = array ();
$quotes = array ("\x27", "\x22", "\x60", "\t", '\n', '\r', "\n", "\r", '\\', "'", ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "&", "^", "%", "$", "<", ">", "?", "!", '"' );
$fastquotes = array ("\x27", "\x22", "\x60", "\t", "\n", "\r", '"', "'", '\r', '\n', "/", "\\", "{", "}", "[", "]" );
$story = preg_replace( "'\[hide\](.*?)\[/hide\]'si", "", $story );
$story = preg_replace( "'\[attachment=(.*?)\]'si", "", $story );
$story = str_replace( '<br />', ' ', $story );
$story = trim( strip_tags( $story ) );
$story = str_replace( $fastquotes, '', $story );
$headers['description'] = $db->safesql( substr( $story, 0, 190 ) );
$story = str_replace( $quotes, '', $story );
$arr = explode( " ", $story );
foreach ( $arr as $word )
{
if( strlen( $word ) > 4 ) $newarr[] = $word;
}
$arr = array_count_values( $newarr );
arsort( $arr );
$arr = array_keys( $arr );
$total = count( $arr );
$offset = 0;
$arr = array_slice( $arr, $offset, $keyword_count );
$headers['keywords'] = $db->safesql( implode( ", ", $arr ) );
return $headers;
}
function set_first_post_id ($tid, $pid = 0)
{
global $db;
$tid = intval($tid);
if (!$pid)
{
$row = $db->super_query("SELECT pid FROM " . PREFIX . "_forum_posts WHERE topic_id = $tid");
$pid = $row['pid'];
}
$db->query("UPDATE " . PREFIX . "_forum_topics SET first_post = '$pid', last_post_id = '$pid' WHERE tid = '$tid'");
return $pid;
}
function calk_topic_del ($topic_id, $del_count = 0, $act = '-')
{
global $db, $forum_config;
if (!$topic_id) return false;
$row = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_posts WHERE topic_id = $topic_id");
if (!$forum_config['set_topic_post']) $row['count'] = ($row['count'] - 1);
$new_result = $db->super_query("SELECT * FROM ". PREFIX ."_forum_posts WHERE topic_id = $topic_id ORDER by post_date DESC");
$db->query("UPDATE " . PREFIX . "_forum_topics SET post = '{$row['count']}', last_date = '$new_result[post_date]', last_poster_name = '$new_result[post_author]' WHERE tid = $topic_id");
$row2 = $db->super_query("SELECT forum_id FROM " . PREFIX . "_forum_topics WHERE tid = $topic_id");
$new_f_r = $db->super_query("SELECT * FROM ". PREFIX ."_forum_topics WHERE forum_id = {$row2['forum_id']} ORDER by last_date DESC");
if ($del_count)
{
$db->query("UPDATE " . PREFIX . "_forum_forums SET posts = posts{$act}{$del_count}, f_last_date = '$new_f_r[last_date]', f_last_poster_name = '$new_f_r[last_poster_name]' WHERE id = {$row2['forum_id']}");
}
return true;
}
?>
+471
View File
@@ -0,0 +1,471 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
@include SYSTEM_DIR.'/data/forum_config.php';
include_once SYSTEM_DIR.'/forum/language/'.$config['langs'].'/forum.lng';
require_once SYSTEM_DIR.'/classes/cache.class.php';
$fcache = new cache($dir = ROOT_DIR . '/cache/forum');
require_once SYSTEM_DIR.'/forum/sources/components/functions.php';
define('UPLOAD_DIR', ROOT_DIR."/uploads/forum/");
// ********************************************************************************
// USER UPDATE
// ********************************************************************************
if ($is_logged and $forum_config['set_post_num_day'] and !$_SESSION['forum_update'])
{
if (!$member_id['forum_update'])
{
$db->query("UPDATE " . PREFIX . "_users SET forum_update = '".time()."' WHERE user_id = {$member_id['user_id']}");
}
$up_days = ($forum_config['set_post_num_day'] * 8640);
if ((time() + $up_days) > $member_id['forum_update'])
{
if ($forum_config['set_topic_post'])
{
$topic = $db->super_query("SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics WHERE author_topic = '$member_id[name]'");
$topic_num = $topic['count'];
}
$post = $db->super_query("SELECT COUNT(pid) as count FROM " . PREFIX . "_forum_posts
WHERE post_author = '$member_id[name]' and is_count");
$post_num = $post['count'];
$update = $forum_config['set_topic_post'] ? ($topic_num + $post_num) : $post_num;
$db->query("UPDATE " . PREFIX . "_users SET forum_post = '$update' WHERE name = '$member_id[name]'");
$db->query("UPDATE " . PREFIX . "_users SET forum_update = '".time()."' WHERE user_id = {$member_id['user_id']}");
$_SESSION['forum_update'] = "1";
}
}
// ********************************************************************************
// SET MOD REWRITE
// ********************************************************************************
if (!defined('FORUM_SUB_DOMAIN'))
{
if ($forum_config['mod_rewrite'])
{
$forum_url = $config['http_home_url']."forum";
}
else
{
$forum_url = $config['http_home_url']."index.php?do=forum&";
}
$a_forum_url = $config['http_home_url']."index.php?do=forum&";
}
else
{
if ($forum_config['mod_rewrite'])
{
$forum_url = $forum_config['forum_url'];
}
else
{
$forum_url = $forum_config['forum_url']."/index.php?";
}
$a_forum_url = $forum_config['forum_url']."/index.php?";
}
$forum_link_array = array();
if ($forum_config['mod_rewrite'])
{
$forum_link_array['search'] = $forum_url."/search/";
$forum_link_array['getnew'] = $forum_url."/getnew/";
$forum_link_array['subscription'] = $forum_url."/subscription/";
$forum_link_array['textversion'] = $forum_url."/textversion.html";
function link_category($id, $name)
{
global $forum_url;
return ("<a href='{$forum_url}/category_{$id}'>{$name}</a>");
}
function link_forum($id, $name, $symbol=false)
{
global $forum_url;
$name = stripslashes($name);
return ($symbol."<a href='{$forum_url}/forum_{$id}'>{$name}</a>");
}
function link_topic($id, $name, $title = false)
{
global $forum_url;
if ($title) $title = " title='$title'";
return ("<a href='{$forum_url}/topic_{$id}'{$title}>{$name}</a>");
}
function link_user($user, $title = false)
{
global $config;
if (!$title) $title = $user;
return("<a href='{$config['http_home_url']}user/".urlencode($user)."/'>{$title}</a>");
}
}
else
{
$forum_link_array['search'] = $forum_url."act=search";
$forum_link_array['getnew'] = $forum_url."act=getnew";
$forum_link_array['subscription'] = $forum_url."act=subscription";
$forum_link_array['textversion'] = $config['http_home_url']."system/forum/textversion.php";
function link_category($id, $name)
{
global $forum_url;
return ("<a href='{$forum_url}category={$id}'>{$name}</a>");
}
function link_forum($id, $name, $symbol=false)
{
global $forum_url;
$name = stripslashes($name);
return ($symbol."<a href='{$forum_url}showforum={$id}'>{$name}</a>");
}
function link_topic($id, $name, $title = false)
{
global $forum_url;
if ($title) $title = " title='$title'";
return ("<a href='{$forum_url}showtopic={$id}'{$title}>{$name}</a>");
}
function link_user($user, $title = false)
{
global $config;
if (!$title) $title = $user;
return("<a href='{$config['http_home_url']}?subaction=userinfo&user=".urlencode($user)."'>{$title}</a>");
}
}
$tpl_dir = 'forum/';
$metatags['title'] = $forum_config['forum_title'];
$start_id = $fcache->get('start_id');
if (!$start_id)
{
$row_start = $db->super_query("SELECT sid FROM " . PREFIX . "_forum_category ORDER BY posi LIMIT 1");
$start_id = $row_start['sid'];
$fcache->set('start_id', $start_id);
}
$cats_array = $fcache->get('cats_array');
if (!$cats_array)
{
$cats_array = array();
$result = $db->query("SELECT sid, cat_name FROM ". PREFIX ."_forum_category ORDER by posi");
while ($row = $db->get_row($result))
{
$cats_array[$row['sid']] = array ();
foreach ($row as $key => $value)
{
$cats_array[$row['sid']][$key] = $value;
}
}
if (!$cats_array) $cats_array = 'empty';
$fcache->set('cats_array', $cats_array);
}
$forums_array = $fcache->get('forums_array');
if (!$forums_array)
{
$forums_array = array();
$result = $db->query("SELECT id, parentid, main_id, name, access_read, access_write, access_topic, access_mod, access_upload, access_download, password, moderators, postcount, fixpost, banner, q_reply, i_edit FROM ". PREFIX ."_forum_forums ORDER by position");
while ($row = $db->get_row($result))
{
$forums_array[$row['id']] = array ();
foreach ($row as $key => $value)
{
$forums_array[$row['id']][$key] = $value;
}
}
$fcache->set('forums_array', $forums_array);
}
$sub_forums_array = $fcache->get('sub_forums_array');
if (!$sub_forums_array)
{
$sub_forums_array = array();
$result = $db->query("SELECT id, parentid, name FROM ". PREFIX ."_forum_forums WHERE parentid ORDER by position");
while ($row = $db->get_row($result))
{
$sub_forums_array[$row['id']] = array ();
foreach ($row as $key => $value)
{
$sub_forums_array[$row['id']][$key] = $value;
}
}
if (!$sub_forums_array) $sub_forums_array = 'empty';
$fcache->set('sub_forums_array', $sub_forums_array);
}
$sub_parentid = $fcache->get('sub_parentid');
if (!$sub_parentid)
{
$sub_parentid = array();
$result = $db->query("SELECT parentid FROM ". PREFIX ."_forum_forums WHERE parentid ORDER by position");
while ($row = $db->get_row($result))
{
$sub_parentid[$row['parentid']] = array ();
foreach ($row as $key => $value)
{
$sub_parentid[$row['parentid']][$key] = $value;
}
}
if (!$sub_parentid) $sub_parentid = 'empty';
$fcache->set('sub_parentid', $sub_parentid);
}
$forum_moderators = $fcache->get('forum_moderators');
if (!$forum_moderators)
{
$get_moderators = $db->query("SELECT * FROM " . PREFIX . "_forum_moderators ORDER BY mid ASC");
$forum_moderators = array();
while ($row = $db->get_row($get_moderators))
{
$forum_moderators[$row['mid']] = array();
foreach ($row as $key => $value)
{
$forum_moderators[$row['mid']][$key] = $value;
}
}
$fcache->set('forum_moderators', $forum_moderators);
}
$rank_array = $fcache->get('rank_array');
if (!$rank_array)
{
$rank_array = array();
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_titles");
while ($row = $db->get_row($result))
{
$rank_array[$row['id']] = array ();
foreach ($row as $key => $value)
{
$rank_array[$row['id']][$key] = $value;
}
}
if (!$rank_array) $rank_array = 'empty';
$fcache->set('rank_array', $rank_array);
}
$date_cron = $fcache->get('date_cron');
//@TODO Êîñÿê â èçîáðàæåíèè
$compile_php = "/inc/forum/ico/dle_forum.png";
if (!$date_cron OR $date_cron != date('d'))
{
$lim_time = (time() - 86400);
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE file_date < '$lim_time' AND file_attach = 0");
while ($row = $db->get_row($result))
{
if ($row['file_type'] == "file")
{
unlink(UPLOAD_DIR."files/".$row['onserver']);
}
elseif ($row['file_type'] == "thumb")
{
unlink(UPLOAD_DIR."thumbs/".$row['onserver']);
unlink(UPLOAD_DIR."images/".$row['onserver']);
}
else
{
unlink(UPLOAD_DIR."images/".$row['onserver']);
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE file_id = {$row['file_id']}");
}
$fcache->set('date_cron', date('d'));
}
// ********************************************************************************
// MAX ONLINE STATS
// ********************************************************************************
$max_online = $fcache->get('online');
$forum_config['_max_online_'] = $max_online['count'];
// ********************************************************************************
// IF OFFLINE
// ********************************************************************************
if ($forum_config['offline'] AND !$user_group[$member_id['user_group']]['allow_offline'] AND !$ajax_start)
{
die ("<center><hr><h2>Forum - offline</h2><hr></center>");
}
// ********************************************************************************
// REQUREST
// ********************************************************************************
if ($_REQUEST['category'])
{
$act = 'category';
$cid = intval($_REQUEST['category']);
$t_act = '?c' . $cid;
}
if ($_REQUEST['showforum'])
{
$act = 'forum';
$fid = intval($_REQUEST['showforum']);
$t_act = '?f' . $fid;
}
if ($_REQUEST['showtopic'])
{
$act = 'topic';
$tid = intval($_REQUEST['showtopic']);
$t_act = '?t' . $tid;
}
if ($forum_config['sessions_log'] AND $act != 'forum' AND $act != 'topic' AND !$not_forum_sessions AND !$ajax_start)
{
forum_sessions();
}
// ********************************************************************************
// TIME
// ********************************************************************************
$topic_a_time = time() - ($forum_config['topic_new_day'] * 86400);
if ($is_logged)
{
if (!$_SESSION['forum_last'])
{
@session_register('forum_last');
$_SESSION['forum_last'] = $member_id['forum_last'];
if (($member_id['forum_last'] + (3600*4)) < $_TIME)
{
$db->query("UPDATE LOW_PRIORITY " . USERPREFIX . "_users SET forum_last='{$_TIME}' where user_id={$member_id['user_id']}");
}
}
$lasttime = $_SESSION['forum_last'];
}
else
{
if (!$_COOKIE['forum_last'])
{
set_cookie ('forum_last', $_TIME, 365);
$_COOKIE['forum_last'] = $_TIME;
}
if (!$_SESSION['guest_forum_last'])
{
@session_register('guest_forum_last');
$_SESSION['guest_forum_last'] = $_COOKIE['forum_last'];
if (($_COOKIE['forum_last'] + (3600*4)) < $_TIME)
{
set_cookie ('forum_last', $_TIME, 365);
}
}
$lasttime = $_SESSION['guest_forum_last'];
}
// ********************************************************************************
// Last Visit
// ********************************************************************************
if (!$act and $lasttime)
{
$dle_forum_last_visit = $f_lang['last_visit'] .'&nbsp;'. show_date ($lasttime);
}
else
{
$dle_forum_last_visit = "";
}
?>
File diff suppressed because one or more lines are too long
@@ -0,0 +1,159 @@
<?php
/*
=====================================================
DLE Forum - by DLE Files Group
-----------------------------------------------------
http://dle-files.ru/
-----------------------------------------------------
File: navigation.php
=====================================================
Copyright (c) 2008,2010 DLE Files Group
=====================================================
*/
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$tpl->load_template($tpl_dir.'navigation.tpl');
//----------------------------------
// Previous
//----------------------------------
$no_prev = false;
$no_next = false;
if(isset($cstart) and $cstart != "" and $cstart > 0)
{
$prev = $cstart / $config_inpage;
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"".$icat."".$prev."/\">\\1</a>");
}
else $tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1"); $no_prev = TRUE;
//----------------------------------
// Pages
//----------------------------------
if($config_inpage)
{
if ($count_all > $config_inpage){$tpl_nav = true;} // tpl compile //
$pages_count = @ceil($count_all / $config_inpage);
$pages_start_from = 0;
$pages = "";
$pages_per_section = 3;
if($pages_count > 10)
{
for($j = 1; $j <= $pages_per_section; $j++)
{
if($pages_start_from != $cstart)
{
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
}
else
{
$pages .= " <span>$j</span> ";
}
$pages_start_from += $config_inpage;
}
if(((($cstart / $config_inpage) + 1) > 1) && ((($cstart / $config_inpage) + 1) < $pages_count))
{
$pages .= ((($cstart / $config_inpage) + 1) > ($pages_per_section + 2)) ? '... ' : ' ';
$page_min = ((($cstart / $config_inpage) + 1) > ($pages_per_section + 1)) ? ($cstart / $config_inpage) : ($pages_per_section + 1);
$page_max = ((($cstart / $config_inpage) + 1) < ($pages_count - ($pages_per_section + 1))) ? (($cstart / $config_inpage) + 1) : $pages_count - ($pages_per_section + 1);
$pages_start_from = ($page_min - 1) * $config_inpage;
for($j = $page_min; $j < $page_max + ($pages_per_section - 1); $j++)
{
if($pages_start_from != $cstart)
{
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
}
else
{
$pages .= " <span>$j</span> ";
}
$pages_start_from += $config_inpage;
}
$pages .= ((($cstart / $config_inpage) + 1) < $pages_count - ($pages_per_section + 1)) ? '... ' : ' ';
}
else
{
$pages .= '... ';
}
$pages_start_from = ($pages_count - $pages_per_section) * $config_inpage;
for($j=($pages_count - ($pages_per_section - 1)); $j <= $pages_count; $j++)
{
if($pages_start_from != $cstart)
{
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
}
else
{
$pages .= " <span>$j</span> ";
}
$pages_start_from += $config_inpage;
}
}
else
{
for($j=1;$j<=$pages_count;$j++)
{
if($pages_start_from != $cstart)
{
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
}
else
{
$pages .= " <span>$j</span> ";
}
$pages_start_from += $config_inpage;
}
}
}
$tpl->set('{pages}', $pages);
$tpl->set('{pages_count}', $pages_count);
$tpl->set_block("'\[page-link\](.*?)\[/page-link\]'si", "<a href=\"JavaScript:navigation('{$pages_count}', '{$icat}');\">\\1</a>");
//----------------------------------
// Next
//----------------------------------
$i = (($cstart / $config_inpage));
if($i < $pages_count-1)
{
$next_page = $cstart / $config_inpage + 2;
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"".$icat."".$next_page."/\">\\1</a>");
}
else
{
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1"); $no_next = TRUE;
}
if ($tpl_nav){$tpl->compile('navigation');}
$tpl->clear();
?>
+159
View File
@@ -0,0 +1,159 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
$topic_id = $tid;
function get_votes ($all) {
$data = array();
if ($all != "") {
$all = explode("|", $all);
foreach ($all as $vote) {
list($answerid, $answervalue) = explode(":", $vote);
$data[$answerid] = intval($answervalue);
}
}
return $data;
}
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
if ($is_logged)
$log_id = intval($member_id['user_id']);
else
$log_id = $_IP;
$log = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_poll_log WHERE topic_id = '$topic_id' AND member ='{$log_id}'");
$row_topic['poll_title'] = stripslashes($row_topic['poll_title']);
$row_topic['frage'] = stripslashes($row_topic['frage']);
$body = explode("<br />", stripslashes($row_topic['poll_body']));
$tpl->load_template($tpl_dir.'poll.tpl');
$tpl->set('{vote_title}', $row_topic['poll_title']);
$tpl->set('{question}', $row_topic['frage']);
$tpl->set('{vote_count}', $row_topic['poll_count']);
$list = "<div id=\"dle-poll-list\">";
if (!$log['count'] AND $check_write) {
if (!$row_topic['multiple']){
for ($v = 0; $v < sizeof($body); $v++) {
if (!$v) $sel = "checked"; else $sel = "";
$list .= <<<HTML
<div><input name="dle_poll_votes" id="dle_poll_votes" type="radio" $sel value="{$v}"><label for="dle_poll_votes">{$body[$v]}</label></div>
HTML;
}
} else {
for ($v = 0; $v < sizeof($body); $v++) {
$list .= <<<HTML
<div><input name="dle_poll_votes[]" id="dle_poll_votes" type="checkbox" value="{$v}"><label for="dle_poll_votes">{$body[$v]}</label></div>
HTML;
}
}
$allcount = 0;
} else {
$answer = get_votes ($row_topic['answer']);
$allcount = $row_topic['poll_count'];
$pn = 0;
for ($v = 0; $v < sizeof($body); $v++) {
$num = $answer[$v];
++$pn; if ($pn > 5) $pn = 1;
if (!$num) $num = 0;
if ($allcount != 0) $proc = (100 * $num) / $allcount;
else $proc = 0;
$proc = round($proc, 0);
$list .= <<<HTML
{$body[$v]} - {$num} ({$proc}%)<br />
<img src="{$config['http_home_url']}templates/{$config['skin']}/images/poll{$pn}.gif" height="10" width="{$proc}%" style="border:1px solid black"><br />
HTML;
}
$allcount = 1;
}
$list .= "</div>";
$tpl->set('{vote_body}',$list);
if (!defined('FORUM_SUB_DOMAIN'))
{
$ajax_poll_php = "system/forum/";
}
$ajax_script = <<<HTML
<script type="text/javascript">
var dle_poll_result = 0;
var dle_poll_voted = {$allcount};
function doPoll( event ){
var frm = document.dlepollform;
var vote_check = '';
var topic_id = frm.topic_id.value;
if (dle_poll_voted == 1) { return; }
if (event != 'results' && dle_poll_result != 1) {
for (var i=0;i < frm.elements.length;i++) {
var elmnt = frm.elements[i];
if (elmnt.type=='radio') {
if(elmnt.checked == true){ vote_check = elmnt.value; break;}
}
if (elmnt.type=='checkbox') {
if(elmnt.checked == true){ vote_check = vote_check + elmnt.value + ' ';}
}
}
if (event == 'vote' && vote_check == '') { alert ('{$lang['poll_failed']}'); return; }
dle_poll_voted = 1;
} else { dle_poll_result = 1; }
if (dle_poll_result == 1 && event == 'vote') { dle_poll_result = 0; event = 'list'; }
ShowLoading('');
$.post(dle_root + "{$ajax_poll_php}ajax/poll.php", { vote_skin: "{$config['skin']}", topic_id: topic_id, action: event, answer: vote_check }, function(data){
HideLoading('');
$("#dle-poll-list").fadeOut(500, function() {
$(this).html(data);
$(this).fadeIn(500);
});
});
}
</script>
HTML;
$tpl->copy_template = $ajax_script."<form method=\"post\" name=\"dlepollform\" id=\"dlepollform\" action=\"\">".$tpl->copy_template."<input type=\"hidden\" name=\"topic_id\" id=\"topic_id\" value=\"".$topic_id."\" /></form>";
$tpl->compile('topic_poll');
$tpl->clear();
?>
@@ -0,0 +1,124 @@
<?php
function tpl_main ($tpl){
global $config, $forum_config;
$textversion = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset={$tpl['charset']}" />
<link rel="stylesheet" rev="stylesheet" href="{$config['http_home_url']}/system/forum/textscreen.css" media="screen" />
<title>{$tpl['title']}</title>
</head>
<body>
<div id='wrapper'>
<div id='largetext'>Ïîëíàÿ âåðñèÿ ýòîé ñòðàíèöû: <a href='{$tpl['full_version_link']}'>{$tpl['full_version']}</a></div>
<div class='nav'>{$tpl['nav']}</div>
{$tpl['pages']}
<div id='content'>
{$tpl['content']}
</div>
{$tpl['pages']}
<div class='smalltext'>Äëÿ ïðîñìîòðà ïîëíîé âåðñèè ýòîé ñòðàíèöû, ïîæàëóéñòà, <a href='{$tpl['full_version_link']}'>ïðîéäèòå ïî ññûëêå</a>.</div>
</div>
</body>
</html>
HTML;
echo $textversion;
}
function tpl_forums_page ($forums)
{
return <<<HTML
<div class='forumwrap'>
<ul>
$forums
</ul>
</div>
HTML;
}
function tpl_forum_page ($topics)
{
return <<<HTML
<div class='topicwrap'>
<ol>
$topics
</ol>
</div>
HTML;
}
function tpl_pages ($cstart, $count_all, $inpage, $url)
{
$pages_count = @ceil($count_all / $inpage);
$pages_start_from = 0;
$pages = "";
for ($j=1; $j <= $pages_count; $j++)
{
if ($pages_start_from != $cstart)
{
$pages .= "<a href=\"{$url}-{$j}\">{$j}</a> ";
}
else
{
$pages .= " <b>{$j}</b> ";
}
$pages_start_from += $inpage;
}
return ("<div class='pagespan'><b>Ñòðàíèöû:</b> {$pages}</div>");
}
function tpl_category ($id, $name)
{
return ("\n<li><strong><a href='?c{$id}'>{$name}</a></strong></li>\n<ul>");
}
function tpl_category_end ()
{
return ("\n</ul></li>");
}
function tpl_forum ($id, $name, $post, $sub = false)
{
if ($sub)
{
$sub_tpl = "\n<li><ul>{$sub}</ul></li>\n";
}
return ("\n<li><a href='?f{$id}'>{$name}</a> <span class='desc'>({$post} ñîîáùåíèé)</span></li>".$sub_tpl);
}
function tpl_forum_sub ($id, $name)
{
return ("\n<li><a href='?f{$id}'>{$name}</a></li>");
}
function tpl_post ($post, $author, $date)
{
return <<<HTML
<div class='postwrapper'>
<div class='posttopbar'>
<div class='postname'>{$author}</div>
<div class='postdate'>{$date}</div>
</div>
<div class='postcontent'>{$post}</div>
</div>
HTML;
}
function tpl_topic_list ($id, $n_pre, $name, $post)
{
return ("\n<li>{$n_pre}<a href='?t{$id}'>{$name}</a> <span class='desc'>({$post} îòâåòîâ)</span></li>");
}
?>
+96
View File
@@ -0,0 +1,96 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
if ($is_logged)
{
if ($_REQUEST['code'] == "01")
{
$db->query("UPDATE " . PREFIX . "_users SET forum_last = '$_TIME', forum_time = '$_TIME' WHERE name = '$member_id[name]'");
$db->query("DELETE FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$_SESSION['forum_last'] = $_TIME;
@header("Location: {$forum_url}");
}
if ($cstart)
{
$cstart = $cstart - 1;
$cstart = $cstart * $forum_config['topic_inpage'];
}
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$topic_views = array();
while ($row = $db->get_row($row_views))
{
$topic_views[$row['topic_id']] = '1';
}
$config_inpage = $forum_config['topic_inpage'];
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_topics WHERE UNIX_TIMESTAMP(last_date) > '$lasttime' and hidden = 0 LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
if (!$is_topics)
{
$msg_info = $f_lang['is_topics'];
}
$get_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE UNIX_TIMESTAMP(last_date) > '$lasttime' and hidden = 0");
$count_all = $get_count['count'];
$icat = $forum_url."/getnew/";
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
$tpl->load_template($tpl_dir.'forum.tpl');
$tpl->set('{banner}', '');
$tpl->set('{forum}', $f_lang['getnew_title']);
$tpl->set('{subforums}','');
$tpl->set('{topics}', $tpl->result['topics']);
$tpl->set('{info}', $msg_info);
$tpl->set('{navigation}', $tpl->result['navigation']);
$all_read_link = "<a href=\"{$a_forum_url}act=getnew&code=01\">{$f_lang['all_read_link']}</a>";
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si", $all_read_link);
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['f_msg'], $f_lang['page_deny'], 'user_group', $group_name);
}
$bbr_app = $f_lang['app_getnew'];
?>
+250
View File
@@ -0,0 +1,250 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if (isset($_REQUEST['search_text']))
{
$search_text = substr ( strip_data( $_REQUEST['search_text'] ), 0, 90 );
$search_text_explode = explode (' ', $search_text);
if (count($search_text_explode))
{
foreach ($search_text_explode as $key => $value)
{
$value = trim ($value);
if ($value !== "" and strlen($value) > 3)
{
$search_text_array[] = $value;
}
}
if (count($search_text_array))
{
$search_list = implode('|', $search_text_array);
}
}
}
$search_fid = $_REQUEST['search_fid'];
$count_all = intval($_REQUEST['count_all']);
if ($forum_config['search_captcha'])
{
$search_captcha = check_access($forum_config['search_captcha']);
}
if ($search_captcha)
{
if ($_REQUEST['sec_code'])
{
$_SESSION['captcha_search'] = $_REQUEST['sec_code'];
}
if ($_SESSION['captcha_search'] == $_SESSION['sec_code_session'])
{
$search_captcha_true = TRUE;
}
}
else
{
$search_captcha_true = TRUE;
}
if ($search_list AND $search_captcha_true)
{
if ($search_fid)
{
$_SESSION['search_fid'] = $search_fid;
}
if ($is_logged)
{
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$topic_views = array();
while ($row = $db->get_row($row_views))
{
$topic_views[$row['topic_id']] = '1';
}
}
else
{
$row_views = explode(",", $_COOKIE['dle_forum_views']);
foreach ($row_views as $value)
{
$topic_views[$value] = '1';
}
}
if ($cstart){
$cstart = $cstart - 1;
$cstart = $cstart * $forum_config['topic_inpage'];
}
$config_inpage = $forum_config['topic_inpage'];
if ($search_fid)
{
if (is_array($search_fid))
{
$hole_arr = array();
foreach ($search_fid as $hole)
{
$hole_arr[] = intval($hole);
}
$fid_list = implode(',', $hole_arr);
}
else
{
$fid_list = intval($search_fid);
}
}
$fid_q = $fid_list ? "and forum_id IN ({$fid_list}) " : "";
if ($_REQUEST['search_in'] == "titles")
{
$mysql_query = "SELECT * FROM " . PREFIX . "_forum_topics
WHERE title REGEXP ('$search_list') ".$fid_q."and hidden = 0
OR topic_descr REGEXP ('$search_list') ".$fid_q."and hidden = 0";
$count_query = "SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics
WHERE title REGEXP ('$search_list') ".$fid_q."and hidden = 0
OR topic_descr REGEXP ('$search_list') ".$fid_q."and hidden = 0";
}
else
{
$mysql_query = "SELECT p.*, t.* FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . PREFIX . "_forum_topics AS t ON t.tid = p.topic_id
WHERE p.post_text REGEXP ('$search_list') ".$fid_q."and p.hidden = 0 GROUP BY t.tid";
$count_query = "SELECT SQL_CALC_FOUND_ROWS * FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . PREFIX . "_forum_topics AS t
ON t.tid = p.topic_id
WHERE p.post_text REGEXP ('$search_list') ".$fid_q."and p.hidden = 0 GROUP BY t.tid";
}
$result_topics = $db->query("" . $mysql_query . " LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
if (!$count_all)
{
if ($_REQUEST['search_in'] == "titles")
{
$count_get = $db->super_query ($count_query);
$count_all = $count_get['count'];
}
else
{
$count_all = $db->num_rows($db->query($count_query));
}
}
if ($count_all){
if ($forum_config['mod_rewrite'])
{
$icat = $forum_url . "/search/" . $count_all . "-" . urlencode($search_text) ."/";
}
else
{
$icat = $forum_url."act=search&count_all=".$count_all."&search_text=".urlencode($search_text)."&cstart=";
}
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
$tpl->load_template($tpl_dir.'forum.tpl');
$tpl->set('{forum}', $f_lang['search_result']);
$tpl->set('{subforums}','');
$tpl->set('{topics}', $tpl->result['topics']);
$tpl->set('{info}', $msg_info);
$tpl->set('{navigation}', $tpl->result['navigation']);
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si", '');
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['search_nresult']);
}
}
elseif ($_REQUEST['search_text'] and $search_maxlen)
{
forum_msg($f_lang['f_msg'], $f_lang['search_error']);
}
else
{
$_SESSION['search_fid'] = "";
$tpl->load_template($tpl_dir.'search.tpl');
$tpl->copy_template = "<form method=\"post\" action=\"\">".$tpl->copy_template."</form>";
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_category LEFT JOIN ". PREFIX ."_forum_forums ON ". PREFIX ."_forum_category.sid=". PREFIX ."_forum_forums.main_id ORDER BY posi, position");
$select_list = "<select name='search_fid[]' size='10' multiple='multiple'>";
$select_list .= "<option value='0' selected='selected'>&raquo; Âñå ôîðóìû</option>";
for ($i = 0, $totalcount = 0; $row = $db->get_row($result); $i = $row['sid'], $chcount++)
{
if ($row['sid'] != $i)
{
$row['cat_name'] = stripslashes($row['cat_name']);
$select_list .= "<optgroup label=\"{$row['cat_name']}\">";
}
if ($row['name'])
{
$row['name'] = stripslashes($row['name']);
$select_list .= "<option value=\"{$row['id']}\"> -- {$row['name']}</option>";
}
}
$select_list .= "</select>";
$tpl->set('{forum_select}',$select_list);
$tpl->compile('dle_forum');
$tpl->clear();
}
$bbr_app = $f_lang['app_search'];
?>
+113
View File
@@ -0,0 +1,113 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$act = $_REQUEST['act'];
if ($forum_config['stats'] AND !$act)
{
$stats_array = array();
$today_date = date('d');;
$stats_array = $fcache->get('stats');
if (!$stats_array OR $stats_array['date'] != $today_date)
{
$stats_array = FALSE;
$stats_array = array();
$row_post = $db->super_query("SELECT COUNT(pid) as count FROM " . PREFIX . "_forum_posts");
$stats_array['posts'] = $row_post['count'];
$row_topic = $db->super_query("SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics");
$stats_array['topics'] = $row_topic['count'];
$row_users_reg = $db->super_query("SELECT COUNT(user_id) as count FROM " . PREFIX . "_users");
$stats_array['users_reg'] = $row_users_reg['count'];
$row_users = $db->super_query("SELECT COUNT(user_id) as count FROM " . PREFIX . "_users WHERE forum_post");
$stats_array['users'] = $row_users['count'];
$result_users = $db->query("SELECT * FROM " . PREFIX . "_users WHERE forum_post ORDER BY forum_post DESC LIMIT 10");
while ($row = $db->get_row($result_users))
{
$top_count++;
if ($top_count > 1)
{
$symbol = ", ";
}
$group_span = $user_group[$row['user_group']]['colour'];
$a_top_users = "{$config['http_home_url']}user/".urlencode($row['name'])."/";
$stats_array['top_users'] .= $symbol."<a href=\"{$a_top_users}\"><span style=\"color:{$group_span}\">$row[name]</span></a>";
}
if (!$stats_array['top_users'])
{
$stats_array['top_users'] = "--";
}
$stats_array['date'] = $today_date;
$last_user_row = $db->super_query("SELECT * FROM " . PREFIX . "_users ORDER BY user_id DESC LIMIT 1");
$stats_array['last_user'] = link_user($last_user_row['name']);
$stats_array['max_online'] = $max_online['count'];
$stats_array['max_online_time'] = langdate('j F Y, H:i', $max_online['time']);
$fcache->set('stats', $stats_array);
}
// tpl compile //
$tpl->load_template($tpl_dir.'stats.tpl');
if ($forum_config['online'] and $forum_config['sessions_log'])
{
get_forum_online();
$tpl->set('[online-stats]','');
$tpl->set('[/online-stats]','');
}
else
{
$tpl->set_block("'\\[online-stats\\](.*?)\\[/online-stats\\]'si","");
}
$tpl->set('{post-num}', $stats_array['posts']);
$tpl->set('{topic-num}', $stats_array['topics']);
$tpl->set('{all-users}', $stats_array['users_reg']);
$tpl->set('{forum-users}', $stats_array['users']);
$tpl->set('{top-users}', $stats_array['top_users']);
$tpl->set('{online-num}', $forum_online['all_count']);
$tpl->set('{member_count}', $forum_online['member_count']);
$tpl->set('{guest_count}', $forum_online['guest_count']);
$tpl->set('{online_time}', $forum_config['session_time']);
if (!$forum_online['member_list'])
{
$forum_online['member_list'] = ""; // default value: --
}
$tpl->set('{member_online}', $forum_online['member_list']);
$tpl->set('{last_user}', $stats_array['last_user']);
$tpl->set('{max_online}', $stats_array['max_online']);
$tpl->set('{max_online_time}', $stats_array['max_online_time']);
$tpl->compile('forum_stats');
$tpl->clear();
}
?>
@@ -0,0 +1,154 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$code = $_REQUEST['code'];
$tid = intval($_REQUEST['tid']);
$selected_id = $_REQUEST['selected_id'];
if ($is_logged)
{
switch ($code)
{
// ********************************************************************************
// ADD
// ********************************************************************************
case "add":
$db->query("SELECT * FROM " . PREFIX . "_forum_subscription WHERE topic_id = '$tid' and user_id = '{$member_id['user_id']}'");
if (!$db->num_rows() and $tid)
{
$db->query("INSERT INTO " . PREFIX . "_forum_subscription (user_id, topic_id) values ('{$member_id['user_id']}', '$tid')");
}
header("Location: $_SERVER[HTTP_REFERER]");
break;
// ********************************************************************************
// DEL
// ********************************************************************************
case "del":
if ($selected_id)
{
$selected_id = explode(",", $selected_id);
foreach ($selected_id as $topic_id)
{
$db->query("DELETE FROM " . PREFIX . "_forum_subscription WHERE topic_id = '$topic_id' and user_id = '{$member_id['user_id']}'");
}
}
header("Location: $_SERVER[HTTP_REFERER]");
break;
// ********************************************************************************
// SUBSCRIPTION
// ********************************************************************************
default:
if ($cstart)
{
$cstart = $cstart - 1;
$cstart = $cstart * $forum_config['topic_inpage'];
}
if ($forum_config['topic_sort'])
{
$sort_type = "last_date";
}
else
{
$sort_type = "tid";
}
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$topic_views = array();
while ($row = $db->get_row($row_views))
{
$topic_views[$row['topic_id']] = '1';
}
$config_inpage = $forum_config['topic_inpage'];
$result_count = $db->super_query("SELECT count(*) as count FROM " . PREFIX . "_forum_subscription LEFT JOIN " . PREFIX . "_forum_topics ON " . PREFIX . "_forum_subscription.topic_id = " . PREFIX . "_forum_topics.tid WHERE " . PREFIX . "_forum_subscription.user_id = '{$member_id['user_id']}'");
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_subscription LEFT JOIN " . PREFIX . "_forum_topics ON " . PREFIX . "_forum_subscription.topic_id = " . PREFIX . "_forum_topics.tid WHERE " . PREFIX . "_forum_subscription.user_id = '{$member_id['user_id']}'");
$mass_prune = true;
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
if (!$is_topics)
{
$msg_info = $f_lang['subscr_not'];
}
$tpl->load_template($tpl_dir.'forum.tpl');
$tpl->set('{banner}', '');
$tpl->set('{forum}', $f_lang['app_subscr']);
$tpl->set('{subforums}','');
$tpl->set('{topics}', $tpl->result['topics']);
$tpl->set('{info}', $msg_info);
$tpl->set('{navigation}', $tpl->result['navigation']);
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si","");
$tpl->set('[selected]',"");
$tpl->set('[/selected]',"");
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
$tpl->set('[moderation]',"<form name=\"modform\" method=\"post\" action=\"\">"); //{$a_forum_url}act=subscription
$moderation = "<select name=\"code\">";
$moderation .= "<option value=\"del\">Îòïèñàòüñÿ</option>";
$moderation .= "</select>";
$tpl->set('{moderation}', $moderation);
$tpl->set('[/moderation]',"<input type=\"hidden\" value=\"\" name=\"selected_id\" /></form>");
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
$tpl->compile('dle_forum');
$tpl->clear();
break;
}
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['f_msg'], $f_lang['page_deny'], 'user_group', $group_name);
}
if ($forum_config['forum_bar'])
{
$bbr_app = $f_lang['app_subscr'];
}
?>
+375
View File
@@ -0,0 +1,375 @@
<?php
@session_start();
error_reporting(7);
ini_set('display_errors', true);
ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define('ROOT_DIR', '../../../..');
define('SYSTEM_DIR', ROOT_DIR.'/system');
define('UPLOAD_DIR', ROOT_DIR."/uploads/forum/");
require SYSTEM_DIR."/data/config.php";
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR."/data/dbconfig.php";
require_once SYSTEM_DIR."/modules/functions.php";
require_once SYSTEM_DIR.'/data/forum_config.php';
$allowed_video = array("avi", "mp4", "wmv", "mpg", "flv");
// ********************************************************************************
// File Type
// ********************************************************************************
function file_type($name){
$type = explode ('.', $name);
$type = end ($type);
return ($type);
}
check_xss ();
$area = $_REQUEST['area'];
$do = $_REQUEST['do'];
$fid = intval($_REQUEST['fid']);
$tid = intval($_REQUEST['tid']);
$pid = intval($_REQUEST['pid']);
$del = $_REQUEST['del'];
$user_group = $cache->get ("usergroup");
if (!$user_group) {
$user_group = array ();
$db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
while($row = $db->get_row()){
$user_group[$row['id']] = array ();
foreach ($row as $key => $value)
{
$user_group[$row['id']][$key] = $value;
}
}
$cache->set ("usergroup", $user_group);
$db->free();
}
include_once SYSTEM_DIR.'/modules/sitelogin.php';
$result = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = '$fid'");
$access_upload = $result['access_upload'];
$access_upload = explode(":", $access_upload);
if (!in_array($member_id['user_group'], $access_upload)){die("Hacking attempt!");}
$access_mod = $result['access_mod'];
$access_mod = explode(":", $access_mod);
if (!in_array($member_id['user_group'], $access_mod))
{
$db_file_author = " AND file_author = '{$member_id['name']}'";
}
else
{
$db_file_author = "";
}
$forum_config['tools_upload'] = explode (':', $forum_config['tools_upload']);
if ($forum_config['tools_upload'])
{
if (in_array($member_id['user_group'], $forum_config['tools_upload']))
{
$upload_file_access = TRUE;
} else
{
$upload_file_access = FALSE;
}
}
// TPL //
echo <<<HTML
<html>
<head>
<title>Uploads</title>
</head>
<style type="text/css" media="all">
.dle_forum {
background-color: #FFF;
font-family: verdana;
font-size: 11px;
color: #222;
}
.dle_forum a:link, .dle_forum a:active, .dle_forum a:visited {
color: #222;
text-decoration: underline;
}
.dle_forum a:hover {
color: #34498B;
}
.button {
background-color: #fff;
border: 1px solid #B4B4B4;
color: #000;
font-family: verdana;
font-size: 11px;
padding: 1px;
}
.forum_input {
background-color: #fff;
border: 1px solid #B4B4B4;
color: #000;
font-family: verdana;
font-size: 11px;
}
</style>
<body class="dle_forum">
HTML;
echo <<<HTML
<script language="javascript" type="text/javascript">
function insertfile(selected_id)
{
attachment = "[attachment=" + selected_id + "]";
parent.doInsert(attachment, '', false); window.focus();
};
function insertaudio(onserver)
{
audio = "[audio=" + onserver + "]";
parent.doInsert(audio, '', false); window.focus();
};
function insertvideo(onserver)
{
video = "[video=" + onserver + "]";
parent.doInsert(video, '', false); window.focus();
};
</script>
HTML;
$DIR = 0;
$is_file = 0;
$is_image = 0;
$send_link = "?area=$area&fid=$fid&tid=$tid&pid=$pid";
$maxupload = mksize($forum_config['img_size']*1024);
if ($do == "add")
{
$allowed_images = array("gif", "jpg", "png", "jpe", "jpeg");
$allowed_files = explode(',', $forum_config['upload_type']);
$file_name = totranslit($_FILES['attachment']['name']);
$file_explode = explode(".",$file_name);
$file_type = strtolower(end($file_explode));
$attachment_size = $_FILES['attachment']['size'];
if (in_array($file_type, $allowed_images) AND $forum_config['img_upload']){
if ($attachment_size < ($forum_config['img_size']*1024)){
$is_image = TRUE;
$DIR = "images/";
}else{
$image_size_error = true;
}
}
if (in_array($file_type, $allowed_files) AND $upload_file_access){
$is_file = TRUE;
$DIR = "files/";
}
if ($is_file OR $is_image){
$uploadfile = UPLOAD_DIR.$DIR.basename($file_name);
if (move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile)){
$file_name = totranslit($_FILES['attachment']['name']);
$file_size = $_FILES['attachment']['size'];
}
if (file_exists(UPLOAD_DIR . $DIR . $file_name)){
if ($is_file){
$ftype = 'file';
$file_rename = time()."_".totranslit($file_name);
}else{
$ftype = 'image';
$file_rename = time().".".$file_type;
}
rename(UPLOAD_DIR . $DIR . $file_name, UPLOAD_DIR . $DIR . $file_rename);
if ($is_image)
{
include_once SYSTEM_DIR.'/classes/thumb.class.php';
$thumb = new thumbnail(UPLOAD_DIR.$DIR.$file_rename);
if ($thumb->size_auto($forum_config['thumb_size']))
{
$thumb->jpeg_quality($forum_config['jpeg_quality']);
$thumb->save(UPLOAD_DIR."thumbs/".$file_rename);
$ftype = 'thumb';
@chmod (UPLOAD_DIR."thumbs/".$file_rename, 0666);
}
}
$db->query("INSERT INTO " . PREFIX . "_forum_files (file_type, forum_id, topic_id, post_id, file_name, onserver, file_author, file_date, file_size) values ('$ftype', '$fid', '$tid', '$pid', '$file_name', '$file_rename', '$member_id[name]' , '".time()."', '$file_size')");
@chmod (UPLOAD_DIR.$DIR.$file_rename, 0666);
$upload_info = "<font color=\"green\">Ôàéë <b>$file_name</b> çàãðóæåí.</font>";
}
else
{
$upload_info = "<font color=\"red\">Íåâîçìîæíî çàãðóçèòü ôàéë íà ñåðâåð!</font>";
}
}
else
{
if ($image_size_error)
{
$upload_info = "<font color=\"red\">Ñëèøêîì áîëüøîå èçîáðàæåíèå!</font>";
}
else
{
$upload_info = "<font color=\"red\">Íå äîïóñòèìûé ôîðìàò ôàéëà!</font>";
}
}
}
if ($do == "del" and $del)
{
foreach ($del as $file_id)
{
$file_id = intval($file_id);
if ($file_id) $del_id[$file_id] = $file_id;
}
$del_list = implode(',', $del_id);
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE file_id IN ({$del_list})".$db_file_author);
while ($row = $db->get_row($result))
{
if ($row['file_type'] == "file")
{
unlink(UPLOAD_DIR."files/".$row['onserver']);
}
elseif ($row['file_type'] == "thumb")
{
unlink(UPLOAD_DIR."thumbs/".$row['onserver']);
unlink(UPLOAD_DIR."images/".$row['onserver']);
}
else
{
unlink(UPLOAD_DIR."images/".$row['onserver']);
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE file_id = '$row[file_id]' LIMIT 1");
}
}
echo "<fieldset>";
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"$send_link&do=add\"><br />";
echo "<input class=\"forum_input\" name=\"attachment\" type=\"file\" style=\"width:200px\" />";
echo "&nbsp;";
echo "<input class=\"button\" value=\"Çàãðóçèòü\" type=\"submit\" style=\"background-color:#53E490;\" />";
echo "</form>";
if (!$upload_info) $upload_info = "Ìàêñèìàëüíûé ðàçìåð äëÿ îäíîãî ôàéëà: <b>$maxupload</b>";
echo "<p>$upload_info</p>";
echo "</fieldset><br />";
echo "<fieldset><legend><strong>Çàãðóæåííûå ôàéëû</strong></legend>";
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"$send_link&do=del\">";
echo "<table class=\"dle_forum\" width=\"100%\">";
$db->query("SELECT * FROM " . PREFIX . "_forum_files
WHERE topic_id = '$tid' AND file_attach = '0'".$db_file_author." OR post_id = '$pid'".$db_file_author);
while ($row = $db->get_row())
{
$file_title = mksize($row['file_size'])." (Çàãðóçèë: {$row['file_author']})";
$on_server = $config['http_home_url'].'uploads/forum/files/'.$row['onserver'];
$type = file_type($row['onserver']);
if ($type == 'mp3')
{
$insert_ob = " <a OnClick=\"insertaudio('".$on_server."')\" href=\"#\">[audio]</a>";
}
elseif(in_array($type, $allowed_video))
{
$insert_ob = " <a OnClick=\"insertvideo('".$on_server."')\" href=\"#\">[video]</a>";
}
else
{
$insert_ob = "";
}
echo "<tr>
<td width=\"85%\"><a title=\"$file_title\" OnClick=\"insertfile('".$row['file_id']."')\" href=\"#\">$row[file_name]</a>{$insert_ob}</td>
<td width=\"10%\">&nbsp;</td>
<td width=\"5%\"><input type=checkbox name=\"del[".$row['file_id']."]\" value=\"".$row['file_id']."\"></td>
</tr>";
$row_count++;
}
echo "</table>";
if ($row_count){
echo "<hr /><div align=\"right\"><input class=\"button\" value=\"Óäàëèòü\" type=\"submit\" style=\"background-color:#FF9999;\" /></div>";
}
else
{
echo "<br />Íè îäíîãî ôàéëà íå çàãðóæåíî.";
}
echo "</form>";
echo "</fieldset>";
echo <<<HTML
</body>
</html>
HTML;
?>

Some files were not shown because too many files have changed in this diff Show More