дружим аякс с ленгами git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@176 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
pherum83 2011-07-28 21:23:28 +00:00
commit 4a193a378e
14 changed files with 1806 additions and 1819 deletions

View file

@ -18,7 +18,7 @@ $new_status = (int) $this->request['status'];
// Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$new_status]))
{
$this->ajax_die("Такого статуса не существует: $new_status");
$this->ajax_die($lang['TOR_STATUS_FAILED']);
}
$tor = DB()->fetch_row("
@ -29,17 +29,17 @@ $tor = DB()->fetch_row("
WHERE tor.attach_id = $attach_id
LIMIT 1
");
if (!$tor) $this->ajax_die('torrent not found');
if (!$tor) $this->ajax_die($lang['TORRENT_FAILED']);
// Тот же статус
if ($tor['tor_status'] == $new_status)
{
$this->ajax_die('Раздача имеет тот же статус');
$this->ajax_die($lang['TOR_STATUS_DUB']);
}
// Запрет на изменение/присвоение CH-статуса модератором
if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN)
{
$this->ajax_die('Изменение статуса невозможно');
$this->ajax_die($lang['TOR_DONT_CHANGE']);
}
// Права на изменение статуса
@ -62,9 +62,9 @@ if ($tor['tor_status'] != TOR_NOT_APPROVED && $tor['checked_user_id'] != $userda
{
if (empty($this->request['confirmed']))
{
$msg = "Раздача имеет статус: {$lang['TOR_STATUS_NAME'][$tor['tor_status']]}\n\n";
$msg .= ($username = get_username($tor['checked_user_id'])) ? "Статус изменен: ". html_entity_decode($username) .", ". delta_time($tor['checked_time']) ." назад\n\n" : "";
$msg .= "Продолжить?";
$msg = $lang['TOR_STATUS_OF'] ." {$lang['TOR_STATUS_NAME'][$tor['tor_status']]}\n\n";
$msg .= ($username = get_username($tor['checked_user_id'])) ? $lang['TOR_STATUS_CHANGED'] . html_entity_decode($username) .", ". delta_time($tor['checked_time']) . $lang['BACK'] ."\n\n" : "";
$msg .= $lang['PROCEED'] .'?';
$this->prompt_for_confirm($msg);
}
}

View file

@ -6,7 +6,7 @@ global $userdata, $bb_cfg, $lang;
if (!isset($this->request['attach_id']))
{
$this->ajax_die('empty attach_id');
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
}
if (!isset($this->request['type']))
{
@ -36,14 +36,15 @@ $torrent = DB()->fetch_row("
LIMIT 1
");
if (!$torrent) $this->ajax_die('Invalid attach_id');
if (!$torrent) $this->ajax_die($lang['INVALID_ATTACH_ID']);
if($torrent['poster_id'] == $userdata['user_id'] && !IS_AM)
{
if($type == 'del_torrent' || $type == 'reg' || $type == 'unreg')
{ true; }
else
{ $this->ajax_die($lang['ONLY_FOR_MOD']); } }
{
$this->ajax_die($lang['ONLY_FOR_MOD']); } }
elseif(!IS_AM)
{ $this->ajax_die($lang['ONLY_FOR_MOD']); }
@ -65,7 +66,7 @@ switch($type)
$tor_type = 0;
}
change_tor_type($attach_id, $tor_type);
$title = 'Тип торрента изменён';
$title = $lang['CHANGE_TOR_TYPE'];
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
@ -80,18 +81,16 @@ switch($type)
break;
case 'del_torrent';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm('Вы уверены, что хотите удалить торрент?');
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_TORRENT']);
delete_torrent($attach_id);
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
case 'del_torrent_move_topic';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm('Вы уверены, что хотите удалить и перенести топик?');
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
delete_torrent($attach_id);
$url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
break; }
$this->response['url'] = $url;
$this->response['title'] = $title;

View file

@ -43,22 +43,19 @@ switch ($field)
{
$this->response['new_value'] = htmlCHR($value);
}
else $this->ajax_die('Поле "Сайт" может содержать только http:// ссылку');
else $this->ajax_die($lang['WEBSITE_ERROR']);
break;
case 'user_gender':
if (!isset($lang['GENDER_SELECT'][$value]))
{
$this->ajax_die('error');
}
else
{
$this->response['new_value'] = $lang['GENDER_SELECT'][$value];
$this->ajax_die($lang['ERROR']);
}
else $this->response['new_value'] = $lang['GENDER_SELECT'][$value];
break;
case 'user_birthday':
if(!$bb_cfg['birthday']['enabled']) $this->ajax_die('off');
if(!$bb_cfg['birthday']['enabled']) $this->ajax_die($lang['MODULE_OFF']);
$data = explode('-', $value);
$b_day = (isset($data[2])) ? (int) $data[2] : 0;
$b_md = (isset($data[1])) ? (int) $data[1] : 0;
@ -98,7 +95,7 @@ switch ($field)
$value = (int) $value;
if ($value && !preg_match('#^\d{6,15}$#', $value))
{
$this->ajax_die('Поле "ICQ" может содержать только номер icq');
$this->ajax_die($lang['ICQ_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
@ -123,7 +120,7 @@ switch ($field)
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] OR $value > TIMENOW)
{
$this->ajax_die('invalid date: '. $this->request['value']);
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
}
$this->response['new_value'] = bb_date($value);
break;

View file

@ -4,18 +4,18 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang;
$mode = (string) $this->request['mode'];
$mode = (string) $this->request['mode'];
switch ($mode)
{
case 'tor_status':
$topics = (string) $this->request['topic_ids'];
$status = (int) $this->request['status'];
$topics = (string) $this->request['topic_ids'];
$status = (int) $this->request['status'];
// Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$status]))
{
$this->ajax_die("Такого статуса не существует: $new_status");
$this->ajax_die($lang['STATUS_DOES_EXIST'] . $new_status);
}
$topic_ids = DB()->fetch_rowset("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE topic_id IN($topics)", 'attach_id');
@ -33,12 +33,12 @@ switch ($mode)
$topic_title = (string) $this->request['topic_title'];
$new_title = clean_title($topic_title);
if (!$topic_id) $this->ajax_die('invalid topic_id (empty)');
if ($new_title == '') $this->ajax_die('Вы должны указать заголовок сообщения');
if (!$topic_id) $this->ajax_die($lang['INVALID_TOPIC_ID']);
if ($new_title == '') $this->ajax_die($lang['DONT_MESSAGE_TITLE']);
if (!$t_data = DB()->fetch_row("SELECT forum_id FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1"))
{
$this->ajax_die('invalid topic_id (not found in db)');
$this->ajax_die($lang['INVALID_TOPIC_ID_DB']);
}
$this->verify_mod_rights($t_data['forum_id']);

View file

@ -52,7 +52,7 @@ switch($this->request['type'])
break;
case 'reply';
if(!$post) $this->ajax_die('not post');
if(!$post) $this->ajax_die($lang['NOT_POST']);
$is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
if(bf($userdata['user_opt'], 'user_opt', 'allow_post'))
@ -95,7 +95,7 @@ switch($this->request['type'])
case 'edit':
case 'editor':
if(!$post) $this->ajax_die('not post');
if(!$post) $this->ajax_die($lang['NOT_POST']);
if(mb_strlen($post['post_text'], 'UTF-8') > 1000)
{
@ -151,7 +151,7 @@ switch($this->request['type'])
// по статусу раздачи
if (isset($bb_cfg['tor_cannot_edit'][$tor_status]))
{
$this->ajax_die("Вы не можете редактировать сообщение со статусом {$lang['tor_status'][$tor_status]}");
$this->ajax_die($lang['NOT_EDIT_TOR_STATUS'] .' - '. $lang['TOR_STATUS_NAME'][$tor_status]);
}
// проверенный, через время
if ($tor_status == TOR_APPROVED)
@ -163,8 +163,8 @@ switch($this->request['type'])
if ($last_edit_time < TIMENOW && ($disallowed_by_forum_perm || $disallowed_by_user_opt))
{
$how_msg = ($disallowed_by_user_opt) ? 'Вам запрещено' : 'Вы не можете';
$this->ajax_die("$how_msg редактировать сообщение со статусом <b>{$lang['tor_status'][$tor_status]}</b> по прошествии $days_after_last_edit дней");
$how_msg = ($disallowed_by_user_opt) ? $lang['EDIT_POST_NOT_1'] : $lang['EDIT_POST_NOT_2'];
$this->ajax_die("$how_msg" .$lang['EDIT_POST_AJAX']. $lang['TOR_STATUS_NAME'][$tor_status] . $lang['AFTER_THE_LAPSE']. "$days_after_last_edit" . $lang['TOR_STATUS_DAYS']);
}
}
}
@ -193,9 +193,9 @@ switch($this->request['type'])
</div>
<textarea id="message-'. $post_id .'" class="editor mrg_4" name="message" rows="18" cols="92">'. $post['post_text'] .'</textarea>
<div class="mrg_4 tCenter">
<input title="Alt+Enter" type="submit" value="Полное редактирвоание">
<input title="Alt+Enter" type="submit" value="'.$lang['PREVIEW'].'">
<input type="button" onclick="edit_post('. $post_id .');" value="'. $lang['CANCEL'] .'">
<input type="button" onclick="edit_post('. $post_id .', \'editor\', $(\'#message-'. $post_id .'\').val()); return false;" class="bold" value="'. $lang['EDIT_POST'] .'">
<input type="button" onclick="edit_post('. $post_id .', \'editor\', $(\'#message-'. $post_id .'\').val()); return false;" class="bold" value="'. $lang['SUBMIT'] .'">
</div><hr>
<script type="text/javascript">
var bbcode = new BBCode("message-'. $post_id .'");
@ -313,6 +313,3 @@ switch($this->request['type'])
$this->ajax_die('empty type');
break;
}

View file

@ -14,7 +14,7 @@ switch($mode)
if (empty($username))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">Вы должны выбрать имя</span>';
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'.$lang['CHOOSE_A_NAME'].'</span>';
}
else if($err = validate_username($username))
{
@ -26,7 +26,7 @@ switch($mode)
if (empty($email))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">Вы должны указать e-mail</span>';
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'.$lang['CHOOSE_E_MAIL'].'</span>';
}
else if($err = validate_email($email))
{
@ -38,17 +38,17 @@ switch($mode)
$pass_confirm = (string) $this->request['pass_confirm'];
if (empty($pass) || empty($pass_confirm))
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">Поля для ввода пароля не должны быть пустыми!</span>';
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'.$lang['CHOOSE_PASS'].'</span>';
}
else
{
if ($pass != $pass_confirm)
{
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">Введённые пароли не совпадают</span>';
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'.$lang['CHOOSE_PASS_ERR'].'</span>';
}
else
{
$html = '<img src="./images/good.gif"> <span class="seedmed bold">Пароли совпадают, можете продолжить регистрацию.</span>';
$html = '<img src="./images/good.gif"> <span class="seedmed bold">'.$lang['CHOOSE_PASS_OK'].'</span>';
}
}
break;

View file

@ -6,26 +6,26 @@ global $lang;
if (!isset($this->request['attach_id']))
{
$this->ajax_die('empty attach_id');
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
}
$attach_id = (int) $this->request['attach_id'];
$attach_id = (int) $this->request['attach_id'];
$torrent = DB()->fetch_row("SELECT at.attach_id, at.physical_filename
FROM ". BB_ATTACHMENTS_DESC ." at
WHERE at.attach_id = $attach_id
LIMIT 1");
if(!$torrent) $this->ajax_die('empty attach_id');
if(!$torrent) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
$filename = get_attachments_dir() .'/'. $torrent['physical_filename'];
if (($file_contents = @file_get_contents($filename)) === false)
{
if(IS_AM)
{
$this->ajax_die('torrent not found on disk: '. htmlCHR($filename));
$this->ajax_die($lang['TOR_NOT_FOUND'] ."\n\n". htmlCHR($filename));
}
else
{
$this->ajax_die('файл временно не доступен');
$this->ajax_die($lang['TOR_NOT_FOUND']);
}
}
@ -34,9 +34,11 @@ $tor_filelist = build_tor_filelist($file_contents);
function build_tor_filelist ($file_contents)
{
global $lang;
if (!$tor = bdecode($file_contents))
{
return 'invalid torrent file';
return $lang['TORFILE_INVALID'];
}
$torrent = new torrent($tor);
@ -125,7 +127,7 @@ class torrent
{
if (is_string($cur_files_ary))
{
$this->ajax_die('Error: cannot build filelist [string]');
$this->ajax_die($lang['ERROR_BUILD']);
}
$cur_files_ary[] = $this->build_file_item($name, $length);
}

View file

@ -57,8 +57,8 @@ $bb_cfg['css_ver'] = 1;
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.0.2';
$bb_cfg['tp_release_state'] = 'TP II r175';
$bb_cfg['tp_release_date'] = '28-07-2011';
$bb_cfg['tp_release_state'] = 'TP II r176';
$bb_cfg['tp_release_date'] = '29-07-2011';
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
$bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут";

View file

@ -1,13 +1,11 @@
<?php
//
// $Id$
// $Id: sphinxapi.php 2055 2009-11-06 23:09:58Z shodan $
//
//
// Copyright (c) 2001-2011, Andrew Aksyonoff
// Copyright (c) 2008-2011, Sphinx Technologies Inc
// All rights reserved
// Copyright (c) 2001-2008, Andrew Aksyonoff. All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License. You should have
@ -20,22 +18,21 @@
/////////////////////////////////////////////////////////////////////////////
/// known searchd commands
define ( "SEARCHD_COMMAND_SEARCH", 0 );
define ( "SEARCHD_COMMAND_EXCERPT", 1 );
define ( "SEARCHD_COMMAND_UPDATE", 2 );
define ( "SEARCHD_COMMAND_KEYWORDS", 3 );
define ( "SEARCHD_COMMAND_PERSIST", 4 );
define ( "SEARCHD_COMMAND_STATUS", 5 );
define ( "SEARCHD_COMMAND_FLUSHATTRS", 7 );
define ( "SEARCHD_COMMAND_SEARCH", 0 );
define ( "SEARCHD_COMMAND_EXCERPT", 1 );
define ( "SEARCHD_COMMAND_UPDATE", 2 );
define ( "SEARCHD_COMMAND_KEYWORDS",3 );
define ( "SEARCHD_COMMAND_PERSIST", 4 );
define ( "SEARCHD_COMMAND_STATUS", 5 );
define ( "SEARCHD_COMMAND_QUERY", 6 );
/// current client-side command implementation versions
define ( "VER_COMMAND_SEARCH", 0x118 );
define ( "VER_COMMAND_EXCERPT", 0x103 );
define ( "VER_COMMAND_SEARCH", 0x116 );
define ( "VER_COMMAND_EXCERPT", 0x100 );
define ( "VER_COMMAND_UPDATE", 0x102 );
define ( "VER_COMMAND_KEYWORDS", 0x100 );
define ( "VER_COMMAND_STATUS", 0x100 );
define ( "VER_COMMAND_QUERY", 0x100 );
define ( "VER_COMMAND_FLUSHATTRS", 0x100 );
/// known searchd status codes
define ( "SEARCHD_OK", 0 );
@ -60,8 +57,6 @@ define ( "SPH_RANK_WORDCOUNT", 3 ); ///< simple word-count weighting, rank is a
define ( "SPH_RANK_PROXIMITY", 4 );
define ( "SPH_RANK_MATCHANY", 5 );
define ( "SPH_RANK_FIELDMASK", 6 );
define ( "SPH_RANK_SPH04", 7 );
define ( "SPH_RANK_TOTAL", 8 );
/// known sort modes
define ( "SPH_SORT_RELEVANCE", 0 );
@ -83,7 +78,6 @@ define ( "SPH_ATTR_ORDINAL", 3 );
define ( "SPH_ATTR_BOOL", 4 );
define ( "SPH_ATTR_FLOAT", 5 );
define ( "SPH_ATTR_BIGINT", 6 );
define ( "SPH_ATTR_STRING", 7 );
define ( "SPH_ATTR_MULTI", 0x40000000 );
/// known grouping functions
@ -381,7 +375,7 @@ function sphFixUint ( $value )
/// sphinx searchd client class
class SphinxClient
class SphinxClient extends cache_dbg_common
{
var $_host; ///< searchd host (default is "localhost")
var $_port; ///< searchd port (default is 9312)
@ -419,6 +413,9 @@ class SphinxClient
var $_arrayresult; ///< whether $result["matches"] should be a hash or an array
var $_timeout; ///< connect timeout
var $bb_queries = array();
var $bb_indexes = array();
/////////////////////////////////////////////////////////////////////////////
// common stuff
/////////////////////////////////////////////////////////////////////////////
@ -426,6 +423,8 @@ class SphinxClient
/// create a new client object and fill defaults
function SphinxClient ()
{
$this->dbg_enabled = sql_dbg_enabled();
// per-client-object settings
$this->_host = "localhost";
$this->_port = 9312;
@ -556,6 +555,9 @@ class SphinxClient
/// connect to searchd server
function _Connect ()
{
$this->cur_query = "connect to: {$this->_host}";
$this->debug('start');
if ( $this->_socket!==false )
{
// we are in persistent connection mode, so we have a socket
@ -621,6 +623,7 @@ class SphinxClient
return false;
}
$this->debug('stop');
return $fp;
}
@ -637,7 +640,7 @@ class SphinxClient
$left = $len;
while ( $left>0 && !feof($fp) )
{
$chunk = fread ( $fp, min ( 8192, $left ) );
$chunk = fread ( $fp, $left );
if ( $chunk )
{
$response .= $chunk;
@ -737,7 +740,11 @@ class SphinxClient
/// set ranking mode
function SetRankingMode ( $ranker )
{
assert ( $ranker>=0 && $ranker<SPH_RANK_TOTAL );
assert ( $ranker==SPH_RANK_PROXIMITY_BM25
|| $ranker==SPH_RANK_BM25
|| $ranker==SPH_RANK_NONE
|| $ranker==SPH_RANK_WORDCOUNT
|| $ranker==SPH_RANK_PROXIMITY );
$this->_ranker = $ranker;
}
@ -953,6 +960,8 @@ class SphinxClient
$this->AddQuery ( $query, $index, $comment );
$results = $this->RunQueries ();
$this->_reqs = array (); // just in case it failed too early
$this->bb_queries = array();
$this->bb_indexes = array();
if ( !is_array($results) )
return false; // probably network error; error message should be already filled
@ -1084,6 +1093,8 @@ class SphinxClient
// store request to requests array
$this->_reqs[] = $req;
$this->bb_queries[] = $query;
$this->bb_indexes[] = $index;
return count($this->_reqs)-1;
}
@ -1108,8 +1119,11 @@ class SphinxClient
// send query, get response
$nreqs = count($this->_reqs);
$req = join ( "", $this->_reqs );
$len = 8+strlen($req);
$req = pack ( "nnNNN", SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, $len, 0, $nreqs ) . $req; // add header
$len = 4+strlen($req);
$req = pack ( "nnNN", SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, $len, $nreqs ) . $req; // add header
$this->cur_query = 'query: `'. join ('` `', $this->bb_queries) .'` idx: `'. join ('` `', $this->bb_indexes) .'`';
$this->debug('start');
if ( !( $this->_Send ( $fp, $req, $len+8 ) ) ||
!( $response = $this->_GetResponse ( $fp, VER_COMMAND_SEARCH ) ) )
@ -1118,8 +1132,12 @@ class SphinxClient
return false;
}
$this->debug('stop');
// query sent ok; we can reset reqs now
$this->_reqs = array ();
$this->bb_queries = array();
$this->bb_indexes = array();
// parse and return response
return $this->_ParseSearchResponse ( $response, $nreqs );
@ -1131,6 +1149,9 @@ class SphinxClient
$p = 0; // current position
$max = strlen($response); // max position for checks, to protect against broken responses
$this->cur_query = "parsing results";
$this->debug('start');
$results = array ();
for ( $ires=0; $ires<$nreqs && $p<$max; $ires++ )
{
@ -1243,10 +1264,6 @@ class SphinxClient
list(,$val) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
$attrvals[$attr][] = sphFixUint($val);
}
} else if ( $type==SPH_ATTR_STRING )
{
$attrvals[$attr] = substr ( $response, $p, $val );
$p += $val;
} else
{
$attrvals[$attr] = sphFixUint($val);
@ -1277,6 +1294,8 @@ class SphinxClient
}
}
$this->debug('stop');
$this->_MBPop ();
return $results;
}
@ -1311,37 +1330,22 @@ class SphinxClient
if ( !isset($opts["after_match"]) ) $opts["after_match"] = "</b>";
if ( !isset($opts["chunk_separator"]) ) $opts["chunk_separator"] = " ... ";
if ( !isset($opts["limit"]) ) $opts["limit"] = 256;
if ( !isset($opts["limit_passages"]) ) $opts["limit_passages"] = 0;
if ( !isset($opts["limit_words"]) ) $opts["limit_words"] = 0;
if ( !isset($opts["around"]) ) $opts["around"] = 5;
if ( !isset($opts["exact_phrase"]) ) $opts["exact_phrase"] = false;
if ( !isset($opts["single_passage"]) ) $opts["single_passage"] = false;
if ( !isset($opts["use_boundaries"]) ) $opts["use_boundaries"] = false;
if ( !isset($opts["weight_order"]) ) $opts["weight_order"] = false;
if ( !isset($opts["query_mode"]) ) $opts["query_mode"] = false;
if ( !isset($opts["force_all_words"]) ) $opts["force_all_words"] = false;
if ( !isset($opts["start_passage_id"]) ) $opts["start_passage_id"] = 1;
if ( !isset($opts["load_files"]) ) $opts["load_files"] = false;
if ( !isset($opts["html_strip_mode"]) ) $opts["html_strip_mode"] = "index";
if ( !isset($opts["allow_empty"]) ) $opts["allow_empty"] = false;
if ( !isset($opts["passage_boundary"]) ) $opts["passage_boundary"] = "none";
if ( !isset($opts["emit_zones"]) ) $opts["emit_zones"] = false;
/////////////////
// build request
/////////////////
// v.1.2 req
// v.1.0 req
$flags = 1; // remove spaces
if ( $opts["exact_phrase"] ) $flags |= 2;
if ( $opts["single_passage"] ) $flags |= 4;
if ( $opts["use_boundaries"] ) $flags |= 8;
if ( $opts["weight_order"] ) $flags |= 16;
if ( $opts["query_mode"] ) $flags |= 32;
if ( $opts["force_all_words"] ) $flags |= 64;
if ( $opts["load_files"] ) $flags |= 128;
if ( $opts["allow_empty"] ) $flags |= 256;
if ( $opts["emit_zones"] ) $flags |= 512;
$req = pack ( "NN", 0, $flags ); // mode=0, flags=$flags
$req .= pack ( "N", strlen($index) ) . $index; // req index
$req .= pack ( "N", strlen($words) ) . $words; // req words
@ -1350,10 +1354,8 @@ class SphinxClient
$req .= pack ( "N", strlen($opts["before_match"]) ) . $opts["before_match"];
$req .= pack ( "N", strlen($opts["after_match"]) ) . $opts["after_match"];
$req .= pack ( "N", strlen($opts["chunk_separator"]) ) . $opts["chunk_separator"];
$req .= pack ( "NN", (int)$opts["limit"], (int)$opts["around"] );
$req .= pack ( "NNN", (int)$opts["limit_passages"], (int)$opts["limit_words"], (int)$opts["start_passage_id"] ); // v.1.2
$req .= pack ( "N", strlen($opts["html_strip_mode"]) ) . $opts["html_strip_mode"];
$req .= pack ( "N", strlen($opts["passage_boundary"]) ) . $opts["passage_boundary"];
$req .= pack ( "N", (int)$opts["limit"] );
$req .= pack ( "N", (int)$opts["around"] );
// documents
$req .= pack ( "N", count($docs) );
@ -1530,7 +1532,6 @@ class SphinxClient
}
// build request
$this->_MBPush ();
$req = pack ( "N", strlen($index) ) . $index;
$req .= pack ( "N", count($attrs) );
@ -1555,28 +1556,18 @@ class SphinxClient
// connect, send query, get response
if (!( $fp = $this->_Connect() ))
{
$this->_MBPop ();
return -1;
}
$len = strlen($req);
$req = pack ( "nnN", SEARCHD_COMMAND_UPDATE, VER_COMMAND_UPDATE, $len ) . $req; // add header
if ( !$this->_Send ( $fp, $req, $len+8 ) )
{
$this->_MBPop ();
return -1;
}
if (!( $response = $this->_GetResponse ( $fp, VER_COMMAND_UPDATE ) ))
{
$this->_MBPop ();
return -1;
}
// parse response
list(,$updated) = unpack ( "N*", substr ( $response, 0, 4 ) );
$this->_MBPop ();
return $updated;
}
@ -1653,39 +1644,8 @@ class SphinxClient
$this->_MBPop ();
return $res;
}
//////////////////////////////////////////////////////////////////////////
// flush
//////////////////////////////////////////////////////////////////////////
function FlushAttributes ()
{
$this->_MBPush ();
if (!( $fp = $this->_Connect() ))
{
$this->_MBPop();
return -1;
}
$req = pack ( "nnN", SEARCHD_COMMAND_FLUSHATTRS, VER_COMMAND_FLUSHATTRS, 0 ); // len=0
if ( !( $this->_Send ( $fp, $req, 8 ) ) ||
!( $response = $this->_GetResponse ( $fp, VER_COMMAND_FLUSHATTRS ) ) )
{
$this->_MBPop ();
return -1;
}
$tag = -1;
if ( strlen($response)==4 )
list(,$tag) = unpack ( "N*", $response );
else
$this->_error = "unexpected response length";
$this->_MBPop ();
return $tag;
}
}
//
// $Id$
// $Id: sphinxapi.php 2055 2009-11-06 23:09:58Z shodan $
//

View file

@ -22,6 +22,8 @@ $lang['FLAGS'] = 'Flags';
$lang['FORUM_CONFIG'] = 'Forum settings';
$lang['TRACKER_CONFIG'] = 'Tracker settings';
$lang['RELEASE_TEMPLATES'] = 'Release Templates';
$lang['ACTIONS_LOG'] = 'Report on action';
$lang['SEARCH'] = 'Search';
//
// Index

View file

@ -306,7 +306,19 @@ $lang['POST_A_NEW_TOPIC'] = 'Post a new topic';
$lang['POST_A_REPLY'] = 'Post a reply';
$lang['POST_TOPIC_AS'] = 'Post topic as';
$lang['EDIT_POST'] = 'Edit post';
$lang['EDIT_POST_AJAX'] = "You can not edit the message with the status ";
$lang['EDIT_POST_NOT_1'] = 'You are not allowed ';
$lang['EDIT_POST_NOT_2'] = 'You can not ';
$lang['EDIT_POST_AJAX'] = 'You can not edit the message with the status ';
$lang['AFTER_THE_LAPSE'] = "after the lapse of ';
$lang['DONT_MESSAGE_TITLE'] = 'You have not specified the message header';
$lang['INVALID_TOPIC_ID'] = 'Topic Absent!';
$lang['INVALID_TOPIC_ID_DB'] = 'Topic does not exist in the database!';
$lang['NOT_POST'] = 'Absent Message';
$lang['NOT_EDIT_TOR_STATUS'] = 'You may not edit your hand with the status';
$lang['TOR_STATUS_DAYS'] = 'days'
$lang['OPTIONS'] = 'Options';
$lang['POST_ANNOUNCEMENT'] = 'Announcement';
@ -1188,6 +1200,19 @@ $lang['TOR_STATUS_NAME'] = array(
TOR_CHECKING => 'verified',
TOR_TMP => 'temporary',
);
$lang['TOR_STATUS_FAILED'] = 'Such status does not exist!';
$lang['TORRENT_FAILED'] = 'Distribution was not found!';
$lang['TOR_STATUS_DUB'] = 'Distribution has the same status';
$lang['TOR_DONT_CHANGE'] = 'Change of status can not be!';
$lang['TOR_STATUS_OF'] = 'Distribution has the status of:';
$lang['TOR_STATUS_CHANGED'] = 'Status changed: ';
$lang['BACK'] = ' back';
$lang['PROCEED'] = 'Proceed';
$lang['INVALID_ATTACH_ID'] = 'Missing file identifier!';
$lang['CHANGE_TOR_TYPE'] = 'Type the torrent successfully changed';
$lang['DEL_TORRENT'] = 'Are you sure you want to delete the torrent?';
$lang['DEL_MOVE_TORRENT'] = 'Are you sure you want to delete and move the topic?';
//end torrent status mod
$lang['BT_TOPIC_TITLE'] = 'Topic title';
@ -1332,9 +1357,6 @@ $lang['ONLY_FOR_SUPER_ADMIN'] = 'This option only for super admins';
$lang['ACCESS'] = 'Access';
$lang['ACCESS_SRV_LOAD'] = 'Depend on server load';
$lang['LOGS'] = 'Topic history';
$lang['LAST_IP'] = 'Last IP:';
$lang['REG_IP'] = 'Registration IP:';
$lang['ALREADY_REG_IP'] = 'With your IP-address is already registered user %s. If you have not previously registered on our tracker, mail to <a href="mailto:%s">Administrator</ a>';
//
@ -1347,11 +1369,6 @@ $lang['NOT_ADMIN'] = 'You are not authorised to administer this board';
$lang['COOKIES_REQUIRED'] = 'Cookies must be enabled!';
$lang['SESSION_EXPIRED'] = 'Session expired';
// FLAGHACK-start
$lang['COUNTRY_FLAG'] = 'Country Flag';
$lang['SELECT_COUNTRY'] = 'SELECT COUNTRY' ;
// FLAGHACK-end
// Sort memberlist per letter
$lang['SORT_PER_LETTER'] = 'Show only usernames starting with';
$lang['OTHERS'] = 'others';
@ -1514,26 +1531,6 @@ $lang['REPORTS_DELETED'] = 'The selected reports were deleted.';//
// Reports [END]
//
// Medal [BEGIN]
$lang['MEDAL'] = 'Honour roll';
$lang['TOP_10'] = 'Ten best';
$lang['TOP_10_RATIO'] = 'on Upload/Download Ratio';
$lang['TOP_10_SIZE_DOWNLOAD'] = 'on volume of the loaded';
$lang['BEST_RELIZER'] = 'Ten best';
$lang['BEST_RELEASES'] = 'The best releases';
$lang['DOWNLOAD_MONTH'] = 'Downloadings of releases for a month';
$lang['THANKS_MONTH'] = 'Thank\'s of releases for month';
$lang['BEST_RELEASES_MONTH'] = 'The best releases for a month';
$lang['BEST_RELEASES_WEEK'] = 'The best releases for a week';
$lang['THANKS'] = 'Thanks';
$lang['RELEASES'] = 'Releases';
$lang['AVERAGE_RATING'] = 'Average estimation';
$lang['BEST_COUNT_DOWNLOAD'] = 'on count downloadings';
$lang['BEST_COUNT_THANKS'] = 'on count thanks';
$lang['DOWNLOADS'] = 'Downloads';
$lang['ON_AVERAGE'] = 'On average';
// Medal [END]
// search
$lang['SEARCH_S'] = 'search...';
$lang['FORUM_S'] = 'on forum';
@ -1551,3 +1548,20 @@ $lang['FILELIST'] = 'Filelist';
$lang['COLLAPSE'] = 'Collapse directory';
$lang['EXPAND'] = 'Expand';
$lang['SWITCH'] = 'Switch';
$lang['EMPTY_ATTACH_ID'] = 'Missing file identifier!';
$lang['TOR_NOT_FOUND'] = 'File is missing on the server!';
$lang['ERROR_BUILD'] = 'Error: unable to build a list of files';
$lang['TORFILE_INVALID'] = 'Torrent file is corrupt';
// FILELIST
// Profile
$lang['WEBSITE_ERROR'] = 'The "site" may contain only http://sitename';
$lang['ICQ_ERROR'] = 'The field of "ICQ" may contain only icq number';
$lang['INVALID_DATE'] = 'Error date ';
// Register
$lang['CHOOSE_A_NAME'] = 'You should choose a name';
$lang['CHOOSE_E_MAIL'] = 'You must specify the e-mail';
$lang['CHOOSE_PASS'] = 'Field for the password must not be empty!';
$lang['CHOOSE_PASS_ERR'] = 'Entered passwords do not match';
$lang['CHOOSE_PASS_OK'] = 'Passwords match, you can proceed with the registration.';

View file

@ -25,7 +25,7 @@ $lang['FORUM_CONFIG'] = 'Настройки форумов';
$lang['TRACKER_CONFIG'] = 'Настройки трекера';
$lang['RELEASE_TEMPLATES'] = 'Шаблоны для релизов';
$lang['ACTIONS_LOG'] = 'Отчет по действиям';
$lang['SEARCH'] = 'Поиск пользователей';
$lang['SEARCH'] = 'Поиск';
//
//Welcome page

View file

@ -311,9 +311,19 @@ $lang['POST_A_NEW_TOPIC'] = 'Начать новую тему';
$lang['POST_A_REPLY'] = 'Ответить';
$lang['POST_TOPIC_AS'] = 'Статус создаваемой темы';
$lang['EDIT_POST'] = 'Редактировать сообщение';
$lang['EDIT_POST_NOT_1'] = "Вам запрещено";
$lang['EDIT_POST_NOT_2'] = "Вы не можете";
$lang['EDIT_POST_AJAX'] = " редактировать сообщение со статусом <b>";
$lang['EDIT_POST_NOT_1'] = 'Вам запрещено ';
$lang['EDIT_POST_NOT_2'] = 'Вы не можете ';
$lang['EDIT_POST_AJAX'] = 'редактировать сообщение со статусом';
$lang['AFTER_THE_LAPSE'] = 'по прошествии ';
$lang['DONT_MESSAGE_TITLE'] = 'Вы не указали заголовок сообщения';
$lang['INVALID_TOPIC_ID'] = 'Топик отсутсвует!';
$lang['INVALID_TOPIC_ID_DB'] = 'Топик отсутсвует в базе данных!';
$lang['NOT_POST'] = 'Сообщение отсутсвует';
$lang['NOT_EDIT_TOR_STATUS'] = 'Вы не можете редактировать раздачу со статусом';
$lang['TOR_STATUS_DAYS'] = 'дней';
$lang['OPTIONS'] = 'Настройки';
$lang['POST_ANNOUNCEMENT'] = 'Объявление';
@ -570,6 +580,7 @@ $lang['GENDER_SELECT'] = array(
1 => 'Мужской',
2 => 'Женский'
);
$lang['MODULE_OFF'] = 'Модуль отключен!';
$lang['BIRTHDAY'] = 'День рождения';
$lang['WRONG_BIRTHDAY_FORMAT'] = 'Дата рождения указана не верно';
$lang['AGE'] = 'Возраст';
@ -1197,6 +1208,21 @@ $lang['TOR_STATUS_NAME'] = array(
TOR_CHECKING => 'проверяется',
TOR_TMP => 'временная',
);
$lang['TOR_STATUS_FAILED'] = 'Такого статуса не существует!';
$lang['TORRENT_FAILED'] = 'Раздача не найдена!';
$lang['TOR_STATUS_DUB'] = 'Раздача имеет тот же статус';
$lang['TOR_DONT_CHANGE'] = 'Изменение статуса невозможно!';
$lang['TOR_STATUS_OF'] = 'Раздача имеет статус:';
$lang['TOR_STATUS_CHANGED'] = 'Статус изменил: ';
$lang['BACK'] = ' назад';
$lang['PROCEED'] = 'Продолжить';
$lang['INVALID_ATTACH_ID'] = 'Отсутствует идентификатор файла!';
$lang['CHANGE_TOR_TYPE'] = 'Тип торрента успешно изменён';
$lang['DEL_TORRENT'] = 'Вы уверены, что хотите удалить торрент?';
$lang['DEL_MOVE_TORRENT'] = 'Вы уверены, что хотите удалить и перенести топик?';
$lang['STATUS_DOES_EXIST'] = 'Такого статуса не существует: ';
//end torrent status mod
$lang['BT_TOPIC_TITLE'] = 'Название темы';
@ -1341,9 +1367,6 @@ $lang['ONLY_FOR_SUPER_ADMIN'] = 'Эта опция доступна только
$lang['ACCESS'] = 'Доступ';
$lang['ACCESS_SRV_LOAD'] = 'Зависит от загрузки сервера';
$lang['LOGS'] = 'История темы';
$lang['LAST_IP'] = 'Последний IP:';
$lang['REG_IP'] = 'IP регистрации:';
$lang['ALREADY_REG_IP'] = 'С вашего IP-адреса уже зарегистрирован пользователь %s. Если Вы ранее не регистрировались на нашем трекере, обратитесь к <a href="mailto:%s">Администрации</a>';
//
@ -1356,11 +1379,6 @@ $lang['NOT_ADMIN'] = 'У вас нет прав на администриров
$lang['COOKIES_REQUIRED'] = 'Куки должны быть включены!';
$lang['SESSION_EXPIRED'] = 'Сессия устарела';
// FLAGHACK-start
$lang['COUNTRY_FLAG'] = 'Флаг страны';
$lang['SELECT_COUNTRY'] = 'ВЫБЕРИТЕ СТРАНУ' ;
// FLAGHACK-end
// Sort memberlist per letter
$lang['SORT_PER_LETTER'] = 'Имя начинается с буквы';
$lang['OTHERS'] = 'другие';
@ -1524,26 +1542,6 @@ $lang['REPORTS_DELETED'] = 'Выбранные сообщения удалены
// Reports [END]
//
// Medal [BEGIN]
$lang['MEDAL'] = 'Доска почета';
$lang['TOP_10'] = 'Десятка лучших';
$lang['TOP_10_RATIO'] = 'по Upload/Download Ratio';
$lang['TOP_10_SIZE_DOWNLOAD'] = 'по объему загруженного';
$lang['BEST_RELIZER'] = 'Десятка лучших';
$lang['BEST_RELEASES'] = 'Лучшие раздачи';
$lang['DOWNLOAD_MONTH'] = 'Скачивания релизов за месяц';
$lang['THANKS_MONTH'] = 'Благодарности релизов за месяц';
$lang['BEST_RELEASES_MONTH'] = 'Лучшие релизы за месяц';
$lang['BEST_RELEASES_WEEK'] = 'Лучшие релизы за неделю';
$lang['THANKS'] = 'Спасибо';
$lang['RELEASES'] = 'Релизов';
$lang['AVERAGE_RATING'] = 'Ср. оценка';
$lang['BEST_COUNT_DOWNLOAD'] = 'по сумме скачиваний';
$lang['BEST_COUNT_THANKS'] = 'по числу благодарностей';
$lang['DOWNLOADS'] = 'Скачиваний';
$lang['ON_AVERAGE'] = 'В среднем';
// Medal [END]
// search
$lang['SEARCH_S'] = 'поиск...';
$lang['FORUM_S'] = 'по форуму';
@ -1559,5 +1557,23 @@ $lang['CALLSEED'] = 'Позвать скачавших';
// FILELIST
$lang['FILELIST'] = 'Список файлов';
$lang['COLLAPSE'] = 'Свернуть директории';
$lang['EXPAND'] = 'Развернуть';
$lang['SWITCH'] = 'Переключить';
$lang['EXPAND'] = 'Развернуть';
$lang['SWITCH'] = 'Переключить';
$lang['EMPTY_ATTACH_ID'] = 'Отсутсвует идентификатор файла!';
$lang['TOR_NOT_FOUND'] = 'Файл отсутсвует на сервере!';
$lang['ERROR_BUILD'] = 'Ошибка: не удалось выстроить список файлов';
$lang['TORFILE_INVALID'] = 'Торрент-файл поврежден';
// FILELIST
// Профиль
$lang['WEBSITE_ERROR'] = 'Поле "Сайт" может содержать только http://ссылку';
$lang['ICQ_ERROR'] = 'Поле "ICQ" может содержать только номер icq';
$lang['INVALID_DATE'] = 'Ошибка даты ';
// Регистрация
$lang['CHOOSE_A_NAME'] = 'Вы должны выбрать имя';
$lang['CHOOSE_E_MAIL'] = 'Вы должны указать e-mail';
$lang['CHOOSE_PASS'] = 'Поля для ввода пароля не должны быть пустыми!';
$lang['CHOOSE_PASS_ERR'] = 'Введённые пароли не совпадают';
$lang['CHOOSE_PASS_OK'] = 'Пароли совпадают, можете продолжить регистрацию.';

View file

@ -232,15 +232,15 @@
<tr class="row3">
<th colspan="3" class="{postrow.attach.tor_reged.DL_LINK_CLASS}">{postrow.attach.tor_reged.DOWNLOAD_NAME}<!-- IF postrow.attach.tor_reged.TOR_FROZEN == 0 --><!-- IF MAGNET_LINKS -->&nbsp;{postrow.attach.tor_reged.MAGNET}<!-- ENDIF --><!-- ENDIF --></th>
</tr>
<!-- IF postrow.attach.tor_reged.TOR_SILVER_GOLD == 2 -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" />&nbsp;{L_SILVER_STATUS}&nbsp;<img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" /></th>
</tr>
<!-- ELSEIF postrow.attach.tor_reged.TOR_SILVER_GOLD == 1 -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" />&nbsp;{L_GOLD_STATUS}&nbsp;<img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" /></th>
</tr>
<!-- ENDIF -->
<!-- IF postrow.attach.tor_reged.TOR_SILVER_GOLD == 2 && $bb_cfg['gold_silver_enabled'] -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" />&nbsp;{L_SILVER_STATUS}&nbsp;<img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" /></th>
</tr>
<!-- ELSEIF postrow.attach.tor_reged.TOR_SILVER_GOLD == 1 && $bb_cfg['gold_silver_enabled'] -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" />&nbsp;{L_GOLD_STATUS}&nbsp;<img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" /></th>
</tr>
<!-- ENDIF -->
<tr class="row1">
<td width="15%">{L_TRACKER}:</td>
<td width="70%">