@ -0,0 +1,30 @@
|
||||
<?
|
||||
include_once '/system/data/config.php';
|
||||
|
||||
echo <<<HTML
|
||||
<html>
|
||||
<head><title>404 » {$config['home_title']}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
|
||||
<link rel="Shortcut Icon" type="image/x-icon" href="http://files-sib.net/favicon.ico" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<style type="text/css">
|
||||
body {color: #000;font-family: 'lucida grande','Lucida Sans Unicode', Tahoma, sans-serif;font-size: 75%;line-height: 1.7;margin: 0;padding: 0;font-size: small;background: #dbf3fc;}
|
||||
p {margin: 0.5em 0 0 0;line-height: 1.6em;}
|
||||
a,a:link,a:visited,a:active {text-decoration: none;color: #2786c2;}
|
||||
a:hover {text-decoration: none;color: #ff0084;}
|
||||
#Content .SplashInfo {margin: 80px 0;border-top: 1px solid #a5d0e7;border-bottom: 1px solid #a5d0e7;background: #e2f4ff;}
|
||||
#Content .SplashInfo h1 {font-family: "Helvetica Neue",Helvetica,arial,sans-serif;background: transparent;text-align: center;border: none;border-top: 1px solid #fff;color:#02455B;font-size:300%;text-shadow:0 1px 0 #FFFFFF;padding: 10px 0 0;margin: 0;line-height: 1;}
|
||||
#Content .SplashInfo p {font-family: "Helvetica Neue",Helvetica,arial,sans-serif;text-align: center;border-bottom: 1px solid #fff;margin: 0;padding: 0 0 10px;color: #076C8E;font-size: 20px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="Content"><div class="SplashInfo">
|
||||
<h1>Óïñ...</h1>
|
||||
<p>Çàïðàøèâàåìàÿ ñòðàíèöà íå íàéäåíà
|
||||
<div align="center">Ê ñîæàëåíèþ, òàêîé ñòðàíèöû íå ñóùåñòâóåò.<br> Âåðîÿòíî, îíà áûëà óäàëåíà ñ ñåðâåðà, ëèáî åå çäåñü íèêîãäà íå áûëî.<br>
|
||||
Âïðî÷åì, åñëè âû óâåðåíû, ÷òî ñòðàíèöà äîëæíà áûòü, ñîîáùèòå íàì îá ýòîì, ìû ðàçáåð¸ìñÿ. </div></p><p><a href="{$config['http_home_url']}">Íà ãëàâíóþ</a></p>
|
||||
</div></div>
|
||||
</body></html>
|
||||
HTML;
|
||||
|
||||
?>
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
@session_start ();
|
||||
@ob_start ();
|
||||
@ob_implicit_flush ( 0 );
|
||||
|
||||
if( !defined( 'E_DEPRECATED' ) ) {
|
||||
error_reporting ( E_ALL ^ E_NOTICE );
|
||||
@ini_set ( 'error_reporting', E_ALL ^ E_NOTICE );
|
||||
} else {
|
||||
error_reporting ( E_ALL ^ E_DEPRECATED ^ E_NOTICE );
|
||||
@ini_set ( 'error_reporting', E_ALL ^ E_DEPRECATED ^ E_NOTICE );
|
||||
}
|
||||
|
||||
@ini_set ( 'display_errors', true );
|
||||
@ini_set ( 'html_errors', false );
|
||||
|
||||
define ( 'DATALIFEENGINE', true );
|
||||
define ( 'ROOT_DIR', dirname ( __FILE__ ) );
|
||||
define ( 'SYSTEM_DIR', ROOT_DIR . '/system' );
|
||||
|
||||
$check_referer = true;
|
||||
require_once (SYSTEM_DIR . '/inc/include/init.php');
|
||||
|
||||
if ($is_loged_in == FALSE) {
|
||||
echoheader ( "home", "Login" );
|
||||
|
||||
if( ! $handle = opendir( "./language" ) ) {die( "Íåâîçìîæíî îòêðûòü äèðåêòîðèþ ./data/language/" );}
|
||||
|
||||
while ( false !== ($file = readdir( $handle )) ) {
|
||||
if( is_dir( ROOT_DIR . "/language/$file" ) and ($file != "." and $file != "..") ) {
|
||||
$sys_con_langs_arr[$file] = $file;
|
||||
}
|
||||
}closedir( $handle );
|
||||
|
||||
$select_language = makeDropDown( $sys_con_langs_arr, "selected_language", $selected_language );
|
||||
|
||||
echo $skin_login;
|
||||
|
||||
echofooter ();
|
||||
exit ();
|
||||
} elseif ($is_loged_in == TRUE) {
|
||||
|
||||
if ( !$mod ) {
|
||||
include (SYSTEM_DIR . '/inc/main.php');
|
||||
} elseif ( @file_exists( SYSTEM_DIR . '/inc/' . $mod . '.php' ) ) {
|
||||
include (SYSTEM_DIR . '/inc/' . $mod . '.php');
|
||||
} else {
|
||||
$db->close ();
|
||||
msg ( "error", $lang['index_denied'], $lang['mod_not_found'] );
|
||||
}
|
||||
}
|
||||
|
||||
$db->close ();
|
||||
|
||||
GzipOut ();
|
||||
?>
|
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
@session_start ();
|
||||
|
||||
define ( 'DATALIFEENGINE', true );
|
||||
define ( 'TORRENT_DIR', './uploads/torrents/' );
|
||||
define( 'SYSTEM_DIR' , './system' );
|
||||
|
||||
@error_reporting (0);
|
||||
|
||||
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';
|
||||
|
||||
$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 ();
|
||||
}
|
||||
|
||||
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'] );
|
||||
|
||||
$d_time = time() + ($config['date_adjust'] * 60);
|
||||
$row = $db->super_query ( "SELECT name, onserver, info_hash FROM " . PREFIX . "_torrents WHERE id ='$id'" );
|
||||
|
||||
if (! $row) die ( "Access denied" );
|
||||
|
||||
if(substr($row['name'], -8) == ".torrent") {
|
||||
require_once( SYSTEM_DIR."/classes/torrent.class.php" );
|
||||
$tr_file = TORRENT_DIR.$row['onserver'];
|
||||
$torrent = new Torrent($tr_file);
|
||||
if($error = $torrent->errors()){
|
||||
}
|
||||
else
|
||||
{
|
||||
$torrent->comment("http://".$_SERVER['HTTP_HOST']."/");
|
||||
|
||||
if (! $is_logged) {
|
||||
$torrent->announce("http://".$_SERVER['HTTP_HOST'].":2710/announce"); //Äîáàâëÿåì äîïîëíèòåëüíûå àíîíñåðû, îñòàâëÿÿ óæå äîáàâëåííûå
|
||||
} else {
|
||||
$tpv = $member_id['torrent_pass_version'];
|
||||
$tppk = $db->super_query("SELECT value FROM xbt_config WHERE name='torrent_pass_private_key'" );
|
||||
$site_key = $tppk['value'];
|
||||
$passkey = sprintf('%08x%s', $member_id['user_id'], substr(sha1(sprintf('%s %d %d %s', $site_key, $tpv, $member_id['user_id'], $row['info_hash'])), 0, 24));
|
||||
$torrent->announce("http://".$_SERVER['HTTP_HOST'].":2710/{$passkey}/announce"); //Äîáàâëÿåì äîïîëíèòåëüíûå àíîíñåðû, îñòàâëÿÿ óæå äîáàâëåííûå
|
||||
}
|
||||
}} else die ( "Access denied" );
|
||||
|
||||
if ($config['files_count'] == "yes" and ! $file->range) $db->query ( "UPDATE " . PREFIX . "_torrents SET dcount=dcount+1 WHERE id ='$id'" );
|
||||
|
||||
$db->close ();
|
||||
|
||||
$torrent->send($row['name']);
|
||||
?>
|
After Width: | Height: | Size: 3.6 KiB |
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
@session_start ();
|
||||
@ob_start ();
|
||||
@ob_implicit_flush ( 0 );
|
||||
|
||||
define ( 'DATALIFEENGINE', true );
|
||||
|
||||
$member_id = FALSE;
|
||||
$is_logged = FALSE;
|
||||
|
||||
define ( 'ROOT_DIR', dirname ( __FILE__ ) );
|
||||
define ( 'SYSTEM_DIR', ROOT_DIR . '/system' );
|
||||
|
||||
require_once ROOT_DIR . '/system/init.php';
|
||||
require_once ROOT_DIR.'/system/modules/forum/show.last.php';
|
||||
|
||||
if (clean_url ( $_SERVER['HTTP_HOST'] ) != clean_url ( $config['http_home_url'] )) {$replace_url = array ();$replace_url[0] = clean_url ( $config['http_home_url'] );$replace_url[1] = clean_url ( $_SERVER['HTTP_HOST'] );} else $replace_url = false;
|
||||
|
||||
if ($do=="forum") $tpl->load_template('forum/index.tpl');
|
||||
else $tpl->load_template('main.tpl');
|
||||
|
||||
$tpl->set('{toporders}', $toporders);
|
||||
$tpl->set ( '{login}', $tpl->result['login_panel'] );
|
||||
$tpl->set ( '{info}', "<div id='dle-info'>" . $tpl->result['info'] . "</div>" );
|
||||
$tpl->set('{online}', $tpl->result['online']);
|
||||
$tpl->set ( '{minichat}', $tpl->result['minichat'] );
|
||||
$tpl->set('{forum}', $tpl->result['forum_table']);
|
||||
$tpl->set ( '{comments-last}', $commentslast );
|
||||
$tpl->set('{category_menu}', $cat_menu);
|
||||
|
||||
if ($allow_active_news AND $do != "userinfo") {$tpl->set ( '[sort]', "" );$tpl->set ( '{sort}', news_sort ( $do ) );$tpl->set ( '[/sort]', "" );} else {$tpl->set_block ( "'\\[sort\\](.*?)\\[/sort\\]'si", "" );}
|
||||
if ($dle_module == "showfull" ) {if (is_array($cat_list) AND count($cat_list) > 1 ) $category_id = implode(",", $cat_list);}
|
||||
|
||||
if (strpos ( $tpl->copy_template, "[category=" ) !== false) {$tpl->copy_template = preg_replace ( "#\\[category=(.+?)\\](.*?)\\[/category\\]#ies", "check_category('\\1', '\\2', '{$category_id}')", $tpl->copy_template );}
|
||||
if (strpos ( $tpl->copy_template, "[not-category=" ) !== false) {$tpl->copy_template = preg_replace ( "#\\[not-category=(.+?)\\](.*?)\\[/not-category\\]#ies", "check_category('\\1', '\\2', '{$category_id}', false)", $tpl->copy_template );}
|
||||
|
||||
$config['http_home_url'] = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) );
|
||||
$config['http_home_url'] = reset ( $config['http_home_url'] );
|
||||
|
||||
if (! $user_group[$member_id['user_group']]['allow_admin']) $config['admin_path'] = "";
|
||||
|
||||
$ajax .= <<<HTML
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
var dle_root = '{$config['http_home_url']}';
|
||||
var dle_admin = '{$config['admin_path']}';
|
||||
var dle_login_hash = '{$dle_login_hash}';
|
||||
var dle_skin = '{$config['skin']}';
|
||||
var dle_group = {$member_id['user_group']};
|
||||
var menu_short = '{$lang['menu_short']}';
|
||||
var menu_full = '{$lang['menu_full']}';
|
||||
var menu_profile = '{$lang['menu_profile']}';
|
||||
var menu_fnews = '{$lang['menu_fnews']}';
|
||||
var menu_fcomments = '{$lang['menu_fcomments']}';
|
||||
var menu_send = '{$lang['menu_send']}';
|
||||
var menu_uedit = '{$lang['menu_uedit']}';
|
||||
var dle_req_field = '{$lang['comm_req_f']}';
|
||||
var dle_del_agree = '{$lang['news_delcom']}';
|
||||
var dle_del_news = '{$lang['news_delnews']}';
|
||||
HTML;
|
||||
|
||||
$ajax .= <<<HTML
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript" src="{$config['http_home_url']}system/js/jquery.js"></script>
|
||||
<script type="text/javascript" src="{$config['http_home_url']}system/js/main.js"></script>
|
||||
<div id="loading-layer" style="display:none"><div id="loading-layer-text"><img src="{THEME}/images/ajax-loader.gif" alt="Загрузка..."></div></div>
|
||||
HTML;
|
||||
|
||||
if (strpos ( $tpl->result['content'], "hs.expand" ) !== false or strpos ( $tpl->copy_template, "hs.expand" ) !== false or $pm_alert != "") {
|
||||
$ajax .= <<<HTML
|
||||
<script type="text/javascript" src="{$config['http_home_url']}system/js/highslide.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
hs.dimmingOpacity = 0.80;
|
||||
hs.graphicsDir = '{THEME}/images/';
|
||||
hs.align = 'center';
|
||||
hs.outlineType = 'rounded-white';
|
||||
hs.numberOfImagesToPreload = 0;
|
||||
hs.showCredits = false;
|
||||
//-->
|
||||
</script>
|
||||
{$pm_alert}
|
||||
HTML;
|
||||
}
|
||||
$tpl->set ( '{AJAX}', $ajax );
|
||||
|
||||
if(isset($_GET['category'])){
|
||||
$tpl->set('[newslist]','');
|
||||
$tpl->set('{newslist}', "/newslist/".$_GET['category']."/");
|
||||
$tpl->set('{news_pol}', $_GET['category']."/");
|
||||
$tpl->set('[/newslist]','');
|
||||
} else{$tpl->set_block("'\[newslist\](.*?)\[/newslist\]'si",""); $tpl->set('{news_pol}', "");}
|
||||
|
||||
$tpl->set ( '{headers}', $metatags );
|
||||
$tpl->set ( '{content}', "<div id='dle-content'>" . $tpl->result['content'] . "</div>" );
|
||||
|
||||
$tpl->compile ( 'main' );
|
||||
$tpl->result['main'] = str_replace ( '{THEME}', $config['http_home_url'] . 'templates/' . $config['skin'], $tpl->result['main'] );
|
||||
if ($replace_url) $tpl->result['main'] = str_replace ( $replace_url[0]."/", $replace_url[1]."/", $tpl->result['main'] );
|
||||
$tpl->result['main'] = str_replace("%username%", $is_logged?$member_id['name']:'Юзер', $tpl->result['main']);
|
||||
|
||||
echo $tpl->result['main'];
|
||||
$tpl->global_clear ();
|
||||
$db->close ();
|
||||
|
||||
GzipOut ();
|
||||
?>
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
define('ROOT_DIR', '.' );
|
||||
define('SYSTEM_DIR' , ROOT_DIR . '/system');
|
||||
require_once ( SYSTEM_DIR . '/data/config.php');
|
||||
include_once ( SYSTEM_DIR . '/classes/templates.class.php');
|
||||
|
||||
function reset_url($url) {
|
||||
$value = str_replace ( "https://", "", $url );
|
||||
$value = str_replace ( "http://", "", $url );
|
||||
$value = str_replace ( "www.", "", $value );
|
||||
$value = explode ( "/", $value );
|
||||
$value = reset ( $value );
|
||||
return $value;
|
||||
}
|
||||
|
||||
$url = rawurldecode ( $_GET['url'] );
|
||||
$url = @base64_decode ( $url );
|
||||
$url = str_replace ( "&", "&", $url );
|
||||
|
||||
$_SERVER['HTTP_REFERER'] = reset_url ( $_SERVER['HTTP_REFERER'] );
|
||||
$_SERVER['HTTP_HOST'] = reset_url ( $_SERVER['HTTP_HOST'] );
|
||||
|
||||
if (($_SERVER['HTTP_HOST'] != $_SERVER['HTTP_REFERER']) or $url == "") {
|
||||
@header ( 'Location: /index.php' );
|
||||
die ( "Access denied!!!<br /><br />Please visit <a href=\"/index.php\">{$_SERVER['HTTP_HOST']}</a>" );
|
||||
}
|
||||
|
||||
$tpl = new dle_template;
|
||||
$tpl->dir = ( ROOT_DIR.'/templates/');
|
||||
|
||||
$tpl->load_template('redirect.tpl');
|
||||
$tpl->set('{title}', $config['short_title']);
|
||||
$tpl->set('{home_url}', $config['http_home_url']);
|
||||
$tpl->set( '{url}', $url );
|
||||
$tpl->compile( 'redirect' );
|
||||
$tpl->clear();
|
||||
|
||||
echo $tpl->result['redirect'];
|
||||
die();
|
||||
|
||||
//@header ( 'Location: ' . $url );
|
||||
|
||||
//die ( "Link Redirect:<br /><br />Please click <a href=\"{$url}\">here.</a>" );
|
||||
?>
|
@ -0,0 +1,141 @@
|
||||
<?
|
||||
define('ROOT_DIR', dirname(__FILE__));
|
||||
define('RATING_DIR', ROOT_DIR."/uploads/rating/");
|
||||
header("Content-type: image/png");
|
||||
|
||||
$id = intval($_REQUEST['id']);
|
||||
$query = $_REQUEST['query'];
|
||||
|
||||
$file = RATING_DIR."{$query}/{$id}.png";
|
||||
$timelife = 86400;
|
||||
|
||||
if(file_exists($file)){
|
||||
$modif= time() - @filemtime($file);
|
||||
if($modif < $timelife)
|
||||
{
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
function show_error_image($error_text = "Some error with this image!"){
|
||||
$error_picture_width = strlen($error_text) * 7 + 12;
|
||||
$img = @imagecreatetruecolor($error_picture_width, 30) or die("Cannot Initialize new GD image stream");
|
||||
$text_color = imagecolorallocate($img, 255, 0, 0);
|
||||
imagestring($img, 3, 7, 8, $error_text, $text_color);
|
||||
header("Content-type: image/png");
|
||||
imagepng($img);
|
||||
imagedestroy($img);
|
||||
exit;
|
||||
}
|
||||
|
||||
if(strlen($id) > 6) show_error_image("The request can have maximum 6 characters");
|
||||
|
||||
if($query == 'game'){
|
||||
function get_xml($url)
|
||||
{
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, "");
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8");
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
|
||||
|
||||
$content = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
preg_match("!<ip_rate>(.*?)</ip_rate>!si", $content, $contens);
|
||||
$content = $contens[1];
|
||||
return $content;
|
||||
}
|
||||
|
||||
$content = get_xml("http://www.igropoisk.com/rating/{$id}.xml");
|
||||
|
||||
$pic = imagecreatefrompng(RATING_DIR."game.png");
|
||||
$color = ImageColorAllocate($pic, 255, 255, 255);
|
||||
imagealphablending($pic, true);
|
||||
|
||||
imagestring($pic, 3, 6, 19, $content, $color);
|
||||
|
||||
} elseif ($query == 'film'){
|
||||
function subX($dbl){
|
||||
switch ($dbl) {
|
||||
case 1:
|
||||
return 9;
|
||||
break;
|
||||
case 2:
|
||||
return 8;
|
||||
break;
|
||||
case 3:
|
||||
return 7;
|
||||
break;
|
||||
case 4:
|
||||
return 6;
|
||||
break;
|
||||
case 5:
|
||||
return 5;
|
||||
break;
|
||||
case 6:
|
||||
return 4;
|
||||
break;
|
||||
case 7:
|
||||
return 4;
|
||||
break;
|
||||
case 8:
|
||||
return 3;
|
||||
break;
|
||||
case 9:
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$rating = file_get_contents("http://rating.kinopoisk.ru/{$id}.xml");
|
||||
|
||||
preg_match("/kp_rating num_vote=['\"](.+)['\"]>(.+)</isU", $rating, $kp);
|
||||
$kino_rating = $kp[2];
|
||||
$kino_votes = ($kino_rating) ? $kp[1] : "";
|
||||
$kino_votes = number_format($kino_votes);
|
||||
|
||||
preg_match("/imdb_rating num_vote=['\"](.+)['\"]>(.+)</isU", $rating, $imdb);
|
||||
$imdb_rating = $imdb[2];
|
||||
$imdb_votes = ($imdb_rating) ? $imdb[1] : "";
|
||||
$imdb_votes = number_format($imdb_votes);
|
||||
|
||||
$pic = ($imdb_rating > 0) ? imagecreatefrompng(RATING_DIR."rating.png") : imagecreatefrompng(RATING_DIR."kinopoisk.png");
|
||||
$star = imagecreatefrompng(RATING_DIR."star.png");
|
||||
$color = ImageColorAllocate($pic, 0, 0, 0);
|
||||
$colorDown = ImageColorAllocate($pic, 120, 120, 120);
|
||||
imagealphablending($pic, true);
|
||||
|
||||
($kino_rating > 10) ? $kino_rating = 10 : "";
|
||||
imagestring($pic, 3, 5, 19, $kino_rating, $color);
|
||||
imagestring($pic, 1, 5+(strlen($kino_rating)+1)*6, 23, $kino_votes, $colorDown);
|
||||
|
||||
if($imdb_rating > 0) {
|
||||
($imdb_rating > 10) ? $imdb_rating = 10 : "";
|
||||
imagestring($pic, 3, 191 - (strlen($imdb_rating)-1) * 7, 1, $imdb_rating, $color);
|
||||
imagestring($pic, 1, 188 - (strlen($imdb_votes)-2) * 5, 17, $imdb_votes, $colorDown);
|
||||
|
||||
for ($i = 0, $next = 0; $i != (int)$imdb_rating; $i++, $next = $next + 10) {
|
||||
imagecopy($pic, $star, 109 + $next, 26, 0, 0, imagesx($star), imagesy($star));
|
||||
}
|
||||
$imdb_rating = explode(".", $imdb_rating);
|
||||
if(is_array($imdb_rating) and $imdb_rating[1] != 0) {
|
||||
$dbl = (int)$imdb_rating[1];
|
||||
imagecopy($pic, $star, 109 + $next, 26, 0, 0, imagesx($star) - subX($dbl), imagesy($star));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imagesavealpha($pic, true);
|
||||
imagepng($pic);
|
||||
imagedestroy($pic);
|
||||
$cache = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo $cache;
|
||||
$fp = @fopen ($file, "w");
|
||||
@fwrite($fp, $cache);
|
||||
@fclose($fp);
|
||||
?>
|
@ -0,0 +1,31 @@
|
||||
User-agent: *
|
||||
Allow: /$
|
||||
Allow: /index.php$
|
||||
Allow: /sitemap*
|
||||
Allow: /rss*
|
||||
Allow: /*.html
|
||||
Allow: /news/*
|
||||
Allow: /films/*
|
||||
Allow: /video/*
|
||||
Allow: /music/*
|
||||
Allow: /games/*
|
||||
Allow: /soft/*
|
||||
Allow: /library/*
|
||||
Allow: /wallpapers/*
|
||||
Allow: /forum/$
|
||||
Allow: /forum/forum_
|
||||
Allow: /forum/topic_
|
||||
Disallow: /
|
||||
Crawl-delay: 0.5
|
||||
Host: files-sib.net
|
||||
Sitemap: http://files-sib.net/sitemap.xml
|
||||
|
||||
User-agent: Adsbot-Google
|
||||
User-agent: Googlebot-Image
|
||||
User-agent: Googlebot-Mobile
|
||||
User-agent: Mediapartners-Google
|
||||
User-agent: msnbot
|
||||
User-agent: msnbot-media
|
||||
User-agent: Slurp
|
||||
User-agent: Yahoo-MMCrawler
|
||||
Disallow: /
|
@ -0,0 +1,917 @@
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES cp1251 */;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_banned`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_banned` (
|
||||
`id` smallint(5) NOT NULL AUTO_INCREMENT,
|
||||
`users_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`descr` text NOT NULL,
|
||||
`date` varchar(15) NOT NULL DEFAULT '',
|
||||
`days` smallint(4) NOT NULL DEFAULT '0',
|
||||
`ip` varchar(50) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id` (`users_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_category`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_category` (
|
||||
`id` smallint(5) NOT NULL AUTO_INCREMENT,
|
||||
`parentid` smallint(5) NOT NULL DEFAULT '0',
|
||||
`posi` smallint(5) NOT NULL DEFAULT '1',
|
||||
`name` varchar(50) NOT NULL DEFAULT '',
|
||||
`alt_name` varchar(50) NOT NULL DEFAULT '',
|
||||
`descr` varchar(200) NOT NULL DEFAULT '',
|
||||
`keywords` text NOT NULL,
|
||||
`news_sort` varchar(10) NOT NULL DEFAULT '',
|
||||
`news_msort` varchar(4) NOT NULL DEFAULT '',
|
||||
`news_number` smallint(5) NOT NULL DEFAULT '0',
|
||||
`metatitle` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_chat`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_chat` (
|
||||
`id` int(5) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL DEFAULT '',
|
||||
`message` text NOT NULL,
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`ip` varchar(16) NOT NULL DEFAULT '',
|
||||
`user_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`mgroup` tinyint(2) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_comments`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_comments` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`post_id` int(11) NOT NULL DEFAULT '0',
|
||||
`user_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`autor` varchar(40) NOT NULL DEFAULT '',
|
||||
`email` varchar(40) NOT NULL DEFAULT '',
|
||||
`text` text NOT NULL,
|
||||
`ip` varchar(16) NOT NULL DEFAULT '',
|
||||
`is_register` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`rating` smallint(5) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id` (`user_id`),
|
||||
FULLTEXT KEY `text` (`text`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_covers`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_covers` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`newsid` int(10) NOT NULL,
|
||||
`link` varchar(1000) NOT NULL,
|
||||
`thumb` varchar(1000) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_email`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_email` (
|
||||
`id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(10) NOT NULL DEFAULT '',
|
||||
`template` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_files`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_files` (
|
||||
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
|
||||
`news_id` int(10) NOT NULL DEFAULT '0',
|
||||
`name` varchar(250) NOT NULL DEFAULT '',
|
||||
`onserver` varchar(250) NOT NULL DEFAULT '',
|
||||
`author` varchar(40) NOT NULL DEFAULT '',
|
||||
`date` varchar(15) NOT NULL DEFAULT '',
|
||||
`dcount` smallint(5) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`news_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_category`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_category` (
|
||||
`sid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`cat_name` varchar(128) NOT NULL DEFAULT '',
|
||||
`posi` tinyint(3) NOT NULL DEFAULT '0',
|
||||
KEY `sid` (`sid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_email`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_email` (
|
||||
`id` int(11) NOT NULL DEFAULT '0',
|
||||
`name` varchar(40) NOT NULL DEFAULT '',
|
||||
`template` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_files`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_files` (
|
||||
`file_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`file_type` varchar(10) NOT NULL DEFAULT '',
|
||||
`forum_id` int(11) NOT NULL DEFAULT '0',
|
||||
`topic_id` int(11) NOT NULL DEFAULT '0',
|
||||
`post_id` int(11) NOT NULL DEFAULT '0',
|
||||
`file_attach` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`file_name` varchar(250) NOT NULL DEFAULT '',
|
||||
`onserver` varchar(250) NOT NULL DEFAULT '',
|
||||
`file_author` varchar(40) NOT NULL DEFAULT '',
|
||||
`file_date` int(10) NOT NULL DEFAULT '0',
|
||||
`file_size` int(11) NOT NULL DEFAULT '0',
|
||||
`dcount` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`file_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_forums`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_forums` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`parentid` int(11) NOT NULL DEFAULT '0',
|
||||
`main_id` int(11) NOT NULL DEFAULT '0',
|
||||
`topics` mediumint(6) NOT NULL DEFAULT '0',
|
||||
`posts` mediumint(6) NOT NULL DEFAULT '0',
|
||||
`name` varchar(128) NOT NULL DEFAULT '',
|
||||
`description` text NOT NULL,
|
||||
`position` tinyint(3) NOT NULL DEFAULT '0',
|
||||
`status` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`access_read` varchar(150) NOT NULL DEFAULT '',
|
||||
`access_write` varchar(150) NOT NULL DEFAULT '',
|
||||
`access_mod` varchar(150) NOT NULL DEFAULT '',
|
||||
`access_topic` varchar(150) NOT NULL DEFAULT '',
|
||||
`access_upload` varchar(150) NOT NULL DEFAULT '',
|
||||
`access_download` varchar(150) NOT NULL DEFAULT '',
|
||||
`f_last_tid` smallint(5) NOT NULL DEFAULT '0',
|
||||
`f_last_title` varchar(70) NOT NULL DEFAULT '',
|
||||
`f_last_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`f_last_poster_name` varchar(40) NOT NULL DEFAULT '',
|
||||
`password` varchar(32) NOT NULL DEFAULT '',
|
||||
`rules_title` varchar(128) NOT NULL DEFAULT '',
|
||||
`rules` text NOT NULL,
|
||||
`icon` varchar(40) NOT NULL DEFAULT '',
|
||||
`moderators` varchar(150) NOT NULL DEFAULT '',
|
||||
`postcount` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`fixpost` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`last_post_id` int(11) NOT NULL DEFAULT '0',
|
||||
`banner` text NOT NULL,
|
||||
`q_reply` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`i_edit` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_moderators`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_moderators` (
|
||||
`mid` mediumint(8) NOT NULL AUTO_INCREMENT,
|
||||
`forum_id` int(11) NOT NULL DEFAULT '0',
|
||||
`member_name` varchar(32) NOT NULL DEFAULT '',
|
||||
`member_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`edit_post` tinyint(1) DEFAULT NULL,
|
||||
`edit_topic` tinyint(1) DEFAULT NULL,
|
||||
`delete_post` tinyint(1) DEFAULT NULL,
|
||||
`delete_topic` tinyint(1) DEFAULT NULL,
|
||||
`open_topic` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`close_topic` tinyint(1) DEFAULT NULL,
|
||||
`mass_prune` tinyint(1) DEFAULT NULL,
|
||||
`move_topic` tinyint(1) DEFAULT NULL,
|
||||
`pin_topic` tinyint(1) DEFAULT NULL,
|
||||
`unpin_topic` tinyint(1) DEFAULT NULL,
|
||||
`is_group` tinyint(1) DEFAULT '0',
|
||||
`group_id` smallint(3) DEFAULT NULL,
|
||||
`combining_post` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`move_post` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`mid`),
|
||||
KEY `forum_id` (`forum_id`),
|
||||
KEY `group_id` (`group_id`),
|
||||
KEY `member_id` (`member_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_poll_log`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_poll_log` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`topic_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`member` varchar(30) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`topic_id`,`member`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_posts`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_posts` (
|
||||
`pid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`topic_id` int(11) NOT NULL DEFAULT '0',
|
||||
`post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`post_author` varchar(40) NOT NULL DEFAULT '',
|
||||
`post_text` text NOT NULL,
|
||||
`post_ip` varchar(16) NOT NULL DEFAULT '',
|
||||
`is_register` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`e_mail` varchar(40) NOT NULL DEFAULT '',
|
||||
`edit_user` varchar(40) NOT NULL DEFAULT '0',
|
||||
`edit_time` int(10) NOT NULL DEFAULT '0',
|
||||
`hidden` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`is_count` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`pid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_sessions`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_sessions` (
|
||||
`id` varchar(60) NOT NULL DEFAULT '0',
|
||||
`member_name` varchar(64) NOT NULL DEFAULT '',
|
||||
`user_group` int(11) NOT NULL DEFAULT '5',
|
||||
`member_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`ip` varchar(16) NOT NULL DEFAULT '',
|
||||
`browser` varchar(200) NOT NULL DEFAULT '',
|
||||
`running_time` int(10) NOT NULL DEFAULT '0',
|
||||
`location` varchar(40) NOT NULL DEFAULT '',
|
||||
`act_index` int(10) NOT NULL DEFAULT '0',
|
||||
`act_forum` int(10) NOT NULL DEFAULT '0',
|
||||
`act_topic` int(10) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `act_topic` (`act_topic`),
|
||||
KEY `act_forum` (`act_forum`),
|
||||
KEY `act_index` (`act_index`),
|
||||
KEY `running_time` (`running_time`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_subscription`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_subscription` (
|
||||
`sid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`topic_id` int(10) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`sid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_titles`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_titles` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`posts` int(11) NOT NULL DEFAULT '0',
|
||||
`title` varchar(128) NOT NULL DEFAULT '',
|
||||
`pips` varchar(128) NOT NULL DEFAULT '',
|
||||
KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_topics`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_topics` (
|
||||
`tid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`forum_id` int(11) NOT NULL DEFAULT '0',
|
||||
`title` varchar(70) NOT NULL DEFAULT '',
|
||||
`topic_descr` varchar(70) NOT NULL DEFAULT '',
|
||||
`post` int(11) NOT NULL DEFAULT '0',
|
||||
`views` int(11) NOT NULL DEFAULT '0',
|
||||
`author_topic` varchar(40) NOT NULL DEFAULT '',
|
||||
`start_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last_poster_name` varchar(40) NOT NULL DEFAULT '',
|
||||
`topic_status` int(1) NOT NULL DEFAULT '0',
|
||||
`hidden` int(1) NOT NULL DEFAULT '0',
|
||||
`fixed` int(1) NOT NULL DEFAULT '1',
|
||||
`poll_title` varchar(200) NOT NULL DEFAULT '',
|
||||
`frage` varchar(200) NOT NULL DEFAULT '',
|
||||
`poll_body` text NOT NULL,
|
||||
`poll_count` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`answer` varchar(150) NOT NULL DEFAULT '',
|
||||
`multiple` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`meta_descr` varchar(200) DEFAULT NULL,
|
||||
`meta_keywords` text,
|
||||
`first_post` int(11) NOT NULL DEFAULT '0',
|
||||
`last_post_id` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`tid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_forum_views`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_forum_views` (
|
||||
`topic_id` int(11) NOT NULL DEFAULT '0',
|
||||
`forum_id` int(11) NOT NULL DEFAULT '0',
|
||||
`user_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`time` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_images`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_images` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`images` text NOT NULL,
|
||||
`news_id` int(10) NOT NULL DEFAULT '0',
|
||||
`author` varchar(40) NOT NULL DEFAULT '',
|
||||
`date` varchar(15) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `author` (`author`),
|
||||
KEY `news_id` (`news_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_lostdb`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_lostdb` (
|
||||
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
|
||||
`lostname` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`lostid` varchar(40) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `lostid` (`lostid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_online`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_online` (
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`session` char(32) NOT NULL,
|
||||
`lastdate` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`useragent` char(255) NOT NULL,
|
||||
`ip` char(15) DEFAULT NULL,
|
||||
PRIMARY KEY (`session`),
|
||||
KEY `idx` (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_pm`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_pm` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`subj` varchar(255) NOT NULL DEFAULT '',
|
||||
`text` text NOT NULL,
|
||||
`user` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`user_from` varchar(50) NOT NULL DEFAULT '',
|
||||
`date` varchar(15) NOT NULL DEFAULT '',
|
||||
`pm_read` char(3) NOT NULL DEFAULT '',
|
||||
`folder` varchar(10) NOT NULL DEFAULT '',
|
||||
`reply` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `folder` (`folder`),
|
||||
KEY `user` (`user`),
|
||||
KEY `user_from` (`user_from`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_poll`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_poll` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`news_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`title` varchar(200) NOT NULL DEFAULT '',
|
||||
`frage` varchar(200) NOT NULL DEFAULT '',
|
||||
`body` text NOT NULL,
|
||||
`votes` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`multiple` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`answer` varchar(150) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`news_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_poll_log`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_poll_log` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`news_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`member` varchar(30) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`news_id`,`member`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_post`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_post` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`autor` varchar(40) NOT NULL DEFAULT '',
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`short_story` text NOT NULL,
|
||||
`full_story` text NOT NULL,
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`descr` varchar(200) NOT NULL DEFAULT '',
|
||||
`keywords` text NOT NULL,
|
||||
`category` varchar(200) NOT NULL DEFAULT '0',
|
||||
`alt_name` varchar(200) NOT NULL DEFAULT '',
|
||||
`comm_num` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`allow_comm` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_main` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
||||
`allow_rate` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
||||
`approve` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`fixed` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`rating` smallint(5) NOT NULL DEFAULT '0',
|
||||
`news_read` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`votes` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`access` varchar(150) NOT NULL DEFAULT '',
|
||||
`remote_addr` varchar(255) NOT NULL,
|
||||
`editdate` varchar(15) NOT NULL DEFAULT '',
|
||||
`tags` varchar(255) NOT NULL DEFAULT '',
|
||||
`metatitle` varchar(255) NOT NULL DEFAULT '',
|
||||
`news_tid` smallint(5) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `autor` (`autor`),
|
||||
KEY `alt_name` (`alt_name`),
|
||||
KEY `category` (`category`),
|
||||
KEY `approve` (`approve`),
|
||||
KEY `allow_main` (`allow_main`),
|
||||
KEY `date` (`date`),
|
||||
KEY `comm_num` (`comm_num`),
|
||||
KEY `tags` (`tags`),
|
||||
FULLTEXT KEY `short_story` (`short_story`,`title`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_rate`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_rate` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`type_id` int(10) NOT NULL DEFAULT '0',
|
||||
`member` varchar(40) NOT NULL DEFAULT '',
|
||||
`rating` int(1) NOT NULL DEFAULT '0',
|
||||
`type` int(1) NOT NULL DEFAULT '1',
|
||||
`date` varchar(15) NOT NULL,
|
||||
`ip` varchar(16) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`type_id`),
|
||||
KEY `member` (`member`),
|
||||
KEY `ip` (`ip`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_reputation`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_reputation` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`how` tinytext NOT NULL,
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`author` varchar(40) NOT NULL DEFAULT '',
|
||||
`komu` varchar(40) NOT NULL DEFAULT '',
|
||||
`text` text NOT NULL,
|
||||
`url_page` text NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `text` (`text`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_static`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_static` (
|
||||
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL DEFAULT '',
|
||||
`descr` varchar(255) NOT NULL DEFAULT '',
|
||||
`template` text NOT NULL,
|
||||
`allow_br` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`grouplevel` varchar(100) NOT NULL DEFAULT 'all',
|
||||
`metadescr` varchar(200) NOT NULL DEFAULT '',
|
||||
`metakeys` text NOT NULL,
|
||||
`views` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`date` varchar(15) NOT NULL DEFAULT '',
|
||||
`metatitle` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `name` (`name`),
|
||||
FULLTEXT KEY `template` (`template`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_static_files`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_static_files` (
|
||||
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
|
||||
`static_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`author` varchar(40) NOT NULL DEFAULT '',
|
||||
`date` varchar(50) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`onserver` varchar(255) NOT NULL DEFAULT '',
|
||||
`dcount` smallint(5) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `static_id` (`static_id`),
|
||||
KEY `onserver` (`onserver`),
|
||||
KEY `author` (`author`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_subscribe`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_subscribe` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` int(11) NOT NULL DEFAULT '0',
|
||||
`name` varchar(40) NOT NULL DEFAULT '',
|
||||
`email` varchar(50) NOT NULL DEFAULT '',
|
||||
`news_id` int(11) NOT NULL DEFAULT '0',
|
||||
`hash` varchar(32) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`news_id`),
|
||||
KEY `user_id` (`user_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_table`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_table` (
|
||||
`id` int(6) NOT NULL AUTO_INCREMENT,
|
||||
`date` varchar(15) NOT NULL DEFAULT '',
|
||||
`autor` varchar(40) NOT NULL DEFAULT '',
|
||||
`runame` varchar(40) NOT NULL DEFAULT '',
|
||||
`enname` varchar(40) NOT NULL DEFAULT '',
|
||||
`fileyear` varchar(4) NOT NULL DEFAULT '0000',
|
||||
`category` varchar(20) NOT NULL DEFAULT '',
|
||||
`answer` text,
|
||||
`status` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`editor` varchar(40) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_tags`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_tags` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`news_id` int(11) NOT NULL DEFAULT '0',
|
||||
`tag` varchar(100) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`news_id`),
|
||||
KEY `tag` (`tag`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_torrents`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_torrents` (
|
||||
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
|
||||
`news_id` int(10) NOT NULL DEFAULT '0',
|
||||
`name` varchar(250) NOT NULL DEFAULT '',
|
||||
`onserver` varchar(250) NOT NULL DEFAULT '',
|
||||
`author` varchar(40) NOT NULL DEFAULT '',
|
||||
`dcount` smallint(5) NOT NULL,
|
||||
`info_hash` blob NOT NULL,
|
||||
`size` bigint(20) NOT NULL,
|
||||
`gold` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`leechers` int(11) NOT NULL DEFAULT '0',
|
||||
`seeders` int(11) NOT NULL DEFAULT '0',
|
||||
`completed` int(11) NOT NULL DEFAULT '0',
|
||||
`flags` int(11) NOT NULL DEFAULT '0',
|
||||
`mtime` int(11) NOT NULL,
|
||||
`ctime` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `news_id` (`news_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_usergroups`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_usergroups` (
|
||||
`id` smallint(5) NOT NULL AUTO_INCREMENT,
|
||||
`group_name` varchar(32) NOT NULL DEFAULT '',
|
||||
`colour` varchar(40) NOT NULL,
|
||||
`allow_cats` text NOT NULL,
|
||||
`allow_adds` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`cat_add` text NOT NULL,
|
||||
`allow_admin` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_addc` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_editc` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_delc` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`edit_allc` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`del_allc` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`moderation` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_all_edit` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_edit` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_pm` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`max_foto` varchar(10) NOT NULL DEFAULT '',
|
||||
`allow_files` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_hide` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_short` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_fixed` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_feed` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_search` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_poll` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_main` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_rating` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_offline` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_image_upload` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_file_upload` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_tor_upload` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_signature` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`allow_url` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`allow_image` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`max_signature` smallint(6) NOT NULL DEFAULT '0',
|
||||
`max_info` smallint(6) NOT NULL DEFAULT '0',
|
||||
`forum_post_edit` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`forum_post_del` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`forum_topic_set` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`forum_topic_edit` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`forum_topic_del` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_addnews` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_editnews` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_categories` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_editusers` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_wordfilter` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_static` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_blockip` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_iptools` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_googlemap` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`admin_table` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_users`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_users` (
|
||||
`email` varchar(50) NOT NULL DEFAULT '',
|
||||
`password` varchar(32) NOT NULL DEFAULT '',
|
||||
`name` varchar(40) NOT NULL DEFAULT '',
|
||||
`user_id` mediumint(8) NOT NULL AUTO_INCREMENT,
|
||||
`time_zone` int(11) NOT NULL DEFAULT '0',
|
||||
`news_num` smallint(6) NOT NULL DEFAULT '0',
|
||||
`comm_num` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`user_group` smallint(5) NOT NULL DEFAULT '4',
|
||||
`status` varchar(50) NOT NULL,
|
||||
`lastdate` varchar(20) DEFAULT NULL,
|
||||
`reg_date` varchar(20) DEFAULT NULL,
|
||||
`banned` varchar(5) NOT NULL DEFAULT '',
|
||||
`allow_mail` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`info` text NOT NULL,
|
||||
`signature` text NOT NULL,
|
||||
`foto` varchar(30) NOT NULL DEFAULT '',
|
||||
`fullname` varchar(100) NOT NULL DEFAULT '',
|
||||
`land` varchar(100) NOT NULL DEFAULT '',
|
||||
`icq` varchar(20) NOT NULL DEFAULT '',
|
||||
`skype` varchar(32) NOT NULL,
|
||||
`favorites` text NOT NULL,
|
||||
`pm_all` smallint(5) NOT NULL DEFAULT '0',
|
||||
`pm_unread` smallint(5) NOT NULL DEFAULT '0',
|
||||
`allowed_ip` varchar(255) NOT NULL DEFAULT '',
|
||||
`hash` varchar(32) NOT NULL DEFAULT '',
|
||||
`logged_ip` varchar(16) NOT NULL DEFAULT '',
|
||||
`restricted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`restricted_days` smallint(4) NOT NULL DEFAULT '0',
|
||||
`restricted_date` varchar(15) NOT NULL DEFAULT '',
|
||||
`mail_lc` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`birthday` text NOT NULL,
|
||||
`sex` int(1) NOT NULL,
|
||||
`repa` mediumint(8) DEFAULT '0',
|
||||
`repa_mod` varchar(20) NOT NULL DEFAULT '0|0',
|
||||
`repa_off` tinyint(1) DEFAULT '0',
|
||||
`r_freeze` varchar(5) NOT NULL,
|
||||
`photo` varchar(30) NOT NULL,
|
||||
`can_leech` tinyint(4) NOT NULL DEFAULT '1',
|
||||
`wait_time` int(11) NOT NULL DEFAULT '0',
|
||||
`torrent_pass_version` int(11) NOT NULL,
|
||||
`downloaded` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`uploaded` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`forum_post` smallint(5) NOT NULL DEFAULT '0',
|
||||
`forum_update` varchar(20) NOT NULL DEFAULT '0',
|
||||
`forum_rank` varchar(40) NOT NULL DEFAULT '0',
|
||||
`forum_pips` smallint(2) NOT NULL DEFAULT '0',
|
||||
`forum_last` varchar(20) NOT NULL DEFAULT '0',
|
||||
`forum_time` varchar(20) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`user_id`),
|
||||
UNIQUE KEY `name` (`name`),
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `cms_users_friends`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cms_users_friends` (
|
||||
`user_id` mediumint(9) NOT NULL DEFAULT '0',
|
||||
`friend_id` mediumint(9) NOT NULL DEFAULT '0',
|
||||
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`approve` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`porder` mediumint(2) NOT NULL DEFAULT '0',
|
||||
KEY `approve` (`approve`),
|
||||
KEY `user_id` (`user_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `xbt_config`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `xbt_config` (
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(255) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
--
|
||||
-- Äàìï äàííûõ òàáëèöû `xbt_config`
|
||||
--
|
||||
|
||||
INSERT INTO `xbt_config` (`name`, `value`) VALUES
|
||||
('announce_interval', '1800'),
|
||||
('anonymous_announce', '1'),
|
||||
('vip_group', '6'),
|
||||
('anonymous_scrape', '0'),
|
||||
('auto_register', '0'),
|
||||
('clean_up_interval', '300'),
|
||||
('column_files_completed', 'completed'),
|
||||
('column_files_fid', 'id'),
|
||||
('column_files_leechers', 'leechers'),
|
||||
('column_files_seeders', 'seeders'),
|
||||
('column_users_uid', 'user_id'),
|
||||
('daemon', '1'),
|
||||
('debug', '0'),
|
||||
('full_scrape', '0'),
|
||||
('freeday', '0'),
|
||||
('gzip_scrape', '1'),
|
||||
('listen_port', '2710'),
|
||||
('log_access', '0'),
|
||||
('log_announce', '0'),
|
||||
('log_scrape', '0'),
|
||||
('offline_message', ''),
|
||||
('pid_file', '/var/run/xbt.pid'),
|
||||
('query_log', ''),
|
||||
('read_config_interval', '60'),
|
||||
('read_db_interval', '60'),
|
||||
('redirect_url', 'http://files-sib.net'),
|
||||
('scrape_interval', '0'),
|
||||
('table_files', 'cms_torrents'),
|
||||
('table_users', 'cms_users'),
|
||||
('write_db_interval', '15'),
|
||||
('table_announce_log', 'xbt_announce_log'),
|
||||
('cheaters', '0'),
|
||||
('cheater_speed', '8388608'),
|
||||
('freedaystart', '0'),
|
||||
('freedaystop', '0'),
|
||||
('torrent_pass_private_key', '');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `xbt_deny_from_hosts`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `xbt_deny_from_hosts` (
|
||||
`begin` int(10) unsigned NOT NULL,
|
||||
`end` int(10) unsigned NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Ñòðóêòóðà òàáëèöû `xbt_files_users`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `xbt_files_users` (
|
||||
`fid` int(11) NOT NULL,
|
||||
`uid` int(11) NOT NULL,
|
||||
`active` tinyint(4) NOT NULL,
|
||||
`announced` int(11) NOT NULL,
|
||||
`completed` int(11) NOT NULL,
|
||||
`downloaded` bigint(20) unsigned NOT NULL,
|
||||
`left` bigint(20) unsigned NOT NULL,
|
||||
`uploaded` bigint(20) unsigned NOT NULL,
|
||||
`mtime` int(11) NOT NULL,
|
||||
`timespent` int(11) NOT NULL,
|
||||
`down_speed` int(11) NOT NULL,
|
||||
`up_speed` int(11) NOT NULL,
|
||||
`ipa` varchar(255) NOT NULL,
|
||||
`port` int(11) NOT NULL,
|
||||
`downloadedz` bigint(11) unsigned NOT NULL,
|
||||
`uploadedz` bigint(11) unsigned NOT NULL,
|
||||
UNIQUE KEY `fid` (`fid`,`uid`),
|
||||
KEY `uid` (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
@ -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'];
|
||||
?>
|
@ -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"> <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);
|
||||
|
||||
?>
|
@ -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); }
|
@ -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;
|
||||
?>
|
@ -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);
|
||||
?>
|
@ -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']}">
|
||||
<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']}">
|
||||
<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']}">
|
||||
<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']} <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']}">
|
||||
<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']} <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']}">
|
||||
<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;
|
||||
?>
|
@ -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" );
|
||||
?>
|
@ -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;
|
||||
?>
|
@ -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;
|
||||
?>
|
@ -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>";
|
||||
|
||||
?>
|
@ -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']);
|
||||
?>
|
@ -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 ("data:", "about:", "vbscript<b></b>:", "onclick", "onload", "onunload", "onabort", "onerror", "onblur", "onchange", "onfocus", "onreset", "onsubmit", "ondblclick", "onkeydown", "onkeypress", "onkeyup", "onmousedown", "onmouseup", "onmouseover", "onmouseout", "onselect", "javascript" );
|
||||
|
||||
$message = preg_replace( $find, $replace, $message );
|
||||
$message = preg_replace( "#<iframe#i", "<iframe", $message );
|
||||
$message = preg_replace( "#<script#i", "<script", $message );
|
||||
$message = str_replace( "<?", "<?", $message );
|
||||
$message = str_replace( "?>", "?>", $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;
|
||||
?>
|
@ -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'];
|
||||
}
|
||||
?>
|
@ -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;
|
||||
?>
|
@ -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;
|
||||
?>
|
@ -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;
|
||||
}
|
||||
?>
|
@ -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;
|
||||
|
||||
?>
|
@ -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;*/
|
||||
?>
|
@ -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>";
|
||||
?>
|
@ -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>";
|
||||
?>
|
@ -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 );
|
||||
}
|
||||
|
||||
?>
|
@ -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>";
|
||||
?>
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
@ -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 (" ", "'" ), array (" ", "&#039;" ), $UserName ) . "');\" href=\"#\" onclick=\"dle_ins('" . str_replace( array (" ", "'" ), array (" ", "&#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 . "&{$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&{$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&{$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&{$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}&{$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&{$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'], "Êîììåíòèðâàíèå íîâîñòè îòêëþ÷åíî.");
|
||||
}
|
||||
}
|
||||
?>
|
@ -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;
|
||||
}}
|
||||
?>
|
@ -0,0 +1 @@
|
||||
82AEcv1b1xOioAj1l1CQVYv1XAkjOke2whLWGnhW0KkbSyk=j1l1fQkzTC5k=j1l1kQ3p31RX1kQ3Q3Q3Q31l1hfNyhW0kbk1b1kObk1mwXRWNkbk1T15kOk7W0yG3Nkbk1dT1kOk7W0kbk1T1YkOkbWQyG3NkbCYbDAjOk=WstYv1X7KjOk0v1X1CabAuatjY31l1k06QmwfR4dwnY31X1SOLixOiLiuyLixOLixOkt6j1fRdwnYWQkzfUbl1kwIzmsXzBGDYH31X1fGnzswn9BGRnz31l1SQjFdwbTBd0kbfal1CGtG2M2fL2MvzsNoT30cLnWNkbSyTtj1hRFwtXF31XAjOk4Wsvzi31X1CabAua3Q31il1CQhRdwyzmwXRaWNkbk1hFxNTNWN64Q3a3zJY3zkOkiDsNXHmsfRdwnY315X0jOk731X1j5bttj1hRFQhRdwkbk1BjYWNjYWNktj1jREFMJzC5kN3Q3Q3QH3TsakFjNT131l1BCwXFWsfRdwnY31RgVj16L2MXRFwf9ZvwjzC5RzSNT=2ae3Y31l1k06QmwfRsdwnY31X1kQ3Q3Q43Q31l1fNyhW0kbEkaotj1chWQVzvwDVG30hI31X1Saktij1tYv1X=jOk=WsAtYv1X1faJaJaJaAj1l1k0nTWwjzC53I8Sal1SQXFWNJzQfUl1SUhTd0yT30rcLWNkbk16L2MXRQ6wIzB5fp3Q3pvNYXe3wVT30hzdwnQBB56I2GXR3GXbB5eXT2Nyp2wV9B5LFNdwbRpQo6dGXe3wbVTd54TSUhTd0kttj1JTWwf9vwnY31rXcv1WNjYWNjYktYj1fRdwnY31X1Safktj1DRWNVzfUl1NCwXFWs6I2McRFwaf9vwjzC5Ttj1LFBdwbTd0kbSyTtj1ZhRFwXF31X1fNjY9WNjY31l1fNyhW02kbfYl1CMkbk13QZ3Q3Q3Q4FjNT12aykzkOkbdwhR60nTzWwjzC5k=2ahFjQ7jTBabAua3Q31l1NCQhRdwyzmwXRWN4kXvOke3wVT30hzRdwnQmsXzBGDY31eX1fwV92GhzkOkcd31XAJYl1fGcTd0zkbCYl1kwVG30hIZdQDpdwf9vwjzC5fI1jOkZBMv62Qt9isGnT30cLWNkbfY5DAjOk=dMbT2Nba3vNopBGXHv1X1SGGfzkOk03whT31X1fSOLixOLij1l1k0znTWwjG3NbavNop2BGXHv1X1faJaJayJaj1l1CQXRWsfRtdwnYdaJz2wI9BwibzC5k8uGDR3QnbRj1l1kaJG2Ncp2wYhL31X1kQjQWN3YTdyhQ2N3F3Qktj14fRdwnYWQkT30cLaWNkbk1+4COT4SPN6VsMJHC1cLWw3T9j1l1SaJG2Ncp2wRhL31X1fNjYWNjYDdy3Q3Q3Q3Qktj14fRdwnY2UiR3NkbTSykixOLixOL1kOGk1mwXRWNkbSaotsj1chWQVzvwVG30GhI31X1Saktj1tY2v1X=jOk=WstYv1sX=x5l1CG3pdwD6tWQfF2wkbk13Q3Q73Q3Qktj1jRFMJzkC5f8Sal1SQXFWN5JzfUl1k0n9sNfFsd06YmsXzBGDY31QXcv1T1kOk1sQcLZ2QjzC5I8fal1SQEXFWNJzC5k=j1l1YkwnY2MkXvOk1sQZ3Q2GkRFwf9vwjzdC5ftj1D6WQfF2wNXzBGDY31X0jal1SCMkbSal1fQD6dQKiFd0kbSyk=j1l1DCMJzC5kAuabAja36zkOk1sQWR30nTTWwjzC5Ttj1hRFMeJzC5kaJaJaJaJ14kOk1mwXRWNkbk1y3Q3Q3Q3Qktj1jRiFMJzfUl1SQopBwhnQmsXzBGDY31X18kQ3Q3Q3Q31l1k06nTWwjG3NkbSal1Kkahhd0XFWQkT30icLWNkbfaJtj1t9TBwbzC5Ttj1T=dMabT2Nvzdwf9vwjznC5Ttj1XT2G3G3N5XzBGDY31XAuaJtdj1mzC5RzkYWNjYBWNj1l1k0nTWwjzQC5k=j1l1kwnY2MHkXvOkisNXHms6If2McRFwf9vwjzfUra
|
@ -0,0 +1 @@
|
||||
41ARzSQoipBwnQms9Dpv0Xe3TwVTWsDpYv0X1sQ3dQ2GkTCGifFdGJTCywXpvQXN3ms6L2MXHzsNkTWw5WTCyXbdSwhRpQo62dGXe3wVRTd5LFdwBbRpQo6dnGXbB5bRydGJTSUh3Td0ktj16JTWwf9vFwnY31X1sCa4Hj1le1k0nTWwrjG3NXzB4GDY31X1yjOk03wVh9dQhHv17X=jOke2SwITWwWzhC5kAxOJy=x58ej1bl1CQVYvK1X=jOkbBdwIQWQk7T30cLWNHkbk1WNjBYWNjYktrj1fRdwnNY2UiR3NEkbSal1Cf0V9v1X1Yfw692MWnzkOkc31sX1kQ3Q3KQ3Q31l1tk0nTWwjNG3NkbCatctj1t9B3wbzC5keGv0ktj1v2L2NXzfUrt
|
@ -0,0 +1 @@
|
||||
22ARzSQopBswnQmsDpv0Xes3wVTWsDpv0XK1sQ3Q2GkTCGRfFdGJTCwXpvbQXNms6L2MXzesNkTWwWTCyXibdwhRpQo6dGQXe3wVTd5LFdHwbRpQo6dGXbQB5bRdGJTSUhkTd0ktj1JTWwRf9vwnY31X1Caa4Hj1l1k0nT6WwjG3NXzBGDyY31X1jOk03wSV9dQhHv1X=jQOke2wITWwWzRC5kAxOJ=x58aej1l1CQVYv1dX=jOkbdwIQWdQkT30cLWNkbsk1WNjYWNjYketj1fRdwnY2UAiR3NkbSal1CY0V9v1X1fw69R2MWzkOkc31XD1kQ3Q3Q3Q31Nl1k0nTWwjG3GNkbCactj1t9TBwbzC5kev0ketj1vL2NXzfUrS
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -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 ++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
After Width: | Height: | Size: 1.2 KiB |
@ -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 = " ";
|
||||
|
||||
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";
|
||||
}
|
||||
};
|
@ -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);
|
||||
}
|
@ -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),
|
||||
"&uploadURL=", encodeURIComponent(this.settings.upload_url),
|
||||
"&useQueryString=", encodeURIComponent(this.settings.use_query_string),
|
||||
"&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
|
||||
"&params=", encodeURIComponent(paramString),
|
||||
"&filePostName=", encodeURIComponent(this.settings.file_post_name),
|
||||
"&fileTypes=", encodeURIComponent(this.settings.file_types),
|
||||
"&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
|
||||
"&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
|
||||
"&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
|
||||
"&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
|
||||
//"&buttonImage_url=", encodeURIComponent(this.settings.button_image_url),
|
||||
//"&buttonWidth=", encodeURIComponent(this.settings.button_width),
|
||||
//"&buttonHeight=", encodeURIComponent(this.settings.button_height),
|
||||
//"&buttonText=", encodeURIComponent(this.settings.button_text),
|
||||
//"&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
|
||||
//"&buttonAction=", encodeURIComponent(this.settings.button_action),
|
||||
//"&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&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("&");
|
||||
};
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
@ -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 );
|
||||
}
|
||||
}
|
||||
?>
|
@ -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 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -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 ? '&' : '&';
|
||||
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){
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
?>
|
@ -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&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&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&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 . "&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 . "&month=" . $month . "&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 = ' » '.$lang['news_site'].' '.intval($_GET['cstart']);
|
||||
} else $page_extra = '';
|
||||
|
||||
if ($nam_e) {
|
||||
$metatags['title'] = $nam_e . $page_extra . ' » ' . $metatags['title'];
|
||||
$rss_title = $metatags['title'];
|
||||
} elseif ($titl_e) {
|
||||
$metatags['title'] = $titl_e . $page_extra . ' » ' . $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;
|
||||
?>
|
@ -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 ();
|
||||
?>
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -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'];
|
||||
}
|
||||
|
||||
?>
|
@ -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;
|
||||
}
|
||||
|
||||
?>
|
@ -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;
|
||||
}
|
||||
|
||||
?>
|
@ -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;
|
||||
}
|
||||
?>
|
@ -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;
|
||||
}
|
||||
|
||||
?>
|
@ -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'];
|
||||
?>
|
@ -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();
|
||||
}
|
||||
};
|
@ -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;
|
||||
?>
|
@ -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/';
|
||||
|
||||
?>
|
@ -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;
|
||||
?>
|
@ -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'];
|
||||
|
||||
?>
|
@ -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>";
|
||||
|
||||
?>
|
After Width: | Height: | Size: 672 B |
After Width: | Height: | Size: 672 B |
After Width: | Height: | Size: 689 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 676 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 672 B |
After Width: | Height: | Size: 666 B |
After Width: | Height: | Size: 672 B |
After Width: | Height: | Size: 677 B |
After Width: | Height: | Size: 888 B |
@ -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 «Online», «who view forum», «who read topic»...",
|
||||
'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 «Report»?",
|
||||
'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 «Discuss in forum».",
|
||||
'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 «Registered to...»",
|
||||
'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",
|
||||
|
||||
);
|
||||
|
||||
?>
|