Example #1
0
function RenderPage_login()
{
    global $config, $html;
    $config['title'] = 'Login';
    $html->setPageFrame('basic');
    // load page html
    $html->LoadCss('login.css');
    $outputs = RenderHTML::LoadHTML('pages/login.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    // display error
    $messages = '';
    if (isset($_SESSION['error'])) {
        if (is_array($_SESSION['error'])) {
            foreach ($_SESSION['error'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['error']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        }
        unset($_SESSION['error']);
    }
    $tags = array('messages' => $messages, 'username' => $config['demo'] ? 'demo' : getVar(LOGIN_FORM_USERNAME), 'password' => $config['demo'] ? 'demo' : '');
    RenderHTML::RenderTags($outputs['body'], $tags);
    unset($tags, $messages);
    return $outputs['body'];
}
function RenderPage_changepass()
{
    global $config, $html;
    $config['title'] = 'Change Password';
    $html->setPageFrame('basic');
    // load page html
    $html->LoadCss('login.css');
    $outputs = RenderHTML::LoadHTML('pages/changepass.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    // display error
    $messages = '';
    if (isset($_SESSION['error'])) {
        if (is_array($_SESSION['error'])) {
            foreach ($_SESSION['error'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['error']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        }
        unset($_SESSION['error']);
    }
    $outputs['body'] = str_replace('{messages}', $messages, $outputs['body']);
    unset($messages);
    return $outputs['body'];
}
function RenderPage_myitems()
{
    global $config, $html;
    $UseAjaxSource = FALSE;
    $config['title'] = 'My Items';
    // load page html
    $outputs = RenderHTML::LoadHTML('pages/myitems.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    // load javascript
    $html->addToHeader($outputs['header']);
    // display error
    $messages = '';
    if (isset($_SESSION['error'])) {
        if (is_array($_SESSION['error'])) {
            foreach ($_SESSION['error'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['error']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        }
        unset($_SESSION['error']);
    }
    // display success
    if (isset($_SESSION['success'])) {
        if (is_array($_SESSION['success'])) {
            foreach ($_SESSION['success'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['success']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['success'], $outputs['success']);
        }
        unset($_SESSION['success']);
    }
    $outputs['body top'] = str_replace('{messages}', $messages, $outputs['body top']);
    unset($messages);
    // list items
    $Items = QueryItems::QueryInventory($config['user']->getId());
    if ($Items == FALSE) {
        echo 'Unable to query items!';
        exit;
    }
    $outputRows = '';
    while (TRUE) {
        $Item = $Items->getNext();
        if (!$Item) {
            break;
        }
        $tags = array('item display' => $Item->getDisplay(), 'item row id' => $Item->getTableRowId(), 'item qty' => $Item->getItemQty(), 'market price each' => $Item->getMarketPrice(), 'market price total' => $Item->getMarketPriceTotal(), 'rowclass' => 'gradeU');
        $htmlRow = $outputs['body row'];
        RenderHTML::RenderTags($htmlRow, $tags);
        unset($tags);
        $outputRows .= $htmlRow;
    }
    unset($Items, $Item);
    return $outputs['body top'] . "\n" . $outputRows . "\n" . $outputs['body bottom'];
}
Example #4
0
function RenderPage_admin()
{
    global $config;
    $config['title'] = 'Admin';
    $menu = (include 'admin_menu.php');
    $outputs = RenderHTML::LoadHTML('pages/admin.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    return $menu . $outputs['body top'] . $outputs['body'] . $outputs['body bottom'];
}
function RenderPage_admin_settings()
{
    global $config;
    $config['title'] = 'Settings';
    // load page html
    $outputs = RenderHTML::LoadHTML('pages/admin_settings.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    return 'Settings page not finished yet';
}
Example #6
0
function RenderPage_login()
{
    global $config, $html;
    $config['title'] = 'Login';
    $html->setPageFrame('basic');
    // load page html
    $html->LoadCss('login.css');
    $outputs = RenderHTML::LoadHTML('pages/login.php');
    $html->addTags(array('messages' => '', 'username' => $config['demo'] ? 'demo' : getVar(LOGIN_FORM_USERNAME), 'password' => $config['demo'] ? 'demo' : ''));
    // display error
    if (getVar('error') != '') {
        $html->addTags(array('messages' => str_replace('{message}', 'Login Failed', $outputs['error'])));
    }
    return $outputs['body'];
}
Example #7
0
function RenderPage_auctions()
{
    global $config, $html;
    $config['title'] = 'Current Auctions';
    // load page html
    $outputs = RenderHTML::LoadHTML('pages/auctions.php');
    $html->addTags(array('messages' => ''));
    // load javascript
    $html->addToHeader($outputs['header']);
    // display error
    if (isset($config['error'])) {
        $config['tags']['messages'] .= str_replace('{message}', $config['error'], $outputs['error']);
    }
    if (isset($_SESSION['error'])) {
        $config['tags']['messages'] .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        unset($_SESSION['error']);
    }
    // display success
    if (isset($_SESSION['success'])) {
        $config['tags']['messages'] .= str_replace('{message}', $_SESSION['success'], $outputs['success']);
        unset($_SESSION['success']);
    }
    // removed in-line listing - now handled by ajax
    //  // list auctions
    //  $auctions = QueryAuctions::QueryCurrent();
    //  $outputRows = '';
    //  while($auction = $auctions->getNext()){
    //  	$Item = $auction->getItem();
    //  	if(!$Item) continue;
    //    $tags = array(
    //      'auction id'  => (int)$auction->getTableRowId(),
    //      'seller name' => $auction->getSeller(),
    //      'item'        => $Item->getDisplay(),
    //      'qty'         => (int)$Item->getItemQty(),
    //      'price each'	=> FormatPrice($auction->getPrice()),
    //      'price total'	=> FormatPrice($auction->getPriceTotal()),
    //      'created'     => $auction->getCreated(),
    //      'expire'      => $auction->getExpire(),
    //      'market price percent' => '--',
    //      'rowclass'    => 'gradeU',
    //TODO:
    //allowBids
    //currentBid
    //currentWinner
    //    );
    //    $htmlRow = $outputs['body row'];
    //    RenderHTML::RenderTags($htmlRow, $tags);
    //    $outputRows .= $htmlRow;
    //  }
    //  unset($auctions, $Item);
    $outputRows = '';
    return $outputs['body top'] . "\n" . $outputRows . "\n" . $outputs['body bottom'];
}
Example #8
0
 public static function LoadCss($file)
 {
     global $config, $paths;
     //  $file=SanFilename($file);
     $output = '';
     if (substr($file, -4) != '.css') {
         $file .= '.css';
     }
     // current theme
     if (file_exists(RenderHTML::getLocalThemePath() . $file)) {
         $output = file_get_contents(RenderHTML::getLocalThemePath() . $file);
     } elseif (file_exists(RenderHTML::getLocalThemePath('default') . $file)) {
         $output = file_get_contents(RenderHTML::getLocalThemePath('default') . $file);
     } elseif (file_exists($file)) {
         $output = file_get_contents($file);
     }
     if (empty($output)) {
         echo '<p>Failed to load css file: ' . $file . "</p>\n";
         return;
     }
     // remove comments
     $output = preg_replace('/\\/\\*(.*?)\\*\\//s', '', $output);
     $config['html']->outputs['css'] .= "\n" . $output . "\n";
 }
Example #9
0
function RenderPage_sell()
{
    global $config, $html, $user;
    $config['title'] = 'Sell Items';
    $id = getVar('id', 'int');
    // load page html
    $outputs = RenderHTML::LoadHTML('pages/sell.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    // load javascript
    $html->addToHeader($outputs['header']);
    // query item
    $Item = QueryItems::QuerySingle($user->getId(), $id);
    if (!$Item) {
        return '<h2 style="text-align: center;">The item you\'re trying to sell couldn\'t be found!</h2>';
    }
    // check item blacklist
    ItemFuncs::checkItemBlacklist($Item);
    $qty = getVar('qty');
    $priceFixed = getVar('priceFixed', 'double');
    $priceStart = getVar('priceStart', 'double');
    $priceBuy = getVar('priceBuy', 'double');
    $priceSell = getVar('priceSell', 'double');
    if (empty($qty)) {
        $qty = $Item->getItemQty();
    }
    if ($priceFixed < 0.0) {
        $priceFixed = 0.0;
    }
    if ($priceStart < 0.0) {
        $priceStart = 0.0;
    }
    if ($priceBuy < 0.0) {
        $priceBuy = 0.0;
    }
    if ($priceSell < 0.0) {
        $priceSell = 0.0;
    }
    $messages = '';
    $tags = array('messages' => &$messages, 'item id' => (int) $id, 'item display' => $Item->getDisplay(), 'have qty' => (int) $Item->getItemQty(), 'qty' => (int) $qty, 'price fixed' => (double) $priceFixed, 'price start' => (double) $priceStart, 'price buy' => (double) $priceBuy, 'price sell' => (double) $priceSell, 'currency prefix' => SettingsClass::getString('Currency Prefix'), 'currency postfix' => SettingsClass::getString('Currency Postfix'));
    unset($Item);
    // input errors
    if (isset($_SESSION['error'])) {
        if (is_array($_SESSION['error'])) {
            foreach ($_SESSION['error'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['error']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        }
        unset($_SESSION['error']);
    }
    if (!$user->hasPerms('canSell')) {
        $messages .= str_replace('{message}', 'You don\'t have permission to sell.', $outputs['error']);
    }
    RenderHTML::RenderTags($outputs['body'], $tags);
    unset($tags);
    return $outputs['body'];
}
function RenderPage_servershops()
{
    global $config, $html;
    $config['title'] = 'Server Shops';
    // load page html
    $outputs = RenderHTML::LoadHTML('pages/servershops.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    // load javascript
    $html->addToHeader($outputs['header']);
    // display error
    $messages = '';
    if (isset($_SESSION['error'])) {
        if (is_array($_SESSION['error'])) {
            foreach ($_SESSION['error'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['error']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        }
        unset($_SESSION['error']);
    }
    // display success
    if (isset($_SESSION['success'])) {
        if (is_array($_SESSION['success'])) {
            foreach ($_SESSION['success'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['success']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['success'], $outputs['success']);
        }
        unset($_SESSION['success']);
    }
    $outputs['body top'] = str_replace('{messages}', $messages, $outputs['body top']);
    unset($messages);
    return $outputs['body top'] . "\n" . $outputs['body bottom'];
}
Example #11
0
function RenderPage_myauctions()
{
    global $config, $html;
    $output = '';
    $UseAjaxSource = FALSE;
    $config['title'] = 'My Auctions';
    // load page html
    $outputs = RenderHTML::LoadHTML('pages/myauctions.php');
    $html->addTags(array('messages' => ''));
    // load javascript
    $html->addToHeader($outputs['header']);
    // display error
    if (isset($config['error'])) {
        $config['tags']['messages'] .= str_replace('{message}', $config['error'], $outputs['error']);
    }
    if (isset($_SESSION['error'])) {
        $config['tags']['messages'] .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        unset($_SESSION['error']);
    }
    // display success
    if (isset($_SESSION['success'])) {
        $config['tags']['messages'] .= str_replace('{message}', $_SESSION['success'], $outputs['success']);
        unset($_SESSION['success']);
    }
    // list auctions
    $auctions = QueryAuctions::QueryMy();
    $outputRows = '';
    while (TRUE) {
        $auction = $auctions->getNext();
        if (!$auction) {
            break;
        }
        $Item = $auction->getItem();
        if (!$Item) {
            continue;
        }
        $tags = array('auction id' => (int) $auction->getTableRowId(), 'seller name' => $auction->getSeller(), 'item' => $Item->getDisplay(), 'qty' => (int) $Item->getItemQty(), 'price each' => FormatPrice($auction->getPrice()), 'price total' => FormatPrice($auction->getPriceTotal()), 'created' => $auction->getCreated(), 'expire' => $auction->getExpire(), 'market price percent' => '--', 'rowclass' => 'gradeU');
        //  if($Item->itemType=='tool'){
        //    $output.='<br />'.$Item->getDamagedChargedStr();
        //    foreach($Item->getEnchantmentsArray() as $ench){
        //      $output.='<br /><span style="font-size: smaller;"><i>'.$ench['enchName'].' '.numberToRoman($ench['level']).'</i></span>';
        //    }
        //  }
        //$marketPrice=getMarketPrice($id, 1);
        //if($marketPrice>0){
        //  $marketPercent=round((($price/$marketPrice)*100), 1);
        //}else{
        //  $marketPercent='N/A';
        //}if($marketPercent=='N/A'){
        //  $grade='gradeU';
        //}elseif($marketPercent<=50){
        //  $grade='gradeA';
        //}elseif($marketPercent<=150){
        //  $grade='gradeC';
        //}else{
        //  $grade='gradeX';
        //}
        $htmlRow = $outputs['body row'];
        RenderHTML::RenderTags($htmlRow, $tags);
        $outputRows .= $htmlRow;
    }
    unset($auctions, $Item);
    return $outputs['body top'] . "\n" . $outputRows . "\n" . $outputs['body bottom'];
}
<?php

if (!defined('DEFINE_INDEX_FILE')) {
    if (headers_sent()) {
        echo '<header><meta http-equiv="refresh" content="0;url=../"></header>';
    } else {
        header('HTTP/1.0 301 Moved Permanently');
        header('Location: ../');
    }
    die("<font size=+2>Access Denied!!</font>");
}
// admin menu
// check admin permission
global $user;
if (!$user->hasPerms('isAdmin')) {
    ForwardTo('./', 0);
    exit;
}
$outputs = RenderHTML::LoadHTML('pages/admin_menu.php');
return $outputs['menu'];
Example #13
0
<?php

session_start();
require_once "inc/class.php/koll.conf.class.php";
require_once "inc/class.php/koll.class.php";
require_once "inc/class.php/koll.DB.class.php";
require_once "inc/class.php/koll.renderHTML.class.php";
$CFG = new Config();
$Ko = new Koll($CFG);
$db = new KollDB($CFG);
$render = new RenderHTML($CFG);
$Ko->checkHost();
// -- Zugriff auf diese Seite nur von registrierten Refferer
$Ko->decodeAuthData($db);
// -- Nutzerdaten ermitteln (übergebene oder SESSION)
$Ko->actionHandler($db);
if ($_SESSION['DA']['state'] != 11) {
    echo $render->getBlockHTMLHeader();
}
if ($_SESSION['DA']['state'] == 1) {
    echo $render->renderButtonOutput();
} else {
    if ($_SESSION['DA']['state'] == 2) {
        echo $render->renderForm();
    } else {
        if ($_SESSION['DA']['state'] == 3) {
            echo $render->renderUserLRList($db);
        } else {
            if ($_SESSION['DA']['state'] == 5) {
                echo $render->rendererMailForm($db);
            } else {
 public static function getDisplay($tableRowId, $itemId, $itemDamage, $qty, $enchantments)
 {
     // load html
     $outputs = RenderHTML::LoadHTML('display.php');
     if (!is_array($outputs)) {
         echo 'Failed to load html!';
         exit;
     }
     // render enchantments
     $enchOutput = '';
     $nameOutput = '';
     $loreOutput = '';
     foreach ($enchantments as $key => $value) {
         if (!(isset($key) || isset($value))) {
             continue;
         }
         // custom name
         if (strcasecmp("<NAME>", $key) == 0) {
             $nameOutput = $outputs['custom name'];
             $tags = array('name' => $value);
             RenderHTML::RenderTags($nameOutput, $tags);
             unset($tags);
             continue;
         }
         // lore
         if (strcasecmp("<LORE>", $key) == 0) {
             $loreOutput = '';
             foreach (explode("\\\\n", trim($value)) as $line) {
                 if (!empty($loreOutput)) {
                     $loreOutput .= $outputs['lore split'];
                 }
                 $tags = array('line' => $line);
                 $tmp = $outputs['lore line'];
                 RenderHTML::RenderTags($tmp, $tags);
                 $loreOutput .= $tmp;
                 unset($tmp, $tags);
             }
             continue;
         }
         // enchantment
         $tmp = $outputs['enchantment'];
         $enchId = (int) $key;
         $level = (int) $value;
         $tags = array('ench id' => $enchId, 'ench name' => self::getEnchantmentTitle($enchId), 'ench title' => self::getEnchantmentTitle($enchId), 'ench level' => numberToRoman($level));
         RenderHTML::RenderTags($tmp, $tags);
         if (!empty($enchOutput)) {
             $enchOutput .= $outputs['enchantment split'];
         }
         $enchOutput .= $tmp;
         unset($tmp, $tags);
     }
     // render item block
     $output = $outputs['item'];
     $tags = array('table row id' => $tableRowId, 'item id' => $itemId, 'item damage' => self::getDamagedChargedStr($itemId, $itemDamage), 'item qty' => $qty, 'custom name' => $nameOutput, 'lore' => $loreOutput, 'enchantments' => $enchOutput, 'item name' => self::getItemName($itemId, $itemDamage), 'item title' => self::getItemTitle($itemId, $itemDamage), 'item image url' => self::getItemImageUrl($itemId, $itemDamage), 'market price each' => "--", 'market price total' => "--");
     $itemType = self::getItemType($itemId);
     if ($itemType != 'tool') {
         $tags['enchantments'] = '';
     }
     RenderHTML::RenderTags($output, $tags);
     RenderHTML::Block($output, 'has damage', !empty($tags['item damage']));
     RenderHTML::Block($output, 'has custom name', !empty($tags['custom name']));
     RenderHTML::Block($output, 'has lore', !empty($tags['lore']));
     RenderHTML::Block($output, 'has enchantments', !empty($tags['enchantments']));
     return $output;
 }