Example #1
0
/**
Retrieve the otms and display on the sidebar
*/
function display_otms()
{
    global $mybb, $db, $cache, $templates, $otms, $crazyweekwriters, $crazymonthwriters;
    $awards = new OtmAwards($mybb, $db, $cache);
    $weeklimit = strtotime('Last Sunday', time());
    $monthlimit = strtotime(date('Y-m-01 00:00:00'));
    $otmarray = $awards->get_display_otms();
    foreach ($awards->crazy_writers($weeklimit, 3) as $user) {
        eval("\$crazyweekwriters .= \"" . $templates->get('rpgotm_crazywriter') . "\";");
    }
    foreach ($awards->crazy_writers($monthlimit, 3) as $user) {
        eval("\$crazymonthwriters .= \"" . $templates->get('rpgotm_crazywriter') . "\";");
    }
    eval("\$otms = \"" . $templates->get('rpgotm_index') . "\";");
}
Example #2
0
<?php

// Disallow direct access to this file for security reasons
if (!defined("IN_MYBB")) {
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
require_once MYBB_ROOT . "/inc/plugins/rpg_suite/models/class_OtmAwards.php";
// Generate list of IC Groups for editing
$awards = new OtmAwards($mybb, $db, $cache);
$plugins->run_hooks("admin_rpgsuite_otms_begin");
if ($mybb->request_method == "post") {
    $deleteids = '';
    if ($mybb->input['action'] == 'create') {
        if (!empty($mybb->input['awardname'])) {
            $createaward = array('name' => $db->escape_string($mybb->input['awardname']), 'type' => $db->escape_string($mybb->input['awardtype']), 'value' => $db->escape_string($mybb->input['awardvalue']));
            $awards->update_otm($createaward);
            flash_message("Award successfully created!", "success");
            admin_redirect("");
        }
    } else {
        foreach ($awards->get_otms() as $award) {
            if (is_array($mybb->input['deleteawards']) && in_array($award['id'], $mybb->input['deleteawards'])) {
                $deleteids .= $award['id'] . ',';
            } else {
                $modifyaward = array('id' => $award['id'], 'name' => $db->escape_string($mybb->input['award' . $award['id'] . 'name']), 'type' => $db->escape_string($mybb->input['award' . $award['id'] . 'type']), 'value' => $db->escape_string($mybb->input['award' . $award['id'] . 'value']));
                $awards->update_otm($modifyaward);
            }
        }
        if (!empty($deleteids)) {
            $awards->delete_otms(rtrim($deleteids, ','));
        }