Example #1
0
        $form->end();
    }
    $plugins->run_hooks("newpoints_admin_maintenance_reset_start");
} elseif ($mybb->input['action'] == 'reconstruct') {
    $plugins->run_hooks("newpoints_admin_maintenance_reconstruct_start");
    if ($mybb->input['no']) {
        admin_redirect("index.php?module=newpoints-maintenance");
    }
    if ($mybb->request_method == "post") {
        if (!isset($mybb->input['my_post_key']) || $mybb->post_code != $mybb->input['my_post_key']) {
            $mybb->request_method = "get";
            flash_message($lang->newpoints_error, 'error');
            admin_redirect("index.php?module=newpoints-maintenance");
        }
        newpoints_undo_template_edits();
        newpoints_do_template_edits();
        log_admin_action($lang->newpoints_reconstruct_done);
        flash_message($lang->newpoints_reconstructed, 'success');
        admin_redirect('index.php?module=newpoints-maintenance');
    } else {
        $mybb->input['per_page'] = intval($mybb->input['per_page']);
        $form = new Form("index.php?module=newpoints-maintenance&action=reconstruct&my_post_key={$mybb->post_code}", 'post');
        echo "<div class=\"confirm_action\">\n";
        echo "<p>{$lang->newpoints_reconstructconfirm}</p>\n";
        echo "<br />\n";
        echo "<p class=\"buttons\">\n";
        echo $form->generate_submit_button($lang->yes, array('class' => 'button_yes'));
        echo $form->generate_submit_button($lang->no, array("name" => "no", 'class' => 'button_no'));
        echo "</p>\n";
        echo "</div>\n";
        $form->end();
Example #2
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);
}