mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
r129
Упрощение работы с постами, используя ajax git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@129 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
9e37f8dd09
commit
2d87b6640e
7 changed files with 49 additions and 26 deletions
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if(!$bb_cfg['reports_enabled']) return;
|
||||||
if (!empty($setmodules))
|
if (!empty($setmodules))
|
||||||
{
|
{
|
||||||
$file = basename(__FILE__);
|
$file = basename(__FILE__);
|
||||||
|
@ -9,11 +10,11 @@ if (!empty($setmodules))
|
||||||
}
|
}
|
||||||
|
|
||||||
define('IN_PHPBB', true);
|
define('IN_PHPBB', true);
|
||||||
$phpbb_root_path = './../';
|
define('BB_ROOT', './../');
|
||||||
$no_page_header = true;
|
|
||||||
require("./pagestart.php");
|
require("./pagestart.php");
|
||||||
require($phpbb_root_path . "includes/functions_report.php");
|
require(BB_ROOT . "includes/functions_report.php");
|
||||||
require($phpbb_root_path . "includes/functions_report_admin.php");
|
require(BB_ROOT . "includes/functions_report_admin.php");
|
||||||
|
|
||||||
$return_links = array(
|
$return_links = array(
|
||||||
'index' => '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="' . append_sid("index.php?pane=right") . '">', '</a>'),
|
'index' => '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="' . append_sid("index.php?pane=right") . '">', '</a>'),
|
||||||
|
|
|
@ -21,6 +21,12 @@ switch ($ajax->action)
|
||||||
require(INC_DIR .'bbcode.php');
|
require(INC_DIR .'bbcode.php');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'posts':
|
||||||
|
require(INC_DIR .'bbcode.php');
|
||||||
|
require(INC_DIR .'functions_post.php');
|
||||||
|
require(INC_DIR .'functions_admin.php');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'view_torrent':
|
case 'view_torrent':
|
||||||
case 'mod_action':
|
case 'mod_action':
|
||||||
case 'change_tor_status':
|
case 'change_tor_status':
|
||||||
|
@ -69,6 +75,7 @@ class ajax_common
|
||||||
'view_message' => array('guest'),
|
'view_message' => array('guest'),
|
||||||
'view_torrent' => array('guest'),
|
'view_torrent' => array('guest'),
|
||||||
'user_register' => array('guest'),
|
'user_register' => array('guest'),
|
||||||
|
'posts' => array('guest'),
|
||||||
);
|
);
|
||||||
|
|
||||||
var $action = null;
|
var $action = null;
|
||||||
|
@ -257,8 +264,7 @@ class ajax_common
|
||||||
*/
|
*/
|
||||||
function prompt_for_confirm ($confirm_msg)
|
function prompt_for_confirm ($confirm_msg)
|
||||||
{
|
{
|
||||||
global $lang;
|
if(empty($confirm_msg)) $this->ajax_die('false');
|
||||||
if(!empty($confirm_msg)) $confirm_msg = $lang['CONFIRM'];
|
|
||||||
|
|
||||||
$this->response['prompt_confirm'] = 1;
|
$this->response['prompt_confirm'] = 1;
|
||||||
$this->response['confirm_msg'] = $confirm_msg;
|
$this->response['confirm_msg'] = $confirm_msg;
|
||||||
|
@ -401,4 +407,8 @@ class ajax_common
|
||||||
require(AJAX_DIR .'mod_action.php');
|
require(AJAX_DIR .'mod_action.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function posts()
|
||||||
|
{
|
||||||
|
require(AJAX_DIR .'posts.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,6 +408,7 @@ $bb_cfg['user_signature_end'] = '</span>'; //Это позволит испол
|
||||||
$bb_cfg['use_posts_cache'] = true; // if you switch from ON to OFF, you need to TRUNCATE `bb_posts_html` table
|
$bb_cfg['use_posts_cache'] = true; // if you switch from ON to OFF, you need to TRUNCATE `bb_posts_html` table
|
||||||
$bb_cfg['posts_cache_days_keep'] = 14;
|
$bb_cfg['posts_cache_days_keep'] = 14;
|
||||||
$bb_cfg['max_post_length'] = 120000; // bytes
|
$bb_cfg['max_post_length'] = 120000; // bytes
|
||||||
|
$bb_cfg['use_ajax_posts'] = true;
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
$bb_cfg['search_engine_type'] = 'mysql'; // none, mysql, sphinx
|
$bb_cfg['search_engine_type'] = 'mysql'; // none, mysql, sphinx
|
||||||
|
|
|
@ -2,23 +2,19 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
if (method_exists(CACHE('tr_cache'), 'gc'))
|
$gc_cache = array(
|
||||||
|
'tr_cache',
|
||||||
|
'bb_cache',
|
||||||
|
'session_cache',
|
||||||
|
'bb_login_err',
|
||||||
|
'bb_cap_sid',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($gc_cache as $cache_name)
|
||||||
{
|
{
|
||||||
$changes = CACHE('tr_cache')->gc();
|
if (method_exists(CACHE($cache_name), 'gc'))
|
||||||
|
{
|
||||||
|
$changes = CACHE($cache_name)->gc();
|
||||||
$cron_runtime_log .= date('Y-m-d H:i:s') ." -- tr -- $changes rows deleted\n";
|
$cron_runtime_log .= date('Y-m-d H:i:s') ." -- tr -- $changes rows deleted\n";
|
||||||
}
|
}
|
||||||
if (method_exists(CACHE('bb_cache'), 'gc'))
|
|
||||||
{
|
|
||||||
$changes = CACHE('bb_cache')->gc();
|
|
||||||
$cron_runtime_log .= date('Y-m-d H:i:s') ." -- bb -- $changes rows deleted\n";
|
|
||||||
}
|
|
||||||
if (method_exists(CACHE('session_cache'), 'gc'))
|
|
||||||
{
|
|
||||||
$changes = CACHE('session_cache')->gc(TIMENOW + $bb_cfg['session_cache_gc_ttl']);
|
|
||||||
$cron_runtime_log .= date('Y-m-d H:i:s') ." -- ss -- $changes rows deleted\n";
|
|
||||||
}
|
|
||||||
if (method_exists(CACHE('bb_login_err'), 'gc'))
|
|
||||||
{
|
|
||||||
$changes = CACHE('bb_login_err')->gc();
|
|
||||||
$cron_runtime_log .= date('Y-m-d H:i:s') ." -- ss -- $changes rows deleted\n";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -639,6 +639,8 @@ else
|
||||||
define('WORD_LIST_OBTAINED', TRUE);
|
define('WORD_LIST_OBTAINED', TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($post_info['post_attachment'] && !IS_AM) $message = $post_info['topic_title'];
|
||||||
|
|
||||||
// Use trim to get rid of spaces placed there by MS-SQL 2000
|
// Use trim to get rid of spaces placed there by MS-SQL 2000
|
||||||
$quote_username = ( trim($post_info['post_username']) != '' ) ? $post_info['post_username'] : $post_info['username'];
|
$quote_username = ( trim($post_info['post_username']) != '' ) ? $post_info['post_username'] : $post_info['username'];
|
||||||
$message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';
|
$message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';
|
||||||
|
|
|
@ -14,6 +14,16 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- ENDIF / LOGGED_IN -->
|
<!-- ENDIF / LOGGED_IN -->
|
||||||
|
|
||||||
|
<!-- IF $bb_cfg['use_ajax_posts'] && (AUTH_DELETE || AUTH_REPLY) -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
ajax.callback.posts = function(data) {
|
||||||
|
if(data.redirect) document.location.href = data.redirect;
|
||||||
|
if(data.hide) $('tbody#post_'+ data.post_id).hide();
|
||||||
|
if(data.quote) $('textarea.editor').attr('value', $('textarea.editor').val() + data.message +' ').focus();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF SPLIT_FORM -->
|
<!-- IF SPLIT_FORM -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function set_hid_chbox (id)
|
function set_hid_chbox (id)
|
||||||
|
@ -203,9 +213,9 @@ function set_hid_chbox (id)
|
||||||
<!-- IF postrow.MOD_CHECKBOX --><input type="checkbox" class="select_post" onclick="set_hid_chbox('{postrow.POST_ID}');"><!-- ENDIF -->
|
<!-- IF postrow.MOD_CHECKBOX --><input type="checkbox" class="select_post" onclick="set_hid_chbox('{postrow.POST_ID}');"><!-- ENDIF -->
|
||||||
|
|
||||||
<p style="float: right;<!-- IF TEXT_BUTTONS --> padding: 3px 2px 4px;<!-- ELSE --> padding: 1px 6px 2px;<!-- ENDIF -->" class="post_btn_1">
|
<p style="float: right;<!-- IF TEXT_BUTTONS --> padding: 3px 2px 4px;<!-- ELSE --> padding: 1px 6px 2px;<!-- ENDIF -->" class="post_btn_1">
|
||||||
<!-- IF postrow.QUOTE --><a class="txtb" href="{QUOTE_URL}{postrow.POST_ID}">{QUOTE_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
<!-- IF postrow.QUOTE --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="ajax.exec({ action: 'posts', post_id: {postrow.POST_ID}, type: 'quote'}); return false;<!-- ELSE -->{QUOTE_URL}{postrow.POST_ID}<!-- ENDIF -->">{QUOTE_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||||
<!-- IF postrow.EDIT --><a class="txtb" href="{EDIT_POST_URL}{postrow.POST_ID}">{EDIT_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
<!-- IF postrow.EDIT --><a class="txtb" href="{EDIT_POST_URL}{postrow.POST_ID}">{EDIT_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||||
<!-- IF postrow.DELETE --><a class="txtb" href="{DELETE_POST_URL}{postrow.POST_ID}">{DELETE_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
<!-- IF postrow.DELETE --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="ajax.exec({ action: 'posts', post_id: {postrow.POST_ID}, type: 'delete'}); return false;<!-- ELSE -->{DELETE_POST_URL}{postrow.POST_ID}<!-- ENDIF -->">{DELETE_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||||
<!-- IF postrow.IP --><a class="txtb" href="{IP_POST_URL}{postrow.POST_ID}&t={TOPIC_ID}">{IP_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
<!-- IF postrow.IP --><a class="txtb" href="{IP_POST_URL}{postrow.POST_ID}&t={TOPIC_ID}">{IP_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||||
<!-- IF postrow.REPORT -->{postrow.REPORT}{POST_BTN_SPACER}<!-- ENDIF -->
|
<!-- IF postrow.REPORT -->{postrow.REPORT}{POST_BTN_SPACER}<!-- ENDIF -->
|
||||||
<!-- IF AUTH_MOD -->
|
<!-- IF AUTH_MOD -->
|
||||||
|
|
|
@ -1042,6 +1042,9 @@ if ($bb_cfg['show_quick_reply'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($is_auth as $name => $is)
|
||||||
|
{
$template->assign_vars(array(strtoupper($name) => $is));
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PG_ROW_CLASS' => isset($pg_row_class) ? $pg_row_class : 'row1',
|
'PG_ROW_CLASS' => isset($pg_row_class) ? $pg_row_class : 'row1',
|
||||||
));
|
));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue