Beispiel #1
0
function newpoints_plugin_activate()
{
    global $db, $lang;
    newpoints_add_template('newpoints_postbit', '<br /><span class="smalltext">{$currency}: <a href="{$mybb->settings[\'bburl\']}/newpoints.php">{$points}</a></span>{$donate}');
    newpoints_add_template('newpoints_profile', '<tr>
	<td class="trow2"><strong>{$currency}:</strong></td>
	<td class="trow2"><a href="{$mybb->settings[\'bburl\']}/newpoints.php">{$points}</a>{$donate}</td>
</tr>');
    newpoints_add_template('newpoints_donate_inline', ' <span class="smalltext">[<a href="{$mybb->settings[\'bburl\']}/newpoints.php?action=donate&amp;uid={$uid}">{$lang->newpoints_donate}</a>]</span>');
    newpoints_add_template('newpoints_donate', '
<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->newpoints} - {$lang->newpoints_donate}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
<td valign="top" width="180">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
</tr>
{$options}
</table>
</td>
<td valign="top">
<form action="newpoints.php" method="POST">
<input type="hidden" name="postcode" value="{$mybb->post_code}" />
<input type="hidden" name="action" value="do_donate" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->newpoints_donate}</strong></td>
</tr>
<tr>
<td class="trow1" width="50%"><strong>{$lang->newpoints_user}:</strong><br /><span class="smalltext">{$lang->newpoints_user_desc}</span></td>
<td class="trow1" width="50%"><input type="text" name="username" value="{$user[\'username\']}" class="textbox" /></td>
</tr>
<tr>
<td class="trow2" width="50%"><strong>{$lang->newpoints_amount}:</strong><br /><span class="smalltext">{$lang->newpoints_amount_desc}</span></td>
<td class="trow2" width="50%"><input type="text" name="amount" value="" class="textbox" /></td>
</tr>
<tr>
<td class="trow1" width="50%"><strong>{$lang->newpoints_reason}:</strong><br /><span class="smalltext">{$lang->newpoints_reason_desc}</span></td>
<td class="trow1" width="50%"><input type="text" name="reason" value="" class="textbox" /></td>
</tr>
<tr>
<td class="tfoot" width="100%" colspan="2" align="center"><input type="submit" name="submit" value="{$lang->newpoints_submit}" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
{$footer}
</body>
</html>');
    newpoints_add_template('newpoints_statistics', '
<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->newpoints} - {$lang->newpoints_statistics}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
    <tr>
        <td valign="top" width="180">
            <table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
                <tr>
                <td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
                </tr>
                {$options}
            </table>
        </td>
        <td valign="top">
            <table width="100%" border="0" align="center">
                <tr>
                    <td valign="top" width="40%">
                        <table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
                            <tr>
                                <td class="thead" colspan="2"><strong>{$lang->newpoints_richest_users}</strong></td>
                            </tr>
                            <tr>
                                <td class="tcat" width="50%"><strong>{$lang->newpoints_user}</strong></td>
                                <td class="tcat" width="50%" align="center"><strong>{$lang->newpoints_amount}</strong></td>
                            </tr>
                            {$richest_users}
                        </table>
                    </td>
                </tr>
            </table>
        </td>
        <td valign="top" width="60%">
            <table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
                <tr>
                    <td class="thead" colspan="4"><strong>{$lang->newpoints_last_donations}</strong></td>
                </tr>
                <tr>
                    <td class="tcat" width="30%"><strong>{$lang->newpoints_from}</strong></td>
                    <td class="tcat" width="30%"><strong>{$lang->newpoints_to}</strong></td>
                    <td class="tcat" width="20%" align="center"><strong>{$lang->newpoints_amount}</strong></td>
                    <td class="tcat" width="20%" align="center"><strong>{$lang->newpoints_date}</strong></td>
                </tr>
                {$last_donations}
            </table>
        </td>
    </tr>
</table>
{$footer}
</body>
</html>');
    newpoints_add_template('newpoints_statistics_richest_user', '
<tr>
<td class="{$bgcolor}" width="50%">{$user[\'username\']}</td>
<td class="{$bgcolor}" width="50%" align="center">{$user[\'newpoints\']}</td>
</tr>');
    newpoints_add_template('newpoints_statistics_donation', '
<tr>
<td class="{$bgcolor}" width="30%">{$donation[\'from\']}</td>
<td class="{$bgcolor}" width="30%">{$donation[\'to\']}</td>
<td class="{$bgcolor}" width="20%" align="center">{$donation[\'amount\']}</td>
<td class="{$bgcolor}" width="20%" align="center">{$donation[\'date\']}</td>
</tr>');
    newpoints_add_template('newpoints_no_results', '
<tr>
<td class="{$bgcolor}" width="100%" colspan="{$colspan}">{$no_results}</td>
</tr>');
    newpoints_add_template('newpoints_option', '
<tr>
<td class="{$bgcolor}" width="100%">{$option}</td>
</tr>');
    newpoints_add_template('newpoints_home', '
<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->newpoints}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
<td valign="top" width="180">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
</tr>
{$options}
</table>
</td>
<td valign="top">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->newpoints}</strong></td>
</tr>
<tr>
<td class="trow1">{$lang->newpoints_home_desc}</td>
</tr>
</table>
</td>
</tr>
</table>
{$footer}
</body>
</html>');
    newpoints_do_template_edits();
    //Change admin permissions
    change_admin_permission("newpoints", false, 1);
    change_admin_permission("newpoints", "plugins", 1);
    change_admin_permission("newpoints", "settings", 1);
    change_admin_permission("newpoints", "log", 1);
    change_admin_permission("newpoints", "maintenance", 1);
    change_admin_permission("newpoints", "forumrules", 1);
    change_admin_permission("newpoints", "grouprules", 1);
    change_admin_permission("newpoints", "stats", 1);
    change_admin_permission("newpoints", "upgrades", 1);
}
Beispiel #2
0
function newpoints_shop_activate()
{
    global $db, $mybb;
    newpoints_add_template('newpoints_shop', '
<html>
<head>
<title>{$lang->newpoints} - {$lang->newpoints_shop}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
<td valign="top" width="180">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
</tr>
{$options}
</table>
</td>
<td valign="top">
{$inline_errors}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="5"><div style="float: right"><strong><a href="{$mybb->settings[\'bburl\']}/newpoints.php?action=shop&amp;shop_action=myitems" style="text-decoration: underline">{$lang->newpoints_shop_myitems}</a></strong></div><strong>{$lang->newpoints_shop}</strong></td>
</tr>
<tr>
<td class="tcat" width="1%"><strong>{$lang->newpoints_shop_icon}</strong></td>
<td class="tcat"><strong>{$lang->newpoints_shop_name}</strong></td>
<td class="tcat" width="20%" align="center"><strong>{$lang->newpoints_shop_price}</strong></td>
<td class="tcat" width="20%" align="center"><strong>{$lang->newpoints_shop_stock}</strong></td>
<td class="tcat" width="10%" align="center"><strong>{$lang->newpoints_shop_buy}</strong></td>
</tr>
{$cats}
</table>
</td>
</tr>
</table>
{$footer}
</body>
</html>');
    newpoints_add_template('newpoints_shop_category', '
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="5"><div class="expcolimage"><img src="{$theme[\'imgdir\']}/{$expcolimage}" id="cat_{$category[\'cid\']}_img" class="expander" alt="{$expaltext}" title="{$expaltext}" /></div>
{$category[\'icon\']} <strong>{$category[\'name\']}</strong> <span class="smalltext">{$category[\'description\']}</span></td>
</tr>
</table>
<div style="max-height: 200px; overflow: auto;">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tbody id="cat_{$category[\'cid\']}_e" style="{$expdisplay}">
{$items}
</tbody>
</table>
</div>');
    newpoints_add_template('newpoints_shop_item', '
<tr>
<td class="{$bgcolor}" width="1%" valign="middle" align="center">{$item[\'icon\']}</td>
<td class="{$bgcolor}" valign="middle"><a href="{$mybb->settings[\'bburl\']}/newpoints.php?action=shop&amp;shop_action=view&amp;iid={$item[\'iid\']}">{$item[\'name\']}</a><br /><span class="smalltext">{$item[\'description\']}</span></td>
<td class="{$bgcolor}" width="20%" align="center" valign="middle">{$item[\'price\']}</td>
<td class="{$bgcolor}" width="20%" align="center" valign="middle">{$item[\'stock\']}</td>
<td class="{$bgcolor}" width="10%" align="center" valign="middle"><form action="newpoints.php?action=do_shop&amp;shop_action=buy" method="POST"><input type="hidden" name="postcode" value="{$mybb->post_code}"><input type="hidden" name="iid" value="{$item[\'iid\']}"><input type="submit" name="buy" value="{$lang->newpoints_shop_buy}"></form></td>
</tr>');
    newpoints_add_template('newpoints_shop_no_items', '
<tr>
<td class="trow1" colspan="5">{$lang->newpoints_shop_no_items}</td>
</tr>');
    newpoints_add_template('newpoints_shop_no_cats', '
<tr>
<td class="trow1" colspan="5">{$lang->newpoints_shop_no_cats}</td>
</tr>');
    newpoints_add_template('newpoints_shop_myitems', '
<html>
<head>
<title>{$lang->newpoints} - {$lang->newpoints_shop_myitems}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
<td valign="top" width="180">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
</tr>
{$options}
</table>
</td>
<td valign="top">
{$inline_errors}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4"><strong><div style="float: right"><a href="{$mybb->settings[\'bburl\']}/newpoints.php?action=shop">{$lang->newpoints_shop}</a></div>{$lang->newpoints_shop_myitems}</strong></td>
</tr>
{$items}
</table>
{$multipage}
</td>
</tr>
</table>
{$footer}
</body>
</html>');
    newpoints_add_template('newpoints_shop_myitems_item', '
<td class="{$bgcolor}" width="50%" valign="middle" align="center">
<fieldset class="{$invert_bgcolor}" style="width: 80%;"><legend>{$item[\'icon\']} <strong><a href="{$mybb->settings[\'bburl\']}/newpoints.php?action=shop&amp;shop_action=view&amp;iid={$item[\'iid\']}">{$item[\'name\']}</a></strong></legend>
<div align="left"><span class="smalltext">{$item[\'description\']}</span></div>
<div align="left">
{$lang->newpoints_shop_price}: {$item[\'price\']}<br />
{$lang->newpoints_shop_quantity}: {$item[\'quantity\']}
</div>
</fieldset>
<fieldset class="{$invert_bgcolor}" style="width: 80%; margin-bottom: 5px;">
<legend>{$lang->newpoints_shop_options}</legend>
<table border="0">
<tr>
{$send}{$sell}
</tr>
</table>
</fieldset>
</td>
');
    newpoints_add_template('newpoints_shop_myitems_item_empty', '
<td class="{$bgcolor}" width="50%" valign="middle"></td>
');
    newpoints_add_template('newpoints_shop_myitems_no_items', '
<tr>
<td class="trow1" colspan="2">{$lang->newpoints_shop_no_items}</td>
</tr>');
    newpoints_add_template('newpoints_shop_do_action', '
<head>
<title>{$lang->newpoints} - {$lang->newpoints_shop_action}</title>
{$headerinclude}
</head>
<body>
{$header}
<form action="newpoints.php?action=do_shop" method="POST">
<input type="hidden" name="postcode" value="{$mybb->post_code}">
<input type="hidden" name="shop_action" value="{$shop_action}">
{$fields}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="{$colspan}"><strong>{$lang->newpoints_shop_action}:</strong> {$item[\'name\']}</td>
</tr>
<tr>
{$data}
</tr>
<tr>
<td class="tfoot" width="100%" align="center" colspan="{$colspan}"><input type="submit" name="submit" value="{$lang->newpoints_shop_confirm}"></td>
</tr>
</table>
</form>
{$footer}
</body>
</html>');
    newpoints_add_template('newpoints_shop_stats', '
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4"><strong>{$lang->newpoints_shop_lastpurchases}</strong></td>
</tr>
<tr>
<td class="tcat" width="40%"><strong>{$lang->newpoints_shop_user}</strong></td>
<td class="tcat" width="30%"><strong>{$lang->newpoints_shop_item}</strong></td>
<td class="tcat" width="30%" align="center"><strong>{$lang->newpoints_shop_date}</strong></td>
</tr>
{$last_purchases}
</table><br />');
    newpoints_add_template('newpoints_shop_stats_purchase', '
<tr>
<td class="{$bgcolor}" width="40%">{$purchase[\'user\']}</td>
<td class="{$bgcolor}" width="30%">{$purchase[\'item\']}</td>
<td class="{$bgcolor}" width="30%" align="center">{$purchase[\'date\']}</td>
</tr>');
    newpoints_add_template('newpoints_shop_stats_nopurchase', '
<tr>
<td class="trow1" width="100%" colspan="3">{$lang->newpoints_shop_no_purchases}</td>
</tr>');
    newpoints_add_template('newpoints_shop_profile', '<tr>
	<td class="trow2"><strong>{$lang->newpoints_shop_items}:</strong></td>
	<td class="trow2">{$shop_items} <span class="smalltext">(<a href="{$mybb->settings[\'bburl\']}/newpoints.php?action=shop&amp;shop_action=myitems&amp;uid={$memprofile[\'uid\']}">{$lang->newpoints_shop_view_all_items}</a>)</span></td>
</tr>');
    newpoints_add_template('newpoints_shop_postbit', '
	<br />{$lang->newpoints_shop_items}: {$shop_items} <span class="smalltext">(<a href="{$mybb->settings[\'bburl\']}/newpoints.php?action=shop&amp;shop_action=myitems&amp;uid={$post[\'uid\']}">{$lang->newpoints_shop_view_all_items}</a>)</span>');
    newpoints_add_template('newpoints_shop_view_item', '
<html>
<head>
<title>{$lang->newpoints} - {$lang->newpoints_shop_view_item}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
<td valign="top" width="180">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
</tr>
{$options}
</table>
</td>
<td valign="top">
{$inline_errors}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" width="100%"><strong>{$lang->newpoints_shop_view_item}:</strong> {$item[\'name\']}</td>
</tr>
<tr>
<td class="trow1" width="100%">{$item[\'icon\']} {$item[\'name\']}<br /><span class="smalltext">{$item[\'description\']}</span></td>
</tr>
<tr>
<td class="trow2" width="100%"><strong>{$lang->newpoints_shop_price}:</strong> {$item[\'price\']}</td>
</tr>
<tr>
<td class="trow1" width="100%"><strong>{$lang->newpoints_shop_stock}:</strong> {$item[\'stock\']}</td>
</tr>
<tr>
<td class="trow2" width="100%"><strong>{$lang->newpoints_shop_sendable}:</strong> {$item[\'sendable\']}</td>
</tr>
<tr>
<td class="trow1" width="100%"><strong>{$lang->newpoints_shop_sellable}:</strong> {$item[\'sellable\']}</td>
</tr>
<tr>
<td class="tfoot" width="100%" align="center" colspan="2"><form action="newpoints.php?action=do_shop&amp;shop_action=buy" method="POST"><input type="hidden" name="postcode" value="{$mybb->post_code}"><input type="hidden" name="iid" value="{$item[\'iid\']}"><input type="submit" name="buy" value="{$lang->newpoints_shop_buy}"></form></td>
</tr>
</table>
</td>
</tr>
</table>
{$footer}
</body>
</html>
');
    // edit templates
    newpoints_find_replace_templatesets('newpoints_statistics', '#' . preg_quote('width="60%">') . '#', 'width="60%">{$newpoints_shop_lastpurchases}');
    newpoints_find_replace_templatesets('newpoints_postbit', '#' . preg_quote('{$donate}') . '#', '{$donate}{$post[\'newpoints_shop_items\']}');
    require_once MYBB_ROOT . "inc/adminfunctions_templates.php";
    find_replace_templatesets("member_profile", '#' . preg_quote('{$warning_level}') . '#', '{$warning_level}' . '{$newpoints_shop_profile}');
    find_replace_templatesets("member_profile_adminoptions", '#' . preg_quote('</ul>') . '#', '<li><a href="{$mybb->settings[\'bburl\']}/{$config[\'admin_dir\']}/index.php?module=newpoints-shop&amp;action=inventory&amp;uid={$uid}">{$lang->newpoints_shop_edit_inventory}</a></li></ul>');
}
Beispiel #3
0
function upgrade11_run()
{
    newpoints_add_setting('newpoints_income_referral', 'income', 'Per Referral', 'Amount of points received everytime a user is referred. (the referred user is who receives the points)', 'text', '5', 12);
    change_admin_permission("newpoints", "upgrades", 1);
    newpoints_remove_templates("'newpoints_donate'");
    newpoints_add_template('newpoints_donate', '
<html>
<head>
<title>{$lang->newpoints} - {$lang->newpoints_donate}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
<td valign="top" width="180">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->newpoints_menu}</strong></td>
</tr>
{$options}
</table>
</td>
<td valign="top">
<form action="newpoints.php" method="POST">
<input type="hidden" name="postcode" value="{$mybb->post_code}">
<input type="hidden" name="action" value="do_donate">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->newpoints_donate}</strong></td>
</tr>
<tr>
<td class="trow1" width="50%"><strong>{$lang->newpoints_user}:</strong><br /><span class="smalltext">{$lang->newpoints_user_desc}</span></td>
<td class="trow1" width="50%"><input type="text" name="username" value="{$user[\'username\']}" class="textbox"></td>
</tr>
<tr>
<td class="trow2" width="50%"><strong>{$lang->newpoints_amount}:</strong><br /><span class="smalltext">{$lang->newpoints_amount_desc}</span></td>
<td class="trow2" width="50%"><input type="text" name="amount" value="" class="textbox"></td>
</tr>
<tr>
<td class="trow1" width="50%"><strong>{$lang->newpoints_reason}:</strong><br /><span class="smalltext">{$lang->newpoints_reason_desc}</span></td>
<td class="trow1" width="50%"><input type="text" name="reason" value="" class="textbox"></td>
</tr>
<tr>
<td class="tfoot" width="100%" colspan="2" align="center"><input type="submit" name="submit" value="{$lang->newpoints_submit}"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
{$footer}
</body>
</html>');
}