Template Editing
Page 1 of 1
Template Editing
I have phpbb2 and I want to know if there are any sources of codes I can add- Like maybe something extra in the moderation panel or something. Also, I have cash mod scripts, but I don't know how to install them.
Edited: Are we even allowed to use mod scripts if we have them? For example, I found a script to make the points field, automatic, etc. (Cash mod basically) Also, a shop script, and so on. Can we make another part- Like on display, they have general, profile, etc. Can we make a category?
Edited: Are we even allowed to use mod scripts if we have them? For example, I found a script to make the points field, automatic, etc. (Cash mod basically) Also, a shop script, and so on. Can we make another part- Like on display, they have general, profile, etc. Can we make a category?
paint- Forumember
- Posts : 686
Reputation : 3
Language : English
Re: Template Editing
Is the scripts javascript? Post the script and I will tell you if you can add it with template editing.
Guest- Guest
Re: Template Editing
There are 2- This is one version: I can't post the full- The message is too long.
- Code:
define('IN_PHPBB', true);
define('IN_CASHMOD', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);
//
// End session management
//
if ( !$userdata['session_logged_in'] )
{
redirect(append_sid("login.$phpEx?redirect=cash.$phpEx", true));
}
$mode = isset($HTTP_POST_VARS['mode'])?$HTTP_POST_VARS['mode']:(isset($HTTP_GET_VARS['mode'])?$HTTP_GET_VARS['mode']:(""));
switch( $mode )
{
//
//========================================[ Donate Code ]===========================
//
case "donate":
$ref = isset($HTTP_GET_VARS['ref'])?$HTTP_GET_VARS['ref']:'index';
$target = ( isset($HTTP_GET_VARS[POST_USERS_URL]) )?intval($HTTP_GET_VARS[POST_USERS_URL]):(( isset($HTTP_GET_VARS['u']) )?intval($HTTP_GET_VARS['u']):0);
$post = ( isset($HTTP_GET_VARS[POST_POST_URL]) )?intval($HTTP_GET_VARS[POST_POST_URL]):(( isset($HTTP_GET_VARS['p']) )?intval($HTTP_GET_VARS['p']):0);
if ( ($target == ANONYMOUS) || ($target == $userdata['user_id']) || (!($profiledata = get_userdata($target))) )
{
if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
{
redirect(append_sid("index.$phpEx"));
exit;
}
}
//
// Load templates
//
$template->set_filenames(array(
'body' => 'cash_donate.tpl')
);
//
// Output page header
//
$page_title = $lang['Donate'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$hidden = '<input type="hidden" name="ref" value="' . $ref . '" />';
$hidden .= '<input type="hidden" name="' . POST_USERS_URL . '" value="' . $target . '" />';
if ( $ref == 'viewtopic' )
{
$hidden .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post . '" />';
}
$template->assign_vars(array(
'S_DONATE_ACTION' => append_sid("cash.$phpEx?mode=donated"),
'S_HIDDEN_FIELDS' => $hidden,
'L_DONATE' => $lang['Donate'],
'L_FROM' => $lang['From'],
'L_TO' => $lang['To'],
'L_CONVERT' => $lang['Convert'],
'L_SELECT_ONE' => $lang['Select_one'],
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
'L_AMOUNT' => $lang['Amount'],
'L_DONATE_TO' => sprintf($lang['Donate_to'],$profiledata['username']),
'L_MESSAGE' => $lang['Message'],
'TARGET' => $profiledata['username'],
'DONATER' => $userdata['username'])
);
while ( $c_cur = &$cash->currency_next($cm_i,CURRENCY_ENABLED | CURRENCY_DONATE) )
{
$template->assign_block_vars('cashrow',array( 'CASH_NAME' => $c_cur->name(),
'RECEIVER_AMOUNT' => $profiledata[$c_cur->db()],
'DONATER_AMOUNT' => $userdata[$c_cur->db()],
'S_DONATE_FIELD' => 'cash[' . $c_cur->id() . ']')
);
}
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
break;
//
//========================================[ Donated Code ]===========================
//
case "donated":
$ref = isset($HTTP_POST_VARS['ref'])?$HTTP_POST_VARS['ref']:'index';
$target = ( isset($HTTP_POST_VARS[POST_USERS_URL]) )?intval($HTTP_POST_VARS[POST_USERS_URL]):(( isset($HTTP_POST_VARS['u']) )?intval($HTTP_POST_VARS['u']):0);
$post = ( isset($HTTP_POST_VARS[POST_POST_URL]) )?intval($HTTP_POST_VARS[POST_POST_URL]):(( isset($HTTP_POST_VARS['p']) )?intval($HTTP_POST_VARS['p']):0);
if ( ($target == ANONYMOUS) || ($target == $userdata['user_id']) || (!($profiledata = get_userdata($target))) )
{
if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
{
redirect(append_sid("index.$phpEx"));
exit;
}
}
$target = new cash_user($target,$profiledata);
$donater = new cash_user($userdata['user_id'],$userdata);
if ( ($target->id() != $donater->id()) && isset($HTTP_POST_VARS['cash']) && is_array($HTTP_POST_VARS['cash']) )
{
$donate_array = array();
$donate = false;
while ( $c_cur = &$cash->currency_next($cm_i,CURRENCY_ENABLED | CURRENCY_DONATE) )
{
if ( isset($HTTP_POST_VARS['cash'][$c_cur->id()]) &&
is_numeric($HTTP_POST_VARS['cash'][$c_cur->id()]) )
{
$amount = cash_floatval($HTTP_POST_VARS['cash'][$c_cur->id()]);
if ( $amount > 0 )
{
$amount = ( $donater->has($c_cur->id(),$amount) ) ? $amount : $donater->amount($c_cur->id());
$donate_array[$c_cur->id()] = $amount;
$message_clause[] = $c_cur->display($amount,true);
$donate = true;
}
}
}
if ( $donate )
{
$donater->remove_by_id_array($donate_array);
$target->give_by_id_array($donate_array);
$action = array($donater->id(),
$donater->name(),
implode('</b>, <b>',$message_clause),
$target->id(),
$target->name());
$message = ( isset($HTTP_POST_VARS['message']) )?str_replace("\'","''",$HTTP_POST_VARS['message']):'';
cash_create_log(CASH_LOG_DONATE,$action,$message);
if ( ($message != '') && $userdata['user_allow_pm'] )
{
$privmsg_subject = sprintf($lang['Donation_recieved'],$userdata['username']);
$preamble = sprintf($lang['Has_donated'],$userdata['username'],implode('[/b], [b]',$message_clause),$userdata['username']);
$message = str_replace("'","''",$preamble) . $message;
cash_pm($profiledata,$privmsg_subject,$message);
}
}
if ( $ref == 'viewprofile' )
{
redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target->id()));
exit;
}
else if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
{
redirect(append_sid("index.$phpEx"));
exit;
}
}
break;
//
//========================================[ Modedit Code ]===========================
//
case "modedit":
$ref = isset($HTTP_GET_VARS['ref'])?$HTTP_GET_VARS['ref']:'index';
$target = ( isset($HTTP_GET_VARS[POST_USERS_URL]) )?intval($HTTP_GET_VARS[POST_USERS_URL]):(( isset($HTTP_GET_VARS['u']) )?intval($HTTP_GET_VARS['u']):0);
$post = ( isset($HTTP_GET_VARS[POST_POST_URL]) )?intval($HTTP_GET_VARS[POST_POST_URL]):(( isset($HTTP_GET_VARS['p']) )?intval($HTTP_GET_VARS['p']):0);
if ( ($target == ANONYMOUS) || (!($profiledata = get_userdata($target))) )
{
if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
{
redirect(append_sid("index.$phpEx"));
exit;
}
}
if ( ($userdata['user_level'] != ADMIN) && ($userdata['user_level'] != MOD))
{
if ( $ref == 'viewprofile' )
{
redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target));
exit;
}
else if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
{
redirect(append_sid("index.$phpEx"));
exit;
}
}
//
// Load templates
//
$template->set_filenames(array(
'body' => 'cash_modedit.tpl')
);
//
// Output page header
//
$page_title = sprintf($lang['Mod_usercash'],$profiledata['username']);
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$hidden = '<input type="hidden" name="ref" value="' . $ref . '" />';
$hidden .= '<input type="hidden" name="' . POST_USERS_URL . '" value="' . $target . '" />';
if ( $ref == 'viewtopic' )
{
$hidden .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post . '" />';
}
$template->assign_vars(array(
'S_MODEDIT_ACTION' => append_sid("cash.$phpEx?mode=modedited"),
'S_HIDDEN_FIELDS' => $hidden,
'L_DONATE' => $lang['Donate'],
'L_FROM' => $lang['From'],
'L_TO' => $lang['To'],
'L_CONVERT' => $lang['Convert'],
'L_SELECT_ONE' => $lang['Select_one'],
'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
'L_AMOUNT' => $lang['Amount'],
'L_DONATE_TO' => sprintf($lang['Donate_to'],$profiledata['username']),
'L_MESSAGE' => $lang['Message'],
'L_OMIT' => $lang['Omit'],
'L_ADD' => $lang['Add'],
'L_REMOVE' => $lang['Remove'],
'L_SET' => $lang['Set'],
'TITLE' => sprintf($lang['Mod_usercash'],$profiledata['username']),
'TARGET' => $profiledata['username'],
'DONATER' => $userdata['username'])
);
$mask = false;
if ( $userdata['user_level'] == MOD )
{
$mask = (CURRENCY_ENABLED | CURRENCY_MODEDIT);
}
while ( $c_cur = &$cash->currency_next($cm_i,$mask) )
{
$template->assign_block_vars('cashrow',array( 'CASH_NAME' => $c_cur->name(),
'RECEIVER_AMOUNT' => $profiledata[$c_cur->db()],
'DONATER_AMOUNT' => $userdata[$c_cur->db()],
'S_TYPE_FIELD' => 'cashtype[' . $c_cur->id() . ']',
'S_CHANGE_FIELD' => 'cashchange[' . $c_cur->id() . ']')
);
}
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
break;
//
//========================================[ Modedited Code ]===========================
//
case "modedited":
$ref = isset($HTTP_POST_VARS['ref'])?$HTTP_POST_VARS['ref']:'index';
$target = ( isset($HTTP_POST_VARS[POST_USERS_URL]) )?intval($HTTP_POST_VARS[POST_USERS_URL]):(( isset($HTTP_POST_VARS['u']) )?intval($HTTP_POST_VARS['u']):0);
$post = ( isset($HTTP_POST_VARS[POST_POST_URL]) )?intval($HTTP_POST_VARS[POST_POST_URL]):(( isset($HTTP_POST_VARS['p']) )?intval($HTTP_POST_VARS['p']):0);
if ( ($target == 0) || (!($profiledata = get_userdata($target))) )
{
if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
{
redirect(append_sid("index.$phpEx"));
exit;
}
}
if ( ($userdata['user_level'] != ADMIN) && ($userdata['user_level'] != MOD))
{
if ( $ref == 'viewprofile' )
{
redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target));
exit;
}
else if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
{
redirect(append_sid("index.$phpEx"));
exit;
}
}
$target = new cash_user($target,$profiledata);
if ( isset($HTTP_POST_VARS['cashtype']) && is_array($HTTP_POST_VARS['cashtype']) && isset($HTTP_POST_VARS['cashchange']) && is_array($HTTP_POST_VARS['cashchange']) )
{
$mask = false;
if ( $userdata['user_level'] == MOD )
{
$mask = (CURRENCY_ENABLED | CURRENCY_MODEDIT);
}
$moderate_array = array('1' => array(),'2' => array(),'3' => array());
$moderate_clause = array('1' => array(),'2' => array(),'3' => array());
$modedit = array('1'=>false,'2'=>false,'3'=>false);
$editlist = array();
while ( $c_cur = &$cash->currency_next($cm_i,$mask) )
{
if ( isset($HTTP_POST_VARS['cashtype'][$c_cur->id()]) &&
is_numeric($HTTP_POST_VARS['cashtype'][$c_cur->id()]) &&
($HTTP_POST_VARS['cashtype'][$c_cur->id()] != 0) &&
isset($HTTP_POST_VARS['cashchange'][$c_cur->id()]) &&
is_numeric($HTTP_POST_VARS['cashchange'][$c_cur->id()]) )
{
$amount = cash_floatval($HTTP_POST_VARS['cashchange'][$c_cur->id()]);
$allow_neg = $c_cur->mask(CURRENCY_ALLOWNEG);
$type = intval($HTTP_POST_VARS['cashtype'][$c_cur->id()]);
if ( (($type == 1) || ($type == 2)) && $amount < 0 )
{
$amount = -$amount;
$type = 3 - $type;
}
switch ( $type )
{
case 1: // add
$moderate_array[1][$c_cur->id()] = $amount;
$modedit[1] = true;
$moderate_clause[1][] = $c_cur->display($amount,true);
$editlist[] = $c_cur->name(true);
break;
case 2: // remove
if ( $allow_neg || $target->has($c_cur->id(),$amount) )
{
$moderate_array[2][$c_cur->id()] = $amount;
$modedit[2] = true;
$moderate_clause[2][] = $c_cur->display($amount,true);
$editlist[] = $c_cur->name(true);
}
break;
case 3: // set
if ( ($amount >= 0) || $allow_neg )
{
$moderate_array[3][$c_cur->id()] = $amount;
$modedit[3] = true;
$moderate_clause[3][] = $c_cur->display($amount,true);
$editlist[] = $c_cur->name(true);
}
break;
}
}
}
if ( $modedit[1] || $modedit[2] || $modedit[3] )
{
$message = ( isset($HTTP_POST_VARS['message']) )?str_replace("\'","''",$HTTP_POST_VARS['message']):'';
$action = array($userdata['user_id'],
$userdata['username'],
$target->id(),
$target->name(),
implode('</b>, <b>',$moderate_clause[1]),
implode('</b>, <b>',$moderate_clause[2]),
implode('</b>, <b>',$moderate_clause[3]));
cash_create_log(CASH_LOG_ADMIN_MODEDIT,$action,$message);
if ( $modedit[1] )
{
$target->give_by_id_array($moderate_array[1]);
}
if ( $modedit[2] )
{
$target->remove_by_id_array($moderate_array[2]);
}
if ( $modedit[3] )
{
$target->set_by_id_array($moderate_array[3]);
}
if ( ($message != '') && $userdata['user_allow_pm'] )
{
$privmsg_subject = sprintf($lang['Has_moderated'],$userdata['username'],implode(", ",$editlist));
$preamble = $privmsg_subject . ":\n[list]";
if ( $modedit[1] )
{
$preamble .= sprintf($lang['Has_added'],implode('[/b], [b]',$moderate_clause[1]));
}
if ( $modedit[2] )
{
$preamble .= sprintf($lang['Has_removed'],implode('[/b], [b]',$moderate_clause[2]));
}
if ( $modedit[3] )
{
$preamble .= sprintf($lang['Has_set'],implode('[/b], [b]',$moderate_clause[3]));
}
$message = str_replace("'","''",$preamble) . "[/list]\n" . $message;
cash_pm($profiledata,str_replace("'","''",$privmsg_subject),$message);
}
}
if ( $ref == 'viewprofile' )
{
redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target->id()));
exit;
}
else if ( ($ref == 'viewtopic') && ($post != 0) )
{
redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
exit;
}
else
paint- Forumember
- Posts : 686
Reputation : 3
Language : English
Re: Template Editing
Oh... Thinks to self... NOOOOOOOOOOOO!!
paint- Forumember
- Posts : 686
Reputation : 3
Language : English
Similar topics
» editing the chatbox with template editing
» Editing Template?
» Template editing.
» Ok, So what is template editing?
» Cannot see template editing
» Editing Template?
» Template editing.
» Ok, So what is template editing?
» Cannot see template editing
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum