พัฒนาโดย :: ABDev
Version ::1.2.5
ดาวน์โหลดได้ที่ :: https://www.mindphp.com/download/files/9 ... 5-zip.html
ไฟล์ที่ใช้ในการติดตั้งเเละวิธีการติดตั้ง
เปิดไฟล์ -> adm/style/acp_forums.html,
ค้นหา ::
โค้ด: เลือกทั้งหมด
<fieldset>
<legend>{L_FORUM_PRUNE_SETTINGS}</legend>
โค้ด: เลือกทั้งหมด
<!-- INCLUDE acp_attributes_forums.html -->
ค้นหา ::
โค้ด: เลือกทั้งหมด
.phpinfo td, .phpinfo th, .phpinfo h2, .phpinfo h1 {
text-align: left;
}
โค้ด: เลือกทั้งหมด
/* Class for Quick Title Edition
---------------------------------------- */
#acp_attributes option:disabled {
color: #808080;
font-style: italic;
}
ค้นหา ::
โค้ด: เลือกทั้งหมด
$user->add_lang('acp/forums');
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
// No break here
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$forum_data += array(
'default_attr' => request_var('default_attr', 0),
'hide_attr' => request_var('hide_attr', array(0)),
);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
// On add, add empty forum_options... else do not consider it (not updating it)
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$forum_data += array('force_attr' => request_var('force_attr', false));
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED'];
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$from_attr = request_var('from_attr', 0);
if ( $action == 'add' && $from_attr )
{
foreach ( $qte->attr as $attr )
{
if ( $attr['attr_auths'] )
{
$attr['attr_auths'] = json_decode($attr['attr_auths'], true);
if ( !empty($attr['attr_auths'][0]['forums_ids']) && in_array($from_attr, $attr['attr_auths'][0]['forums_ids']) )
{
$attr['attr_auths'][0]['forums_ids'][] = $forum_data['forum_id'];
$sql_ary = array('attr_auths' => json_encode($attr['attr_auths']));
$sql = 'UPDATE ' . TOPICS_ATTR_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE attr_id = ' . (int) $attr['attr_id'];
$db->sql_query($sql);
}
}
}
$cache->destroy('_attr');
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$forum_data['forum_password_confirm'] = $forum_data['forum_password'];
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$forum_data += array('default_attr' => 0, 'hide_attr' => array());
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
}
}
$forum_rules_data = array(
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$forum_data += array('force_attr' => false);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
return;
break;
case 'delete':
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
// init ary
$tpl_fields = array();
if ( $action == 'edit' )
{
$qte->attr_default($forum_id, $forum_data['default_attr']);
$group_ids = unserialize(trim($forum_data['hide_attr']));
if ( $group_ids === false )
{
$group_ids = array();
}
$tpl_fields += array('S_GROUPS_HIDE_ATTR' => $qte->qte_group_select($group_ids));
}
$tpl_fields += array('S_FORCE_ATTR' => $forum_data['force_attr'] ? true : false);
// send to template
$template->assign_vars($tpl_fields);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
validate_range($range_test_ary, $errors);
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !empty($forum_data['hide_attr']) )
{
$forum_data['hide_attr'] = serialize($forum_data['hide_attr']);
}
else
{
$forum_data['hide_attr'] = '';
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
// Set up general vars
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$user->add_lang('mods/info_mcp_attributes');
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
// Execute overall actions
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !isset($this->imageset_keys['custom']) )
{
$this->imageset_keys['custom'] = array();
}
$this->imageset_keys['custom'] += array_merge($this->imageset_keys['custom'], array('icon_topic_solved', 'icon_topic_cancel'));
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
$user->add_lang(array('viewtopic', 'viewforum'));
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$to_topic_id = request_var('to_topic_id', 0);
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$attr_id = request_var('attr_id', 0);
if ( $attr_id && !$merge_select )
{
$qte->mcp_attr_apply($attr_id, $topic_id_list);
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
// Grab icons
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$forum_info['hide_attr'] = unserialize(trim($forum_info['hide_attr']));
if ( $forum_info['hide_attr'] === false )
{
$forum_info['hide_attr'] = array();
}
$qte->attr_select($forum_id, $user->data['user_id'], '', $forum_info['hide_attr']);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
foreach ($topic_list as $topic_id)
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$qte->get_users_by_topic_id($topic_list);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$template->assign_block_vars('topicrow', $topic_row);
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !empty($row['topic_attr_id']) )
{
$topic_row += array(
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($row['topic_attr_id'], $row['topic_attr_user'], $row['topic_attr_time']),
);
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
// Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$shadow += array(
'topic_attr_id' => (int) $row['topic_attr_id'],
'topic_attr_user' => (int) $row['topic_attr_user'],
'topic_attr_time' => (int) $row['topic_attr_time'],
);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_topic_id = $db->sql_nextid();
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$sql_ary += array(
'topic_attr_id' => (int) $topic_row['topic_attr_id'],
'topic_attr_user' => (int) $topic_row['topic_attr_user'],
'topic_attr_time' => (int) $topic_row['topic_attr_time'],
);
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
break;
case 'unapproved_topics':
case 'unapproved_posts':
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( ($post_info['topic_first_post_id'] == $post_info['post_id']) && !empty($post_info['topic_attr_id']) )
{
$qte->get_users_by_topic_id(array($post_info['topic_id']));
$template->assign_vars(array(
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($post_info['topic_attr_id']
, $post_info['topic_attr_user'], $post_info['topic_attr_time']),
));
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$rowset = array();
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$sql = str_replace(', t.topic_title AS post_subject', ', t.topic_title AS post_subject
, t.topic_attr_id AS post_attr_id
, t.topic_attr_user AS post_attr_user, t.topic_attr_time AS post_attr_time', $sql);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
foreach ($rowset as $row)
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$topic_list = array();
foreach( $rowset as $row )
{
$topic_list[] = (int) $row['topic_id'];
}
$qte->get_users_by_topic_id($topic_list);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
}
unset($rowset, $forum_names);
// Now display the page
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !empty($row['post_attr_id']) && ($mode == 'unapproved_topics') )
{
$template->alter_block_array('postrow', array(
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($row['post_attr_id'], $row['post_attr_user'], $row['post_attr_time']),
), true, 'change');
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
foreach ($rowset as $i => $row)
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$topic_list = array();
foreach( $rowset as $row )
{
$topic_list[] = (int) $row['topic_id'];
}
$qte->get_users_by_topic_id($topic_list);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
// Display not already displayed Attachments for this post, we already parsed them. ;)
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !empty($topic_info['topic_attr_id']) && !$i )
{
$template->alter_block_array('postrow', array(
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($topic_info['topic_attr_id'], $topic_info['topic_attr_user']
, $topic_info['topic_attr_time']),
), true, 'change');
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$s_hidden_fields = build_hidden_fields(array(
'st_old' => $sort_days,
'post_ids' => $post_id_list,
));
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $action == 'split' )
{
$topic_info['hide_attr'] = unserialize(trim($topic_info['hide_attr']));
if ( $topic_info['hide_attr'] === false )
{
$topic_info['hide_attr'] = array();
}
$qte->attr_select($topic_info['forum_id'], $user->data['user_id'], '', $topic_info['hide_attr']);
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$success_msg = $return_link = '';
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$s_hidden_fields .= build_hidden_fields(array('attr_id' => request_var('attr_id', 0)));
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
$to_topic_id = $db->sql_nextid();
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$attr_id = request_var('attr_id', 0);
if ( $attr_id == -1 )
{
$sql_ary += array('topic_attr_id' => 0, 'topic_attr_user' => 0, 'topic_attr_time' => 0);
}
else
{
$sql_ary += array(
'topic_attr_id' => $attr_id,
'topic_attr_user' => (int) $user->data['user_id'],
'topic_attr_time' => time(),
);
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
// generate a search_key from all the options to identify the results
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
// add
$attribute_id = 0;
if ( array_key_exists('attr_id', $id_ary) )
{
$attribute_id = (int) $id_ary['attr_id'];
unset($id_ary['attr_id']);
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $attribute_id )
{
$sql_where_options .= ' AND t.topic_attr_id = ' . (int) $attribute_id;
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
// generate a search_key from all the options to identify the results
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
// add
$attribute_id = 0;
if ( array_key_exists('attr_id', $id_ary) )
{
$attribute_id = (int) $id_ary['attr_id'];
unset($id_ary['attr_id']);
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $attribute_id )
{
$sql_author .= ' AND t.topic_attr_id = ' . (int) $attribute_id;
$firstpost_only = true;
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
break;
case 't':
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $attribute_id )
{
$sql_sort_join .= ' AND t.topic_attr_id = ' . (int) $attribute_id;
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
break;
case 'f':
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $attribute_id )
{
$sql_sort_join .= ' AND t.topic_attr_id = ' . (int) $attribute_id;
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
/**
* Destroys cached search results, that contained one of the new words in a post so the results won't be outdated.
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
function attribute_search($sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, &$id_ary, $start, $per_page)
{
global $config, $db;
$attribute_id = 0;
if ( array_key_exists('attr_id', $id_ary) )
{
$attribute_id = (int) $id_ary['attr_id'];
unset($id_ary['attr_id']);
}
else
{
return 0;
}
// init var and ary
$total_results = 0;
$id_ary = array();
// create some display specific sql strings
$sql_attribute = 't.topic_attr_id = ' . (int) $attribute_id;
$sql_fora = sizeof($ex_fid_ary) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_time = $sort_days ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
// build sql strings for sorting
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
$sql_sort_table = $sql_sort_join = '';
switch ( $sql_sort[0] )
{
case 'u':
$sql_sort_table = USERS_TABLE . ' u, ';
$sql_sort_join = ' AND u.user_id = p.poster_id ';
break;
case 'f':
$sql_sort_table = FORUMS_TABLE . ' f, ';
$sql_sort_join = ' AND f.forum_id = p.forum_id ';
break;
}
if ( !sizeof($m_approve_fid_ary) )
{
$m_approve_fid_sql = ' AND p.post_approved = 1';
}
else if ( $m_approve_fid_ary == array(-1) )
{
$m_approve_fid_sql = '';
}
else
{
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
}
// if the cache was completely empty count the results
$calc_results = $total_results ? '' : 'SQL_CALC_FOUND_ROWS ';
$sql = "SELECT {$calc_results}t.topic_id
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
WHERE $sql_attribute
$m_approve_fid_sql
$sql_fora
AND t.topic_id = p.topic_id
$sql_sort_join
$sql_time
GROUP BY t.topic_id
ORDER BY $sql_sort";
// only read one block of posts from the db and then cache it
$result = $db->sql_query_limit($sql, $config['search_block_size'], $start);
while ( $row = $db->sql_fetchrow($result) )
{
$id_ary[] = (int) $row['topic_id'];
}
$db->sql_freeresult($result);
if ( !$total_results )
{
$sql = 'SELECT FOUND_ROWS() as total_results';
$result = $db->sql_query($sql);
$total_results = (int) $db->sql_fetchfield('total_results');
$db->sql_freeresult($result);
if ( !$total_results )
{
return false;
}
}
if ( sizeof($id_ary) )
{
$id_ary = array_slice($id_ary, 0, $per_page);
return $total_results;
}
return false;
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
// generate a search_key from all the options to identify the results
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
// add
$attribute_id = 0;
if ( array_key_exists('attr_id', $id_ary) )
{
$attribute_id = (int) $id_ary['attr_id'];
unset($id_ary['attr_id']);
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
if ($type == 'topics')
โค้ด: เลือกทั้งหมด
เติมก่อน ::
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $attribute_id )
{
$sql_where[] = 't.topic_attr_id = ' . (int) $attribute_id;
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
// generate a search_key from all the options to identify the results
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
// add
$attribute_id = 0;
if ( array_key_exists('attr_id', $id_ary) )
{
$attribute_id = (int) $id_ary['attr_id'];
unset($id_ary['attr_id']);
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $attribute_id )
{
$sql_author .= ' AND t.topic_attr_id = ' . (int) $attribute_id;
$firstpost_only = true;
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
break;
case 'f':
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( $attribute_id )
{
$sql_sort_join .= ' AND t.topic_attr_id = ' . (int) $attribute_id;
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
/**
* Split a text into words of a given length
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
function attribute_search($sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, &$id_ary, $start, $per_page)
{
global $config, $db;
$attribute_id = 0;
if ( array_key_exists('attr_id', $id_ary) )
{
$attribute_id = (int) $id_ary['attr_id'];
unset($id_ary['attr_id']);
}
else
{
return 0;
}
// init var and ary
$total_results = 0;
$id_ary = array();
// create some display specific sql strings
$sql_attribute = 't.topic_attr_id = ' . (int) $attribute_id;
$sql_fora = sizeof($ex_fid_ary) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_time = $sort_days ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
// build sql strings for sorting
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
$sql_sort_table = $sql_sort_join = '';
switch ( $sql_sort[0] )
{
case 'u':
$sql_sort_table = USERS_TABLE . ' u, ';
$sql_sort_join = ' AND u.user_id = p.poster_id ';
break;
case 'f':
$sql_sort_table = FORUMS_TABLE . ' f, ';
$sql_sort_join = ' AND f.forum_id = p.forum_id ';
break;
}
if ( !sizeof($m_approve_fid_ary) )
{
$m_approve_fid_sql = ' AND p.post_approved = 1';
}
else if ( $m_approve_fid_ary == array(-1) )
{
$m_approve_fid_sql = '';
}
else
{
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
}
$is_mysql = false;
// if the cache was completely empty count the results
if ( !$total_results )
{
switch ( $db->sql_layer )
{
case 'mysql4':
case 'mysqli':
$is_mysql = true;
break;
default:
if ( $db->sql_layer == 'sqlite' )
{
$sql = 'SELECT COUNT(topic_id) as total_results
FROM (SELECT DISTINCT t.topic_id';
}
else
{
$sql = 'SELECT COUNT(DISTINCT t.topic_id) as total_results';
}
$sql .= ' FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
WHERE $sql_attribute
$m_approve_fid_sql
$sql_fora
AND t.topic_id = p.topic_id
$sql_time" . (($db->sql_layer == 'sqlite') ? ')' : '');
$result = $db->sql_query($sql);
$total_results = (int) $db->sql_fetchfield('total_results');
$db->sql_freeresult($result);
if ( !$total_results )
{
return false;
}
break;
}
}
$sql = "SELECT t.topic_id
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
WHERE $sql_attribute
$m_approve_fid_sql
$sql_fora
AND t.topic_id = p.topic_id
$sql_sort_join
$sql_time
GROUP BY t.topic_id, " . $sort_by_sql[$sort_key] . '
ORDER BY ' . $sql_sort;
// only read one block of posts from the db and then cache it
$result = $db->sql_query_limit($sql, $config['search_block_size'], $start);
while ( $row = $db->sql_fetchrow($result) )
{
$id_ary[] = (int) $row['topic_id'];
}
$db->sql_freeresult($result);
if ( !$total_results && $is_mysql )
{
// count rows for the executed queries
$sql = str_replace('SELECT t.topic_id', 'SELECT DISTINCT SQL_CALC_FOUND_ROWS p.post_id', $sql);
$db->sql_query($sql);
$db->sql_freeresult($result);
$sql = 'SELECT FOUND_ROWS() as total_results';
$result = $db->sql_query($sql);
$total_results = (int) $db->sql_fetchfield('total_results');
$db->sql_freeresult($result);
if ( !$total_results )
{
return false;
}
}
if ( sizeof($id_ary) )
{
$id_ary = array_slice($id_ary, 0, $per_page);
return $total_results;
}
return false;
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
switch ($mode)
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
foreach ($topic_list as $topic_id)
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
$qte->get_users_by_topic_id($topic_list);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
}
if ($config['load_user_activity'])
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !empty($row['topic_attr_id']) )
{
$template->alter_block_array('topicrow', array(
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($row['topic_attr_id'], $row['topic_attr_user'], $row['topic_attr_time']),
), true, 'change');
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
}
}
}
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !empty($row['topic_attr_id']) )
{
$template->alter_block_array('topicrow', array(
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($row['topic_attr_id'], $row['topic_attr_user'], $row['topic_attr_time']),
), true, 'change');
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
// Additional tables
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
define('TOPICS_ATTR_TABLE', $table_prefix . 'topics_attr');
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
$result = $db->sql_query($sql);
$active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title');
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- delete
/*-MOD
โค้ด: เลือกทั้งหมด
MOD-*/
//-- add
$sql = str_replace('SELECT ', 'SELECT topic_attr_id, topic_attr_user, topic_attr_time, ', $sql);
$result = $db->sql_query_limit($sql, 1);
$active_t_row += $db->sql_fetchrow($result);
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
'S_SHOW_ACTIVITY' => true)
);
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( !empty($active_t_row['topic_attr_id']) )
{
global $qte;
$qte->get_users_by_topic_id(array($active_t_id));
$template->assign_vars(array(
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($active_t_row['topic_attr_id'], $active_t_row['topic_attr_user']
, $active_t_row['topic_attr_time']),
));
}
//-- fin mod : quick title edition ---------------------------------------------
ค้นหา ::
โค้ด: เลือกทั้งหมด
// We do not handle erasing posts here
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
$result = $db->sql_query($sql);
$topic_row = $db->sql_fetchrow($result);
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( defined('IN_STK') )
{
$sql = str_replace(', t.topic_approved', ', t.topic_approved, t.topic_attr_id, t.topic_attr_user, t.topic_attr_time', $sql);
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
}
// This variable indicates if the user is able to post or put into the queue - it is used later for all code decisions regarding approval
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( defined('IN_STK') )
{
if ( !empty($topic_row['topic_attr_id']) )
{
$data['attr_id'] = $topic_row['topic_attr_id'];
$data['attr_user'] = $topic_row['topic_attr_user'];
$data['attr_time'] = $topic_row['topic_attr_time'];
}
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
if ($update_message)
{
$sql_data[POSTS_TABLE]['sql']['post_text'] = $data['message'];
}
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
if ( defined('IN_STK') )
{
if ( !isset($sql_data[TOPICS_TABLE]['sql']) )
{
$sql_data[TOPICS_TABLE]['sql'] = array();
}
$data['attr_id'] = isset($data['attr_id']) ? $data['attr_id'] : -1;
if ( $data['attr_id'] == -1 )
{
$sql_data[TOPICS_TABLE]['sql'] += array('topic_attr_id' => 0, 'topic_attr_user' => 0, 'topic_attr_time' => 0);
}
else
{
$sql_data[TOPICS_TABLE]['sql'] += array(
'topic_attr_id' => $data['attr_id'],
'topic_attr_user' => $data['attr_user'],
'topic_attr_time' => $data['attr_time'],
);
}
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
if (isset($poll['poll_options']) && !empty($poll['poll_options']))
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
// generic fix for mods, which use that function ...
$data['attr_id'] = isset($data['attr_id']) ? $data['attr_id'] : -1;
if ( $data['attr_id'] != -2 )
{
if ( $data['attr_id'] == -1 )
{
$sql_data[TOPICS_TABLE]['sql'] += array('topic_attr_id' => 0, 'topic_attr_user' => 0, 'topic_attr_time' => 0);
}
else
{
$sql_data[TOPICS_TABLE]['sql'] += array(
'topic_attr_id' => $data['attr_id'],
'topic_attr_user' => (int) $user->data['user_id'],
'topic_attr_time' => $current_time,
);
}
}
//-- fin mod : quick title edition ---------------------------------------------
โค้ด: เลือกทั้งหมด
// Correctly set back the topic replies and forum posts... only if the topic was approved before and now gets disapproved
โค้ด: เลือกทั้งหมด
//-- mod : quick title edition -------------------------------------------------
//-- add
// ditto ...
$data['attr_id'] = isset($data['attr_id']) ? $data['attr_id'] : -1;
if ( $data['attr_id'] != -2 )
{
if ( $data['attr_id'] == -1 )
{
$sql_data[TOPICS_TABLE]['sql'] += array('topic_attr_id' => 0, 'topic_attr_user' => 0, 'topic_attr_time' => 0);
}
else
{
$sql_data[TOPICS_TABLE]['sql'] += array(
'topic_attr_id' => $data['attr_id'],
'topic_attr_user' => (int) $user->data['user_id'],
'topic_attr_time' => $current_time,
);
}
}
//-- fin mod : quick title edition ---------------------------------------------