Vbulletin toàn tập

n_u_h_o_n

Member
Copy đoạn code sau , lưu thành file Shout.php và up lên thư mục admincp/

<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE
);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1
);

// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array('shoutmanager'
);
$specialtemplates
= array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php'
);
require_once(
'./includes/functions_bbcodeparse.php'
);

// ######################## CHECK ADMIN PERMISSIONS #######################
if (!can_administer('canadminshouts'
))
{
print_cp_no_permission
();
}

// ############################# LOG ACTION ###############################
log_admin_action(iif ($shoutid != 0, "shout id = $shoutid"
));

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

print_cp_header($vbphrase['shout_manager'
]);

if (empty(
$_REQUEST['do'
]))
{
$_REQUEST['do'] = 'modify'
;
}

$checkall = '<input type="checkbox" name="allbox" title="' . $vbphrase['check_all'] . '" onclick="js_check_all(this.form);" />'
;

// ##################################### EDIT ####################################
if ($_REQUEST['do'] == 'edit'
)
{
globalize($_REQUEST, array('shoutid' => INT
));

$shout = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "shout WHERE shoutid = $shoutid"
);

print_form_header('shout', 'doupdate'
);
construct_hidden_code('shoutid', $shoutid
);
print_table_header($vbphrase['edit_shout'
]);
print_textarea_row($vbphrase['shout'], 'pagetext', $shout['pagetext'], 5, 60
);
print_submit_row($vbphrase['save'
]);
}

####################################### UPDATE ############################################
if ($_POST['do'] == 'update'
)
{
globalize($_POST
, array(
'shoutid' => INT
,
'pagetext' =>
STR
));

$DB_site->query("UPDATE " . TABLE_PREFIX . "shout SET pagetext = '" . addslashes($pagetext) . "' WHERE shoutid = $shoutid"
);

define('CP_REDIRECT', 'shout.php?do=modify'
);
print_stop_message('saved_shout_no_x_successfully', $shoutid
);
}

// ######################################## MULTIKILL #####################################
if ($_POST['do'] == 'multikill'
)
{
globalize($_POST, array('killshout'
));

if (
sizeof($killshout) == 1
)
{
foreach (
$killshout as $key => $val
)
{
$shoutid = $key
;
break;
}
$_POST['do'] = 'kill'
;
}

$shoutids = $killshout
;
unset(
$killshout
);

foreach (
$shoutids as $shoutid => $yes
)
{
if (
$yes
)
{
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "shout WHERE shoutid = $shoutid"
);
}
}

$_REQUEST['do'] = 'modify'
;
}

// ######################################## KILL #####################################
if ($_POST['do'] == 'kill'
)
{
globalize($_POST, array('shoutid' => INT
));

$DB_site->query("DELETE FROM " . TABLE_PREFIX . "shout WHERE shoutid = $shoutid"
);

$_REQUEST['do'] = 'modify'
;
}

// ####################################### REMOVE #####################################
if ($_REQUEST['do'] == 'remove'
)
{
globalize($_REQUEST, array('shoutid'
));

if (
sizeof($shoutid) == 1
)
{
foreach (
$shoutid as $key => $val
)
{
$shoutid = $key
;
break;
}
}

if (
is_array($shoutid
))
{
print_form_header('shout', 'multikill'
);
print_table_header($vbphrase['confirm_shout_deletion'], 4
);
print_description_row($vbphrase['please_check_shouts_to_delete'], 0, 4
);
print_cells_row(array('#', $vbphrase['shouter'], $vbphrase['shout'], $checkall), 1, '', -2
);

foreach (
$shoutid as $key => $val
)
{
$shoutids .= ", $key"
;
}

$shouts = $DB_site->query(
"
SELECT shout.*, user.username
FROM "
. TABLE_PREFIX .
"shout AS shout
LEFT JOIN "
. TABLE_PREFIX .
"user AS user ON (user.userid = shout.userid)
WHERE shout.shoutid IN (0$shoutids)
ORDER BY shout.dateline DESC
"
);

while (
$shout = $DB_site->fetch_array($shouts
))
{
$cell = array($shout['shoutid'], $shout['username'
]);

$cell[] = str_replace('images/smilies', '../images/smilies', parse_bbcode($shout['pagetext'], 'shoutbox'
));

$cell[] = "<input type=\"checkbox\" name=\"killshout[" . $shout['shoutid'] . "]\" id=\"killshout[" . $shout['shoutid'] . "]\" value=\"1\" tabindex=\"1\"" . iif ($GLOBALS['debug'], " title=\"name=&quot;killshout[" . $shout['shoutid'] . "]&quot;\"") . " />"
;

print_cells_row($cell, 0, '', -2
);
}

print_submit_row($vbphrase['remove_shouts'], '_default_', 4
);

print_cp_footer
();
}

print_delete_confirmation('shout', $shoutid, 'shout', 'kill', 'shout', 0, '', 'shoutid'
);
}

// ########################################### SEARCH #####################################################
if ($_POST['do'] == 'search'
)

 

n_u_h_o_n

Member
Tiếp nha..
globalize($_POST, array('username'));

if (sizeof($username) == 1)
{
$username = $username[0];
}

if (is_array($username))
{
$users = $DB_site->query("SELECT username, userid FROM " . TABLE_PREFIX . "user WHERE userid IN (" . implode(',', $username) . ") ORDER BY username");

while ($user = $DB_site->fetch_array($users))
{
$userinfo[$user['userid']] = $user['username'];
}

$shouts = $DB_site->query("
SELECT shout.shoutid, shout.userid, shout.pagetext
FROM " . TABLE_PREFIX . "shout AS shout
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = shout.userid)
WHERE shout.userid IN (" . implode(',', $username) . ")
ORDER BY user.username, shout.dateline DESC
");

while ($shout = $DB_site->fetch_array($shouts))
{
$shout['pagetext'] = str_replace('images/smilies', '../images/smilies', parse_bbcode($shout['pagetext'], 'shoutbox'));

$shoutlist[$shout['userid']][$shout['shoutid']] = $shout['pagetext'];
}

print_form_header('shout', 'remove');
print_cells_row(array('#', $vbphrase['shout'], ''), 1);
print_description_row($vbphrase['please_check_shouts_to_delete2'], 0, 3);

foreach ($userinfo as $userid => $username)
{
if (is_array($shoutlist[$userid]))
{
print_cells_row(array('', construct_phrase($vbphrase['shouts_by_x'], $username), $checkall), 0, 'tcat');
foreach ($shoutlist[$userid] as $shoutid => $shout)
{
print_cells_row(array($shoutid, $shout, "<input type=\"checkbox\" name=\"shoutid[" . $shoutid . "]\" id=\"shoutid[" . $shoutid . "]\" value=\"1\" tabindex=\"1\"" . iif ($GLOBALS['debug'], " title=\"name=&quot;shoutid[" . $shoutid . "]&quot;\"") . " />"), 0, 0, -1);
}
}
}

print_submit_row($vbphrase['remove_shouts'], '_default_', 3);

print_cp_footer();
}

$shouts = $DB_site->query("
SELECT shout.shoutid, shout.userid, shout.pagetext, user.username
FROM " . TABLE_PREFIX . "shout AS shout
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = shout.userid)
WHERE shout.userid = $username
ORDER BY shout.dateline DESC
");

$username = $DB_site->query_first("SELECT username FROM " . TABLE_PREFIX . "user AS user WHERE userid = " . $username);

print_form_header('shout', 'remove');
print_cells_row(array('#', $vbphrase['shout'], ''), 1);
print_cells_row(array('', construct_phrase($vbphrase['shouts_by_x'], $username['username']), $checkall), 0, 'tcat');

while ($shout = $DB_site->fetch_array($shouts))
{
if (substr(strtolower($shout['pagetext']), 0, 3) == "/me")
{
$shout['pagetext'] = str_replace("/me ", "", $shout['pagetext']);
}
$shout['pagetext'] = str_replace('images/smilies', '../images/smilies', parse_bbcode($shout['pagetext'], 'shoutbox'));

print_cells_row(array($shout['shoutid'], $shout['pagetext'], "<input type=\"checkbox\" name=\"shoutid[" . $shout['shoutid'] . "]\" id=\"shoutid[" . $shout['shoutid'] . "]\" value=\"1\" tabindex=\"1\"" . iif ($GLOBALS['debug'], " title=\"name=&quot;shoutid[" . $shout['shoutid'] . "]&quot;\"") . " />"), 0, 0, -1);
}

print_submit_row($vbphrase['remove_shouts'], '_default_', 3);
}

// ########################################### FIND #####################################################
if ($_REQUEST['do'] == 'find')
{
$selectoptions = array();

$users = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user ORDER BY username");
while ($user = $DB_site->fetch_array($users))
{
$selectoptions[$user['userid']] = $user['username'];
}

print_form_header('shout', 'search');
print_table_header($vbphrase['find_shouts']);
print_description_row($vbphrase['please_select_info']);
print_select_row($vbphrase['username'], 'username[]', $selectoptions, '', 0, 10, true);
print_submit_row($vbphrase['search'], false, 2, $vbphrase['back']);
}

// ########################################### MODIFY #####################################################
if ($_REQUEST['do'] == 'modify')
{
globalize($_REQUEST, array(
'perpage' => INT,
'pagenumber' => INT
));

$total = $DB_site->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "shout");

sanitize_pageresults($total['total'], $pagenumber, $perpage, 50, $vboptions['searchperpage']);

$limitlower = ($pagenumber - 1) * $perpage;
$limitupper = ($pagenumber) * $perpage;

if ($limitupper > $total['total'])
{
$limitupper = $total['total'];
if ($limitlower > $total['total'])
{
$limitlower = ($total['total'] - $perpage) - 1;
}
}
if ($limitlower < 0)
{
$limitlower = 0;
}

$shouts = $DB_site->query("
SELECT s.*,u.username
FROM " . TABLE_PREFIX . "shout s
LEFT JOIN " . TABLE_PREFIX . "user u ON (u.userid = s.userid)
ORDER BY dateline DESC, shoutid DESC LIMIT $limitlower, $perpage
");

print_form_header('shout', 'remove');
print_table_header($vbphrase['shout_manager'], 4);
print_cells_row(array($vbphrase['shouter'], $vbphrase['shout'], "", $checkall), 1, '', -3);

while ($shout = $DB_site->fetch_array($shouts))
{
$cell = array();

$cell[] = $shout['username'];

if (substr(strtolower($shout['pagetext']), 0, 3) == "/me")
{
$shout['pagetext'] = str_replace("/me ", "", $shout['pagetext']);
}
$cell[] = str_replace('images/smilies', '../images/smilies', parse_bbcode($shout['pagetext'], 'shoutbox'));

$cell[] = construct_link_code($vbphrase['edit'], "shout.php?$session[sessionurl]do=edit&shoutid=$shout[shoutid]") . construct_link_code($vbphrase['delete'], "shout.php?$session[sessionurl]do=remove&shoutid=$shout[shoutid]");

$cell[] = "<input type=\"checkbox\" name=\"shoutid[" . $shout['shoutid'] . "]\" id=\"shoutid[" . $shout['shoutid'] . "]\" value=\"1\" tabindex=\"1\"" . iif ($GLOBALS['debug'], " title=\"name=&quot;shoutid[" . $shout['shoutid'] . "]&quot;\"") . " />";

print_cells_row($cell, 0, '', -2);
}

$findbutton = "<input type=\"button\" class=\"button\" tabindex=\"1\" value=\"" . str_pad($vbphrase['find_shouts'], 8, ' ', STR_PAD_BOTH) . "\" onclick=\"window.location = 'shout.php?$session[sessionurl]do=find'\" />";
print_submit_row($vbphrase['remove_shouts'], '_default_', 4);
}

print_cp_footer();

?>
 

n_u_h_o_n

Member
Tiếp theo là đoạn code sau, save với tên là shoutbox.php, up lên thư mục gốc (nơi chứa file index)
<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'shoutbox');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('shoutbox');

// get special data templates from the datastore
$specialtemplates = array(
'smiliecache',
'bbcodecache',
);

// pre-cache templates used by all actions
$globaltemplates = array('shoutbox_shouterror');

// pre-cache templates used by specific actions
$actiontemplates = array(
'addnew' => array(
'shoutbox_newmessage',
'shoutbox_newmessage_refresh'
),
'edit' => array(
'shoutbox_editmessage'
),
'main' => array(
'shoutbox_main',
'shoutbox_main_message',
'shoutbox_main_message_me'
),
'archive' => array(
'shoutbox_archive',
'shoutbox_archive_message',
'shoutbox_archive_message_me',
'shoutbox_archive_topbit'
),
'iframe' => array(
'shoutbox_iframe'
)
);

$actiontemplates['none'] = &$actiontemplates['archive'];

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
require_once('./includes/functions_bbcodeparse.php');
require_once('./includes/functions_newpost.php');

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'archive';
}

if ($_REQUEST['do'] == 'archive')
{
$navbits = array('' => $vbphrase['shoutbox']);
}
else
{
$navbits = array("shoutbox.php?$session[sessionurl]do=archive" => $vbphrase['shoutbox']);
}

// ############################### start insert ###############################
if ($_POST['do'] == 'insert')
{
globalize($_POST, array('message', 'goto'));

if (!($permissions['shoutboxpermissions'] & CANADDSHOUT))
{
if (empty($goto))
{
$errortext = $vbphrase['cantshout'];
eval('print_output("' . fetch_template('shoutbox_shouterror') . '");');
}
else
{
eval(print_standard_error('error_cantshout'));
}
}

// trim the text fields
$pagetext = trim($message);

// parse URLs in message text
$pagetext = convert_url_to_bbcode($pagetext);

// check that message exists
if ($pagetext == '')
{
if (empty($goto))
{
$errortext = $vbphrase['noshout'];
eval('print_output("' . fetch_template('shoutbox_shouterror') . '");');
}
else
{
eval(print_standard_error('error_noshout'));
}
}

// insert into the database
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "shout
(userid, dateline, pagetext)
VALUES
($bbuserinfo[userid], " . TIMENOW . ", '" . addslashes($pagetext) . "')
");
$shoutid = $DB_site->insert_id();

header("Location: shoutbox.php?$session[sessionurl]shoutid=$shoutid&" . iif($goto, "do=" . $goto, "refresh=true&do=addnew") . "#shout$shoutid");
exit;
}

// ############################### start addnew ###############################
if ($_REQUEST['do'] == 'addnew')
{
if (!($permissions['shoutboxpermissions'] & CANADDSHOUT))
{
$errortext = $vbphrase['cantshout'];
eval('print_output("' . fetch_template('shoutbox_shouterror') . '");');
}

if ($_REQUEST['refresh'])
{
eval('$refresh = "' . fetch_template('shoutbox_newmessage_refresh') . '";');
}

eval('print_output("' . fetch_template('shoutbox_newmessage') . '");');
}

// ############################### start drop ###############################
if ($_POST['do'] == 'drop')
{
globalize($_POST, array(
'shoutid' => INT
));

if (!($permissions['shoutboxpermissions'] & CANDROPSHOUT))
{
print_no_permission();
}

// check that shoutid exists
if (!$shoutid)
{
eval(print_standard_error('error_noshoutspecified'));
}

$shout = $DB_site->query_first("SELECT shoutid, userid FROM " . TABLE_PREFIX . "shout WHERE shoutid = $shoutid");

if (!$shout['shoutid'])
{
eval(print_standard_error('error_wrongshoutspecified'));
}

if (!($permissions['shoutboxpermissions'] & CANDROPOTHERSHOUT) AND $bbuserinfo['userid'] != $shout['userid'])
{
eval(print_standard_error('error_dropothersshout'));
}

$DB_site->query("DELETE FROM " . TABLE_PREFIX . "shout WHERE shoutid = " . $shout['shoutid']);

$url = "shoutbox.php?$session[sessionurl]do=archive";
eval(print_standard_redirect('redirect_shoutdropthanks'));
}

// ############################### start update ###############################
if ($_POST['do'] == 'update')
{
globalize($_POST, array(
'shoutid' => INT,
'message' => STR
));

if (!($permissions['shoutboxpermissions'] & CANEDITSHOUT))
{
print_no_permission();
}

// check that shoutid exists
if (!$shoutid)
{
eval(print_standard_error('error_noshoutspecified'));
}

$shout = $DB_site->query_first("SELECT shoutid, userid, pagetext FROM " . TABLE_PREFIX . "shout WHERE shoutid = $shoutid");

if (!$shout['shoutid'])
{
eval(print_standard_error('error_wrongshoutspecified'));
}

if (!($permissions['shoutboxpermissions'] & CANEDITOTHERSHOUT) AND $bbuserinfo['userid'] != $shout['userid'])
{
eval(print_standard_error('error_editothersshout'));
}

// trim the text fields
$pagetext = trim($message);

// parse URLs in message text
$pagetext = convert_url_to_bbcode($pagetext);

// check that message exists
if ($pagetext == '')
{
eval(print_standard_error('error_noshout'));
}

// update the shout
$DB_site->query("UPDATE " . TABLE_PREFIX . "shout SET pagetext = '" . addslashes($pagetext) . "', lastedit = " . TIMENOW . " WHERE shoutid = $shoutid");

$url = "shoutbox.php?$session[sessionurl]do=archive&shoutid=$shoutid#shout$shoutid";
eval(print_standard_redirect('redirect_shouteditthanks'));
}

// ############################### start update ###############################
if ($_REQUEST['do'] == 'edit')
 

n_u_h_o_n

Member
{
globalize($_REQUEST, array('shoutid' => INT));

if (!($permissions['shoutboxpermissions'] & CANEDITSHOUT))
{
print_no_permission();
}

// check that shoutid exists
if (!$shoutid)
{
eval(print_standard_error('error_noshoutspecified'));
}

$shout = $DB_site->query_first("SELECT shoutid, userid, pagetext FROM " . TABLE_PREFIX . "shout WHERE shoutid = $shoutid");

if (!$shout['shoutid'])
{
eval(print_standard_error('error_wrongshoutspecified'));
}

if (!($permissions['shoutboxpermissions'] & CANEDITOTHERSHOUT) AND $bbuserinfo['userid'] != $shout['userid'])
{
eval(print_standard_error('error_editothersshout'));
}

// MAKE SMILIES
if (DOTOOLBAR AND $vboptions['smtotal'] > 0)
{
// query smilies
$smilies = $DB_site->query("
SELECT smilieid, smilietext, smiliepath, smilie.title,
imagecategory.title AS category
FROM " . TABLE_PREFIX . "smilie AS smilie
LEFT JOIN " . TABLE_PREFIX . "imagecategory AS imagecategory USING(imagecategoryid)
ORDER BY imagecategory.displayorder, smilie.displayorder
");

// get total number of smilies
$totalsmilies = $DB_site->num_rows($smilies);
if ($totalsmilies == 0)
{
$smiliebox = '';
}
else
{
if (DOTOOLBAR == 1 OR $vboptions['smtotal'])
{
$smcache = array();
$smiliesbits = '';

$i = 0;
while ($smilie = $DB_site->fetch_array($smilies) AND $i++ < $vboptions['smtotal'])
{
$smcache["$smilie[category]"][] = $smilie;
}
$DB_site->free_result($smilies);

foreach($smcache AS $category => $smilies)
{
eval('$smiliebits .= "' . fetch_template('editor_smiliebox_category') . '";');
$bits = array();
foreach ($smilies AS $smilie)
{
$smilie['smilietext'] = addslashes($smilie['smilietext']);
eval('$bits[] = "' . fetch_template('editor_smilie_standard') . '";');
if (sizeof($bits) == $vboptions['smcolumns'])
{
$smiliecells = implode('', $bits);
eval('$smiliebits .= "' . fetch_template('editor_smiliebox_row') . '";');
$bits = array();
}
}

// fill in empty cells if required
$remaining = sizeof($bits);
if ($remaining > 0)
{
$remainingcolumns = $vboptions['smcolumns'] - $remaining;
eval('$bits[] = "' . fetch_template('editor_smiliebox_straggler') . '";');
$smiliecells = implode('', $bits);
eval('$smiliebits .= "' . fetch_template('editor_smiliebox_row') . '";');
}
}
$show['moresmilieslink'] = iif ($totalsmilies > $vboptions['smtotal'], true, false);
eval('$smiliebox = "' . fetch_template('editor_smiliebox') . '";');
}
$DB_site->free_result($smilies);
}
}

// ##### output
$navbits[''] = $vbphrase['edit_shout'];
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

eval('print_output("' . fetch_template('shoutbox_editmessage') . '");');
}

// ############################### start main ###############################
if ($_REQUEST['do'] == 'main')
{
if (!($permissions['shoutboxpermissions'] & CANREADSHOUTS))
{
$errortext = $vbphrase['cantshout'];
eval('print_output("' . fetch_template('shoutbox_shouterror') . '");');
}

$shouts = $DB_site->query("
SELECT s.*, u.username
FROM " . TABLE_PREFIX . "shout s
LEFT JOIN " . TABLE_PREFIX . "user u ON (u.userid = s.userid)
ORDER BY dateline " . $vboptions['shoutframeorder'] . ", shoutid " . $vboptions['shoutframeorder'] . " LIMIT " . $vboptions['shoutframeamount'] . "
");
while ($shout = $DB_site->fetch_array($shouts))
{
$shout['date'] = vbdate($vboptions['dateformat'], $shout['dateline']);
$shout['time'] = vbdate($vboptions['timeformat'], $shout['dateline']);
$shout['pagetext'] = parse_bbcode($shout['pagetext'], 'shoutbox');

if ($shout['userid'] == 0)
{
$shout['username'] = "<i>" . $vbpharse['guest'] . "</i>";
}

if (substr(strtolower($shout['pagetext']), 0, 3) == "/me")
{
$shout['pagetext'] = str_replace("/me ", "", $shout['pagetext']);
eval('$shoutbits .= "' . fetch_template('shoutbox_main_message_me') . '";');
}
else
{
eval('$shoutbits .= "' . fetch_template('shoutbox_main_message') . '";');
}
}

eval('print_output("' . fetch_template('shoutbox_main') . '");');
}

// ############################### start archive ###############################
if ($_REQUEST['do'] == 'archive')
{
globalize($_REQUEST, array(
'perpage' => INT,
'pagenumber' => INT,
'shoutid'
));

if (!($permissions['shoutboxpermissions'] & CANREADSHOUTS))
{
print_no_permission();
}

if (!empty($shoutid))
{
$theshout = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "shout AS shout WHERE shoutid = " . $shoutid);
if (empty($perpage))
{
$perpage = 10;
}
$getpagenum = $DB_site->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "shout AS shout WHERE dateline " . iif($vboptions['shoutorder'] == 'ASC', '<=', '>=') . " $theshout[dateline]");
$pagenumber = ceil($getpagenum['total'] / $perpage);
}

if (!empty($getpagenum))
{
$total = $getpagenum;
}
else
{
$total = $DB_site->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "shout AS shout");
}

sanitize_pageresults($total['total'], $pagenumber, $perpage, 25, $vboptions['shoutamount']);

$limitlower = ($pagenumber - 1) * $perpage;
$limitupper = ($pagenumber) * $perpage;

if ($limitupper > $total['total'])
{
$limitupper = $total['total'];
if ($limitlower > $total['total'])
{
$limitlower = ($total['total'] - $perpage) - 1;
}
}
if ($limitlower < 0)
{
$limitlower = 0;
}

$shouts = $DB_site->query("
SELECT s.*, u.username
FROM " . TABLE_PREFIX . "shout s
LEFT JOIN " . TABLE_PREFIX . "user u ON (u.userid = s.userid)
ORDER BY dateline " . $vboptions['shoutorder'] . ", shoutid " . $vboptions['shoutorder'] . " LIMIT $limitlower, $perpage
");
while ($shout = $DB_site->fetch_array($shouts))
{
$shout['date'] = vbdate($vboptions['dateformat'], $shout['dateline']);
$shout['time'] = vbdate($vboptions['timeformat'], $shout['dateline']);
$shout['pagetext'] = parse_bbcode($shout['pagetext'], 'shoutbox');

if ($shout['userid'] == 0)
{
$shout['username'] = "<i>" . $vbpharse['guest'] . "</i>";
}

if (substr(strtolower($shout['pagetext']), 0, 3) == "/me")
{
$shout['pagetext'] = str_replace("/me ", "", $shout['pagetext']);
eval('$shoutbits .= "' . fetch_template('shoutbox_archive_message_me') . '";');
}
else
{
eval('$shoutbits .= "' . fetch_template('shoutbox_archive_message') . '";');
}
}

$pagenav = construct_page_nav($total['total'], "shoutbox.php?$session[sessionurl]do=archive", "&amp;pp=$perpage");

// ##### stats
$today = mktime(0, 0, 0, date('n', TIMENOW), date('j', TIMENOW), date('Y', TIMENOW));
$time24 = TIMENOW - (60 * 60 * 24);

$shouts24 = $DB_site->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "shout WHERE userid > 0 AND dateline > " . $time24);
$shouts24 = intval($shouts24['total']);

$shoutstoday = $DB_site->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "shout WHERE userid > 0 AND dateline > " . $today);
$shoutstoday = intval($shoutstoday['total']);

$yourshouts = $DB_site->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "shout WHERE userid = " . $bbuserinfo['userid']);
$yourshouts = intval($yourshouts['total']);

// ##### top shouters
$topamount = 0;
$top_x_shouters = $DB_site->query("
SELECT u.username, s.userid, COUNT(s.shoutid) AS total
FROM " . TABLE_PREFIX . "shout s
LEFT JOIN " . TABLE_PREFIX . "user u ON (u.userid = s.userid)
WHERE s.userid > 0
GROUP BY s.userid HAVING COUNT(s.shoutid) > 0
ORDER BY total DESC LIMIT " . $vboptions['top_shouters']
);
while ($top = $DB_site->fetch_array($top_x_shouters))
{
$top['username'] = addslashes($top['username']);
eval('$topshouters .= "' . fetch_template('shoutbox_archive_topbit') . '";');

$topamount++;
}
if ($topamount > 0)
{
$show['topshouters'] = 1;
if ($topamount > 1)
{
$vbphrase['top_shouters'] = construct_phrase($vbphrase['top_x_shouters'], $topamount);
}
else
{
$vbphrase['top_shouters'] = $vbphrase['top_shouter'];
}
}

// ##### output
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

eval('print_output("' . fetch_template('shoutbox_archive') . '");');
}

// ############################### start archive ###############################
if ($_REQUEST['do'] == 'iframe')
{
eval('print_output("' . fetch_template('shoutbox_iframe') . '");');
}

?>
Đây là bước cuối cùng, tải file install này về (vì nhiều ký tự qúa post nó báo lỗi) upload lên thư mục /admincp/ , sau đó chạy nó và làm theo hướng dẫn trong đó là okie.
chúc thành công
 

n_u_h_o_n

Member
<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('GET_EDIT_TEMPLATES', 'newpm,insertpm');
define('THIS_SCRIPT', 'pm.php');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array();

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once('./includes/functions_bbcodeparse.php');

// User Is Not SuperAdmin
if (!in_array($bbuserinfo['userid'], preg_split('#\s*,\s*#s', $superadministrators, -1, PREG_SPLIT_NO_EMPTY)))
{
// Output Header/Message
print_cp_header('Your Not Authorized');
print_cp_message('You have to be a super administrator to read private messages, this can be set within config.php');
}

// No Request ID
if (empty($_REQUEST['userid']))
{
// Output Headers/Data/Footer/Exit
print_cp_header('Reading Private Messages - No User ID');
echo '<p><B>No valid userid specified</B></p><p>Add <i>?userid=x</i> to the end of the URL<br />(where <i>x</i> is an Existing user)</p>';
print_cp_footer();
exit;
}

// Verify Id, And Assign Variable
$userinfo = verify_id('user', $_REQUEST['userid'], 0, 1);
$userid = &$userinfo['userid'];

// User ID Empty
if (empty($userid))
{
// Output Headers/Data/Footers/Exit
print_cp_header('Reading Private Messages - Invalid User ID');
echo '<p><B>No valid userid specified</B></p><p>Add <i>?userid=x</i> to the end of the URL<br />(where <i>x</i> is an Existing user)</p>';
print_cp_footer();
exit;
}
else
{
// Output Header
print_cp_header("Reading Private Messages - $userinfo[username]");
}

// Folders Array
$folders = array(
'0' => $vbphrase['inbox'],
'-1' => $vbphrase['sent_items']
);

// Folder Not Assigned
if (!empty($bbuserinfo['pmfolders']))
{

$folders += unserialize($bbuserinfo['pmfolders']);
}

// Message Counter Array
$messagecounters = array();

// Build Query
$pmcounts = $DB_site->query("
SELECT COUNT(*)
AS total,
folderid
FROM ".TABLE_PREFIX."pm AS pm
LEFT JOIN ".TABLE_PREFIX."pmtext AS pmtext
USING(pmtextid)
WHERE userid = $userid
GROUP BY folderid
");

// Loop Through
while ($pmcount = $DB_site->fetch_array($pmcounts))
{
// Increment counters
$messagecounters["$pmcount[folderid]"] = intval($pmcount['total']);
}

// Links Array
$links = array();

// Loop Through
foreach ($folders AS $key => $value)
{
// Build Array
$links[] = '<a href="'.THIS_SCRIPT."?userid=$userid&amp;folderid=$key\">$value(".intval($messagecounters["$key"]).")</a>";
}

// Check Request
if (empty($_REQUEST['pmid']))
{
// Globalize It
globalize($_REQUEST, array('folderid' => INT));

// Setup Query
$pms = $DB_site->query("
SELECT pm.*, pmtext.*
".iif($vboptions['privallowicons'], ", icon.title AS icontitle, icon.iconpath")."
FROM ".TABLE_PREFIX . "pm AS pm
LEFT JOIN ".TABLE_PREFIX . "pmtext AS pmtext
ON(pmtext.pmtextid = pm.pmtextid)
".iif($vboptions['privallowicons'], "LEFT JOIN ".TABLE_PREFIX."icon AS icon
ON(icon.iconid = pmtext.iconid)") . "
WHERE pm.userid=$userid
AND pm.folderid=$folderid
ORDER BY pmtext.dateline DESC
");

// Output Header/Description/Cells
print_form_header();
print_table_header("Private Messages -- $userinfo[username] -- ".$folders["$folderid"], 4);
print_description_row('Folders: '.implode(' -- ', $links), 0, 4);
print_cells_row(array('Title', 'Sent By', 'Sent To', 'Time'), 1, 'tcat');

// Loop Through
while ($pm = $DB_site->fetch_array($pms))
{
// Build Arrays
$pm['senddate'] = vbdate($vboptions['dateformat'], $pm['dateline'], 1);
$pm['sendtime'] = vbdate($vboptions['timeformat'], $pm['dateline']);
$pm['receiver_raw'] = unserialize($pm['touserarray']);
$pm['receiver_key'] = array_keys(&$pm['receiver_raw']);
$pm['receiver_id'] = &$pm['receiver_key'][0];
$pm['receiver'] = &$pm['receiver_raw'][$pm['receiver_key'][0]];

// Output Data
print_cells_row(array('<a href="'.THIS_SCRIPT."?userid=$userid&amp;folderid=$folderid&amp;pmid=$pm[pmid]\">$pm[title]</a>", "<a href=\"pm.php?userid=$pm[fromuserid]&amp;folderid=$folderid\">$pm[fromusername]</a>","<a href=\"pm.php?userid=$pm[receiver_id]&amp;folderid=$folderid\">$pm[receiver]</a>", "$pm[sendtime]<dfn>$pm[senddate]</dfn>"));
}

// No Messages
if ($DB_site->num_rows($pms) == 0)
{
print_description_row('This folder contains no messages', 0, 4);
}

// Output Footer
print_table_footer();
}
else
{
// Globalize It
globalize($_REQUEST, array('folderid' => INT, 'pmid' => INT));

// Setup Query
$pm = $DB_site->query_first("
SELECT pm.*, pmtext.*,
".iif($vboptions['privallowicons'], "icon.title AS icontitle, icon.iconpath,")."
IF(ISNULL(pmreceipt.pmid), 0, 1) AS receipt, pmreceipt.readtime, pmreceipt.denied
FROM ".TABLE_PREFIX . "pm AS pm
LEFT JOIN ".TABLE_PREFIX."pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)
".iif($vboptions['privallowicons'], "
LEFT JOIN ".TABLE_PREFIX."icon AS icon ON(icon.iconid = pmtext.iconid)")."
LEFT JOIN ".TABLE_PREFIX."pmreceipt AS pmreceipt ON(pmreceipt.pmid = pm.pmid)
WHERE pm.userid=$userid
AND pm.pmid=$pmid
");

// Setup Array
$pm['senddate'] = vbdate($vboptions['dateformat'], $pm['dateline'], 1);
$pm['sendtime'] = vbdate($vboptions['timeformat'], $pm['dateline']);
$pm['receiver_values'] = array_values(unserialize($pm['touserarray']));
$pm['receiver'] = &$pm['receiver_values'][0];

// Output Header/Description/Data/Footer
print_form_header();
print_table_header("Private Messages -- $userinfo[username] -- " . $folders["$folderid"] . " -- $pm[title]", 3);
print_description_row('Folders: ' . implode(' -- ', $links), 0, 3);
print_description_row("$pm[fromusername] sent a PM to $pm[receiver] at $pm[sendtime] on $pm[senddate]");
print_description_row(parse_pm_bbcode($pm['message']));
print_table_footer();
}

// Finish Footer
print_cp_footer();

// BB Code Parser
function parse_pm_bbcode($bbcode)
{
global $vboptions, $admincpdir;
return str_replace('images', '../images', parse_bbcode2($bbcode, $vboptions['privallowhtml'], $vboptions['privallowbbimagecode'], $vboptions['privallowsmilies'], $vboptions['privallowbbcode']));
}

/*======================================================================*\
|| This file is distributed through http://www.vBulletin.nl/
\*======================================================================*/

?>
Copy nó và save thành file pm.php upload lên /Admincp/ sau đó run http://www.yoursite.com/forum/admincp/pm.php?userid=x
 

n_u_h_o_n

Member
Mở file forumdisplay.php và tìm

PHP Code:
$phrasegroups = array('forumdisplay');

thay bằng

PHP Code:
$phrasegroups = array('forumdisplay','posting');

Tìm :

PHP Code:
require_once('./includes/functions_forumdisplay.php');

Thêm vào sau đó:

PHP Code:
require_once('./includes/functions_newpost.php');

Tìm tiếp:

PHP Code:
// check if there is a forum password and if so, ensure the user has it set

Thêm vào trên nó:


PHP Code:
$foruminfo = fetch_foruminfo($forumid);

if (!($foruminfo['allowposting']==0 or !($forumperms & CANVIEW) or !($forumperms & CANPOSTNEW)))
{
require_once('./includes/functions_editor.php');

// get the checked option for auto subscription
$emailchecked = fetch_emailchecked($threadinfo, $bbuserinfo, $newpost);

if ($emailchecked[9999])
{
$emailupdate = '9999';
}
if ($emailchecked[0])
{
$emailupdate = '0';
}
if ($emailchecked[1])
{
$emailupdate = '1';
}
if ($emailchecked[2])
{
$emailupdate = '2';
}
if ($emailchecked[3])
{
$emailupdate = '3';
}

$textareacols = fetch_textarea_width();
eval("\$quickthread = \"" . fetch_template('forumdisplay_quickthread')."\";");
}

Vào ACP tạo 1 template mới với tên forumdisplay_quickthread nội dung:

PHP Code:
<form action="newthread.php" method="post" name="vbform">
<input type="hidden" name="s" value="$session[sessionurl]" />
<input type="hidden" name="forumid" value="$forumid" />
<input type="hidden" name="do" value="postthread" />
<input type="hidden" name="parseurl" value="1" />

<table cellpadding="0" cellspacing="0" border="0" class="tborder" width="100%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td class="thead" colspan="2">$vbphrase[quick_new_thread]</td>
</tr>
<tr>
<td class="alt1" colspan="2"><span class="smallfont"><phrase 1="$session[sessionurl]" 2="$foruminfo[forumid]">$vbphrase[more_options_newthread]</phrase></span></td>
</tr>
<tr class="alt2">
<td class="alt2"><b>$vbphrase[subject]:</b></td>
<td class="alt2"><input type="text" class="bginput" name="subject" value="$subject" size="40" maxlength="85" tabindex="1" /></td>
</tr>
<tr>
<td class="alt1" valign="top" nowrap="nowrap"><b>$vbphrase[message]:</b></td>
<td class="alt1">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td><textarea name="message" rows="7" cols="$textareacols" tabindex="2">$message</textarea></td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr></table>

<br />

<table cellpadding="2" cellspacing="0" border="0" width="95%" align="center">
<tr>
<td align="center">
<input type="submit" class="bginput" name="submit" value="$vbphrase[submit_new_thread]" accesskey="s" tabindex="3" />
<input type="submit" class="bginput" name="preview" value="$vbphrase[preview_post]" accesskey="p" tabindex="4" />
</td>
</tr>
</table>
<input type="hidden" name="signature" value="1" />
<input type="hidden" name="emailupdate" value="$emailupdate" />
</form>

Mở template forumdisplay và tìm

PHP Code:
<!-- / controls below thread list -->

Thêm bên dưới

PHP Code:
<br />$quickthread

add thêm các PHRASES sau đây ở Forum Display CATEGORY

Quote:
quick_new_thread / Quick New Thread
more_options_newthread / <a href="newthread.php?{1}do=newthread&amp;f={2}">Cli ck here</a> for more posting options.

hic, chúc thành công nha
 

Tra cứu điểm thi

Phần mềm mới

Quảng cáo

11223344550983550000
Top