public function renderSidebar()
 {
     global $event, $signups, $db;
     if (!Session::hasPriv('FORCE_SIGNUPS')) {
         return;
     }
     if (!isset($event) || empty($signups)) {
         return;
     }
     $sql = 'SELECT u.id, u.username FROM plugin_regulars r INNER JOIN users u ON r.user = u.id WHERE r.user NOT IN (SELECT s.user FROM signups s WHERE s.event = :eventId) ';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':eventId', $event['id']);
     $stmt->execute();
     $regularUsers = $stmt->fetchAll();
     startBox();
     if (count($regularUsers) > 0) {
         echo '<p>The following regulars are not signed up:</p> ';
         echo '<ul>';
         foreach ($regularUsers as $user) {
             echo '<li><a href = "profile.php?id=' . $user['id'] . '">' . $user['username'] . '</a> (<span class = "dummyLink" onclick = "document.getElementById(\'username\').value = \'' . $user['username'] . '\'" >force</span>)</li>';
         }
         echo '</ul>';
     } else {
         echo 'All the regulars are signed up to this event!';
     }
     echo '<p><a href = "plugins.php">Plugin admin</a></p>';
     stopBox('Regulars');
 }
Example #2
0
    }
    if ($_GET['type'] == "SLAVE") {
        $sql = "INSERT INTO `slaves` (`name`, `gold` ) VALUES ('" . $_GET['name'] . "', '" . $_GET['gold'] . "')";
    } else {
        $sql = "INSERT INTO `shop` (`type`, `name`, `gold`, `turns`, `description`) VALUES ('" . $_GET['type'] . "', '" . $_GET['name'] . "', '" . $_GET['gold'] . "', '" . $_GET['turns'] . "', '" . $_GET['type'] . "' )";
    }
    $stmt = DatabaseFactory::getInstance()->prepare($sql);
    $stmt->execute();
    $core->redirect('admin.php', "Item added successfully.");
}
$title = "Add shop item";
require_once "includes/widgets/header.php";
startBox($title, BOX_GREEN);
?>

<form action = "adminShopAddItem.php">
<label>Type <select name = "type">
	<option>BUSINESS</option>
	<option>SLAVE</option>
	<option>ACCESSORY</option>
</select></label><br /><br />
<label>Name <input name = "name" /></label><br /><br />
<label>Gold <input name = "gold" /></label><br /><br />
<label>Turns <input name = "turns" /></label><br /><br />
<label>Description<br /><textarea name = "description"></textarea></label><br /><br />
<input type = "submit" name = "submit" value = "add" />
</form>

<?php 
stopBox(BOX_GREEN);
require_once "includes/widgets/footer.php";
Example #3
0
    $turns = getTurns($currentUser['username']);
    $ranking = intval($turns['total'] * $currentUser['gold'] / 10000);
    $currentUser['ranking'] = $ranking;
    $leader_array[] = $currentUser;
}
$ranking = array();
foreach ($leader_array as $key => $row) {
    $ranking[$key] = $row['ranking'];
}
array_multisort($ranking, SORT_DESC, $leader_array);
startBox("About the leaderboard", BOX_YELLOW);
echo "This is a list of the current 30 best players, ordered by ";
popup("ranking", "help.php?topic=rankings");
echo ". There are proberbly lots of other players, but they dont qualify for the leaderboard, yet.";
echo "<br /><br />";
stopBox(BOX_YELLOW);
?>

<table class = "normal">
<tr>
	<th style = 'width: 10%;'>ranking</th>
	<th>username</th>
	<th style = 'width: 20%;'>gold</th>
	<th style = 'width: 20%;'>registerd</th>
</tr>



<?php 
$i = 0;
while ($i < sizeof($leader_array)) {
Example #4
0
function redirect($url, $reason, $showRedirectionPage = true, $karma = 0)
{
    define('REDIRECT', $url);
    if (!$showRedirectionPage) {
        SessionBasedNotifications::getInstance()->add($reason, $karma);
        define('REDIRECT_TIMEOUT', 0);
    } else {
        define('REDIRECT_TIMEOUT', 3);
    }
    require_once 'includes/widgets/header.minimal.php';
    echo '<br />';
    startBox();
    echo '<p>You are being redirected to <a href = "' . $url . '">here</a>.</p>';
    stopBox('Redirecting: ' . $reason);
    require_once 'includes/widgets/footer.minimal.php';
}
Example #5
0
        break;
    case 'delete':
        if (!Session::hasPriv('NEWS_DELETE')) {
            throw new PermissionException();
        }
        $id = intval($_REQUEST['id']);
        $sql = 'DELETE FROM news WHERE id = :id ';
        $stmt = $db->prepare($sql);
        $stmt->bindValue(':id', $id);
        $stmt->execute();
        logAndRedirect('news.php', 'News deleted: ' . $id);
        break;
    default:
        require_once 'includes/widgets/header.php';
        require_once 'includes/widgets/sidebar.php';
        $news = new News();
        $news->setCount(10);
        while ($article = $news->getNext()) {
            startBox();
            echo '<p><span class = "subtle">Posted on ' . formatDt(new DateTime($article['date'])) . ' by <a href = "profile.php?id=' . $article['author'] . '">' . $article['username'] . '</a>.</span></p>';
            echo htmlify($article['content']);
            if (Session::hasPriv('NEWS_DELETE')) {
                echo '<dl class = "subtle">';
                echo '<dt><a href = "news.php?action=delete&amp;id=' . $article['id'] . '">Delete</a></dt>';
                echo '<dt><a href = "news.php?action=edit&amp;id=' . $article['id'] . '">Edit</a></dt>';
                echo '</dl>';
            }
            stopBox(htmlify($article['title'], false));
        }
}
require_once 'includes/widgets/footer.php';
Example #6
0
$bankgold = $bankgold_original / 100;
$percent = $bankgold * 10;
$bankgold = $bankgold_original + $percent;
echo $bankgold;
echo "</strong> gold in the bank";
stopBox(BOX_YELLOW);
?>
<table class = "normal">
<tr>
	<th>deposit</th>
	<th>withdraw</th>
</tr>
<tr>
	<td>
	How much would you like to deposit?
	<form><input name = "amount">&nbsp;<input type = "submit" name = "submit" value = "deposit"></form>
	</td>

	<td>
	How much would you like to withdraw?
	<form><input name = "amount" />&nbsp;<input type = "submit" name = "submit" value = "withdraw"></form>
	</td>
</tr>
</table>
<?php 
if ($user->getData('gold') <= 0) {
    startBox('Uh oh...', BOX_RED);
    echo "You are a bankrupt tycoon.";
    stopBox(BOX_RED);
}
require_once "includes/widgets/footer.php";
<?php

use libAllure\Session;
if (Session::hasPriv('NEWS_ADD')) {
    startBox();
    echo '<dl><dt class = "create"><a href = "news.php?action=new">Add news</a></dt></dl>';
    stopBox('News admin');
}
box('You can get this news in <a href = "extern.php?source=news&amp;format=rss">RSS <img class = "icon" src = "resources/images/icons/rss.gif" alt = "RSS" title = "RSS" /></a> too.');
<?php

startBox();
echo '<a href = "listLogs.php?action=graph">Graph</a>';
stopBox('Other options');
Example #9
0
  You should have received a copy of the GNU General Public License
  along with pFrog; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*******************************************************************************/
require_once "includes/common.php";
$title = "slaves";
require_once "includes/widgets/header.php";
$sql = "SELECT * FROM slaves WHERE `user` = '" . \libAllure\Session::getUser()->getUsername() . "'";
$result = $db->query($sql);
$slaves = $result->numRows();
startBox("Slaves", BOX_GREEN);
echo "You currently have <strong>" . $slaves . "</strong> slaves.";
echo "<ul>";
while ($row = $result->fetchRow()) {
    popup("<li>" . $row['name'] . "</li>", "view_slave.php?slave=" . $row['name']);
}
echo "</ul>";
stopBox(BOX_GREEN);
$sql = 'SELECT * FROM slaves WHERE user = ""';
$result = $db->query($sql);
if ($result->numRows() == 0) {
    startBox("Slave Shop", BOX_RED);
    echo "There are are not any slaves for sale.";
} else {
    startBox("Slave Shop", BOX_GREEN);
    echo "There are <strong>" . count_rows($result) . "</strong> slaves for sale. <a href = shop.php?mode=slaves>buy some</a>.";
}
stopBox(BOX_NULL);
require_once "includes/widgets/footer.php";
Example #10
0
        break;
    case 'paypalFail':
        logAndRedirect('account.php', 'Paypal transaction failed.');
        break;
    case 'paypalComplete':
        logActivity('Started processing PayPal payment notification');
        foreach (Basket::getContents() as $ticket) {
            logActivity('PayPal transaction processing - setting status to PAID for event. Ticket owner _u_, event _e_', $ticket['userId'], array('event' => $ticket['eventId'], 'user' => Session::getUser()->getId()));
            Events::setSignupStatus($ticket['userId'], $ticket['eventId'], 'PAID');
        }
        logActivity('Finished processing PayPal payment notification.');
        Basket::clear();
        redirect('account.php', 'Thanks, payment complete!');
        break;
    default:
        require_once 'includes/widgets/header.php';
        require_once 'includes/widgets/sidebar.php';
        startBox();
        echo str_replace('%BASKETTOTAL%', doubleToGbp($cost), getContent('selectPaymentMethod'));
        $tpl->assign('cost', $cost);
        $tpl->assign('costPaypal', getPaypalCommission($cost));
        $tpl->assign('paypalEmail', getSiteSetting('paypalEmail'));
        $tpl->assign('listBasketContents', Basket::getContents());
        $tpl->assign('baseUrl', getSiteSetting('baseUrl'));
        $tpl->assign('currency', getSiteSetting('currency'));
        $tpl->display('checkout.tpl');
        echo getContent('commissionDisclaimer');
        stopBox('Checkout');
}
box('If you are not yet finished, pop back to your <a href = "basket.php">basket</a>.', 'Agh, no!');
require_once 'includes/widgets/footer.php';
Example #11
0
<?php

require_once 'includes/common.php';
$content = getContent($_REQUEST['title']);
require_once 'includes/widgets/header.php';
require_once 'includes/widgets/sidebar.php';
startBox();
echo $content;
stopBox($_REQUEST['title']);
require_once 'includes/widgets/footer.php';
Example #12
0
require_once "includes/widgets/header.php";
if (!\libAllure\Session::hasPriv('VIEW_ADMIN')) {
    redirect('index.php', 'You do not have the privileges to see this.');
}
if (isset($_GET['toggle'])) {
    if (inAdminMode()) {
        $_SESSION['admin_mode'] = false;
    } else {
        $_SESSION['admin_mode'] = true;
    }
}
startBox("Toggle admin mode", BOX_RED);
echo "If you are an admin, and want to play the game via this account, admin mode might get in the way. You can turn it off to make playing the game\neasier. <br /><br />";
echo "<form action = \"admin.php\">";
if (inAdminMode()) {
    echo "<input type = \"hidden\" name = \"toggle\" value = \"off\" />";
    echo "<input type = \"submit\" value = \"Turn admin mode off\" />";
} else {
    echo "<input type = \"hidden\" name = \"toggle\" value = \"on\" />";
    echo "<input type = \"submit\" value = \"Turn admin mode on\" />";
}
echo "</form>";
stopBox(BOX_GREEN);
if (inAdminMode()) {
    startBox("Shop Admin", BOX_BLUE);
    echo "<ul>";
    echo "<li><a href = \"adminShopAddItem.php\">Add item</a>";
    echo "</ul>";
    stopBox(BOX_BLUE);
}
require_once "includes/widgets/footer.php";