From 4a193a378ee2f52ca5c97fb2cb34884744a41d2f Mon Sep 17 00:00:00 2001 From: pherum83 Date: Thu, 28 Jul 2011 21:23:28 +0000 Subject: [PATCH] r176 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit дружим аякс с ленгами git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@176 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/ajax/change_tor_status.php | 14 +- upload/ajax/change_torrent.php | 15 +- upload/ajax/edit_user_profile.php | 15 +- upload/ajax/mod_action.php | 14 +- upload/ajax/posts.php | 17 +- upload/ajax/user_register.php | 10 +- upload/ajax/view_torrent.php | 16 +- upload/config.php | 4 +- upload/includes/sphinxapi.php | 3342 ++++++++--------- upload/language/lang_english/lang_admin.php | 2 + upload/language/lang_english/lang_main.php | 74 +- upload/language/lang_russian/lang_admin.php | 2 +- upload/language/lang_russian/lang_main.php | 82 +- upload/templates/default/viewtopic_attach.tpl | 18 +- 14 files changed, 1806 insertions(+), 1819 deletions(-) diff --git a/upload/ajax/change_tor_status.php b/upload/ajax/change_tor_status.php index 9b439ad77..16bf26216 100644 --- a/upload/ajax/change_tor_status.php +++ b/upload/ajax/change_tor_status.php @@ -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); } } diff --git a/upload/ajax/change_torrent.php b/upload/ajax/change_torrent.php index 81009e00b..e6abf891b 100644 --- a/upload/ajax/change_torrent.php +++ b/upload/ajax/change_torrent.php @@ -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; \ No newline at end of file diff --git a/upload/ajax/edit_user_profile.php b/upload/ajax/edit_user_profile.php index c37decc0d..7ed80c6f3 100644 --- a/upload/ajax/edit_user_profile.php +++ b/upload/ajax/edit_user_profile.php @@ -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; diff --git a/upload/ajax/mod_action.php b/upload/ajax/mod_action.php index ae858586c..eca7c36b0 100644 --- a/upload/ajax/mod_action.php +++ b/upload/ajax/mod_action.php @@ -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']); diff --git a/upload/ajax/posts.php b/upload/ajax/posts.php index f2783c616..7df1a5bb8 100644 --- a/upload/ajax/posts.php +++ b/upload/ajax/posts.php @@ -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 редактировать сообщение со статусом {$lang['tor_status'][$tor_status]} по прошествии $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'])
- + - +