Example #1
0
 function render($template, $vars = array(), $debug = FALSE)
 {
     if ($debug) {
         echo '<pre>';
         var_dump($vars);
         echo '</pre>';
     }
     if (is_array($vars) && count($vars) > 0) {
         $this->setVars($vars);
     }
     $viewPath = $this->getViewPath($template);
     if (!file_exists($viewPath)) {
         cpg_die(ERROR, sprintf(Lang::item('error.missing_vw_file'), $viewPath), __FILE__, __LINE__);
     }
     extract($this->vars);
     // checking model
     $authorizer = check_model::getInstance();
     ob_start();
     include_once $viewPath;
     $fr_contents = ob_get_contents();
     ob_end_clean();
     if (empty($fr_title) || !$fr_title) {
         $fr_title = $vars[nagavitor][0][1] . " - " . Config::item('fr_title');
     }
     include_once $this->getMainPath();
 }
Example #2
0
 public function renderTooltip()
 {
     if (!$this->curTpl) {
         return array();
     }
     $x = '<table><tr><td>';
     $x .= '<span class="q' . $this->getField('quality') . '">' . Util::jsEscape($this->getField('name', true)) . '</span><br />';
     $nClasses = 0;
     if ($_ = $this->getField('classMask')) {
         $cl = Lang::getClassString($_, $__, $nClasses);
         $x .= Util::ucFirst($nClasses > 1 ? Lang::game('classes') : Lang::game('class')) . Lang::main('colon') . $cl . '<br />';
     }
     if ($_ = $this->getField('contentGroup')) {
         $x .= Util::jsEscape(Lang::itemset('notes', $_)) . ($this->getField('heroic') ? ' <i class="q2">(' . Lang::item('heroic') . ')</i>' : '') . '<br />';
     }
     if (!$nClasses || !$this->getField('contentGroup')) {
         $x .= Lang::itemset('types', $this->getField('type')) . '<br />';
     }
     if ($bonuses = $this->getBonuses()) {
         $x .= '<span>';
         foreach ($bonuses as $b) {
             $x .= '<br /><span class=\\"q13\\">' . $b['bonus'] . ' ' . Lang::itemset('_pieces') . Lang::main('colon') . '</span>' . Util::jsEscape($b['desc']);
         }
         $x .= '</span>';
     }
     $x .= '</td></tr></table>';
     return $x;
 }
Example #3
0
 function yesno($name, $value = '')
 {
     // 1||0//Y||N//y||n//YES||NO - autodetect
     $html = "";
     switch ($value) {
         case '0':
         case '1':
             $values = array(1, 0);
             break;
         case 'Y':
         case 'N':
             $values = array('Y', 'N');
         case 'y':
         case 'n':
             $values = array('y', 'n');
         case 'YES':
         case 'NO':
             $values = array('YES', 'NO');
         default:
             $values = array('YES', 'NO');
     }
     $html .= form::radio($name, $values[0], Lang::item('common.yes'), $value);
     $html .= form::radio($name, $values[1], Lang::item('common.no'), $value);
     return $html;
 }
Example #4
0
 function message($title, $message, $link, $time = 2)
 {
     global $CONFIG;
     if ($CONFIG['display_redirection_page'] == 0) {
         header("Location: {$link}&message_id=" . cpgStoreTempMessage($message));
     } else {
         pageheader($title, "<META http-equiv=\"refresh\" content=\"{$time};url={$link}\">");
         msg_box($title, $message, Lang::item('common.continue'), $link);
         pagefooter();
     }
     exit;
 }
Example #5
0
 function index()
 {
     $vars = array();
     $authorizer = check_model::getInstance();
     $vars['nagavitor'] = $this->forum->get_nagavitor();
     $vars['cat_id'] = $this->validate->get->getInt('id');
     if ($vars['cat_id']) {
         if (!$authorizer->is_cat_id($vars['cat_id'])) {
             cpg_die(ERROR, Lang::item('error.wrong_cat_id'), __FILE__, __LINE__);
         }
     }
     $vars['user_posts'] = $this->forum->get_user_post_count();
     $vars['last_visit'] = $this->forum->get_last_visit_time();
     $cats = $this->forum->get_category($vars['cat_id'], 'cat_id, name');
     $vars['categories'] = array();
     foreach ($cats as $cat) {
         $newcat = array();
         $newcat['name'] = $cat['name'];
         $newcat['id'] = $cat['cat_id'];
         $boards = $this->forum->get_first_level_board($cat['cat_id'], 'board_id,name,description,last_msg_id,topics,posts,child_level');
         $newcat['boards'] = array();
         foreach ($boards as $board) {
             $last_message = $this->forum->get_message_data($board['last_msg_id'], 'subject, poster_id, poster_time');
             $newboard = array();
             $newboard['icon'] = 'plugins/forum/forum/html/images/icon_board_new.gif';
             $newboard['id'] = $board['board_id'];
             $newboard['name'] = $board['name'];
             $newboard['description'] = $board['description'];
             $newboard['last_post_id'] = $board['last_msg_id'];
             $newboard['last_post_title'] = $last_message['subject'];
             $newboard['last_post_time'] = $last_message['poster_time'];
             $newboard['last_post_author_id'] = $last_message['poster_id'];
             $newboard['last_post_author_name'] = get_username($last_message['poster_id']);
             $newboard['topics'] = $board['topics'];
             $newboard['replies'] = $board['posts'];
             $newboard['childs'] = $this->forum->get_child_board($board['board_id'], $board['child_level'], 'board_id, name');
             $newcat['boards'][] = $newboard;
             unset($newboard);
         }
         $vars['categories'][] = $newcat;
         unset($newcat);
     }
     $recents = $this->forum->get_latest_message();
     $vars['recents'] = $recents;
     $vars['stats'] = $this->forum->get_statistics();
     $vars['newest_members'] = $this->forum->get_latest_user();
     $vars['active_members'] = $this->forum->get_active_user();
     $this->view->render('home/index', $vars);
 }
Example #6
0
function load_library($library, $return = FALSE)
{
    global $libraries;
    $library = ucfirst(strtolower($library));
    $library_file = BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'libraries' . DS . $library . '.php';
    if (file_exists($library_file)) {
        if (!$libraries[$library]) {
            include $library_file;
            $libaries[$library] = TRUE;
        }
        $class_name = ucfirst(strtolower($library));
        if ($return === TRUE) {
            return new $class_name();
        }
    } else {
        cpg_die(ERROR, sprintf(Lang::item('error.missing_li_file'), $library_file), __FILE__, __LINE__);
    }
}
Example #7
0
 function locked()
 {
     $authorizer = check_model::getInstance();
     $topic_id = $this->validate->get->getInt('id');
     if (!$authorizer->is_topic_id($topic_id)) {
         cpg_die(ERROR, Lang::item('error.wrong_topic_id'), __FILE__, __LINE__);
     }
     if (!$authorizer->can_moderator_topic($topic_id)) {
         cpg_die(ERROR, Lang::item('error.perm_denied'), __FILE__, __LINE__);
     }
     $this->forum->lock_topic($topic_id);
     forum::redirect('forum.php?c=topic&id=' . $topic_id);
 }
Example #8
0
 private function createExtraMenus()
 {
     $menu = array('type' => [[], null], 'slot' => [[], null]);
     if (!$this->category) {
         $menu['slot'] = [Lang::item('inventoryType'), null];
         asort($menu['slot'][0]);
     } else {
         if (isset($this->category[2]) && is_array(Lang::item('cat', $this->category[0], 1, $this->category[1]))) {
             $catList = Lang::item('cat', $this->category[0], 1, $this->category[1], 1, $this->category[2]);
         } else {
             if (isset($this->category[1]) && is_array(Lang::item('cat', $this->category[0]))) {
                 $catList = Lang::item('cat', $this->category[0], 1, $this->category[1]);
             } else {
                 $catList = Lang::item('cat', $this->category[0]);
             }
         }
         switch ($this->category[0]) {
             case 0:
                 if (!isset($this->category[1])) {
                     $menu['type'] = [Lang::item('cat', 0, 1), null];
                 }
                 if (!isset($this->category[1]) || in_array($this->category[1], [6, -3])) {
                     $menu['slot'] = [Lang::item('inventoryType'), 0x63efea];
                     asort($menu['slot'][0]);
                 }
                 break;
             case 2:
                 if (!isset($this->category[1])) {
                     $menu['type'] = [Lang::spell('weaponSubClass'), null];
                 }
                 $menu['slot'] = [Lang::item('inventoryType'), 0x262a000];
                 asort($menu['slot'][0]);
                 break;
             case 4:
                 if (!isset($this->category[1])) {
                     $menu['slot'] = [Lang::item('inventoryType'), 0x10895ffe];
                     $menu['type'] = [Lang::item('cat', 4, 1), null];
                 } else {
                     if (in_array($this->category[1], [1, 2, 3, 4])) {
                         $menu['slot'] = [Lang::item('inventoryType'), 0x7ea];
                     }
                 }
                 asort($menu['slot'][0]);
                 break;
             case 16:
                 if (!isset($this->category[2])) {
                     $this->sharedLV['visibleCols'][] = 'glyph';
                 }
             case 1:
                 if ($this->category[0] == 1) {
                     $this->sharedLV['visibleCols'][] = 'slots';
                 }
             case 3:
                 if (!isset($this->category[1])) {
                     asort($catList[1]);
                 }
             case 7:
             case 9:
                 $this->sharedLV['hiddenCols'][] = 'slot';
             case 15:
                 if (!isset($this->category[1])) {
                     $menu['type'] = [$catList[1], null];
                 }
                 break;
         }
     }
     return $menu;
 }
Example #9
0
                                <td class="padded">
                                    <select name="gm">
                                        <option<?php 
echo !isset($f['gm']) ? ' selected' : null;
?>
></option>
                                        <option value="2"<?php 
echo (isset($f['gm']) && $f['gm'] == 2 ? ' selected' : null) . '>' . Lang::item('quality', 2);
?>
</option>
                                        <option value="3"<?php 
echo (isset($f['gm']) && $f['gm'] == 3 ? ' selected' : null) . '>' . Lang::item('quality', 3);
?>
</option>
                                        <option value="4"<?php 
echo (isset($f['gm']) && $f['gm'] == 4 ? ' selected' : null) . '>' . Lang::item('quality', 4);
?>
</option>
                                    </select>
                                    &nbsp; <input type="checkbox" name="jc" value="1" id="jc" <?php 
echo isset($f['jc']) && $f['jc'] == 1 ? 'checked="checked" ' : null;
?>
/><label for="jc"><?php 
echo sprintf(Lang::main('jcGemsOnly'), ' class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_jconlygems, 0, 0, \'q\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"');
?>
</label>
                                </td>
                            </tr>
                        </table>

                        <div id="fi_weight" class="criteria" style="display: none"><div></div></div>
Example #10
0
<?php

/**************************************************
  Coppermine 1.5.x Plugin - forum
  *************************************************
  Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/
echo table::open();
echo table::title(Lang::item('board.topic_preview'), 1);
echo table::tds(array('class' => 'tableh2', 'text' => $subject));
echo table::tds(array('class' => 'tableb', 'text' => $message));
echo table::close();
Example #11
0
<?php

if (!empty($this->pageText)) {
    ?>
                <div class="clear"></div>
                <h3><?php 
    echo Lang::item('content');
    ?>
</h3>

                <div id="book-generic"></div>
                <script>//<![CDATA[
                    new Book({ parent: 'book-generic', pages: <?php 
    echo Util::toJSON($this->pageText);
    ?>
})
                //]]></script>
<?php 
}
Example #12
0
 private function createRequiredItems()
 {
     // parse itemClass & itemSubClassMask
     $class = $this->subject->getField('equippedItemClass');
     $subClass = $this->subject->getField('equippedItemSubClassMask');
     $invType = $this->subject->getField('equippedItemInventoryTypeMask');
     if ($class <= 0 || $subClass <= 0) {
         return;
     }
     $title = ['Class: ' . $class, 'SubClass: ' . Util::asHex($subClass)];
     $text = Lang::getRequiredItems($class, $subClass, false);
     if ($invType) {
         // remap some duplicated strings            'Off Hand' and 'Shield' are never used simultaneously
         if ($invType & 1 << INVTYPE_ROBE) {
             $invType &= ~(1 << INVTYPE_ROBE);
             $invType &= 1 << INVTYPE_CHEST;
         }
         if ($invType & 1 << INVTYPE_RANGEDRIGHT) {
             $invType &= ~(1 << INVTYPE_RANGEDRIGHT);
             $invType &= 1 << INVTYPE_RANGED;
         }
         $_ = [];
         $strs = Lang::item('inventoryType');
         foreach ($strs as $k => $str) {
             if ($invType & 1 << $k && $str) {
                 $_[] = $str;
             }
         }
         $title[] = Lang::item('slot') . Lang::main('colon') . Util::asHex($invType);
         $text .= ' ' . Lang::spell('_inSlot') . Lang::main('colon') . implode(', ', $_);
     }
     return [$title, $text];
 }
Example #13
0
 protected function generateContent()
 {
     $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     /***********/
     /* Infobox */
     /***********/
     $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     // Event (ignore events, where the object only gets removed)
     if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId)) {
         $this->extendGlobalIds(TYPE_WORLDEVENT, $_);
         $ev = [];
         foreach ($_ as $i => $e) {
             $ev[] = ($i % 2 ? '[br]' : ' ') . '[event=' . $e . ']';
         }
         $infobox[] = Util::ucFirst(Lang::game('eventShort')) . Lang::main('colon') . implode(',', $ev);
     }
     // Reaction
     $_ = function ($r) {
         if ($r == 1) {
             return 2;
         }
         if ($r == -1) {
             return 10;
         }
         return;
     };
     $infobox[] = Lang::npc('react') . Lang::main('colon') . '[color=q' . $_($this->subject->getField('A')) . ']A[/color] [color=q' . $_($this->subject->getField('H')) . ']H[/color]';
     // reqSkill
     switch ($this->subject->getField('typeCat')) {
         case -3:
             // Herbalism
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 2) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         case -4:
             // Mining
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 3) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         case -5:
             // Lockpicking
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 1) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         default:
             $locks = Lang::getLocks($this->subject->getField('lockId'));
             $l = '';
             foreach ($locks as $idx => $_) {
                 if ($idx < 0) {
                     continue;
                 }
                 $this->extendGlobalIds(TYPE_ITEM, $idx);
                 $l = Lang::gameObject('key') . Lang::main('colon') . '[item=' . $idx . ']';
             }
             // if no propper item is found use a skill
             if ($locks) {
                 $infobox[] = $l ? $l : array_pop($locks);
             }
     }
     // linked trap
     if ($_ = $this->subject->getField('linkedTrap')) {
         $this->extendGlobalIds(TYPE_OBJECT, $_);
         $infobox[] = Lang::gameObject('trap') . Lang::main('colon') . '[object=' . $_ . ']';
     }
     // trap for
     $trigger = new GameObjectList(array(['linkedTrap', $this->typeId]));
     if (!$trigger->error) {
         $this->extendGlobalData($trigger->getJSGlobals());
         $infobox[] = Lang::gameObject('triggeredBy') . Lang::main('colon') . '[object=' . $trigger->id . ']';
     }
     // SpellFocus
     if ($_ = $this->subject->getField('spellFocusId')) {
         if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE id = ?d', $_)) {
             $infobox[] = '[tooltip name=focus]' . Lang::gameObject('focusDesc') . '[/tooltip][span class=tip tooltip=focus]' . Lang::gameObject('focus') . Lang::main('colon') . Util::localizedString($sfo, 'name') . '[/span]';
         }
     }
     // lootinfo: [min, max, restock]
     if (($_ = $this->subject->getField('lootStack')) && $_[0]) {
         $buff = Lang::item('charges') . Lang::main('colon') . $_[0];
         if ($_[0] < $_[1]) {
             $buff .= Lang::game('valueDelim') . $_[1];
         }
         // since Veins don't have charges anymore, the timer is questionable
         $infobox[] = $_[2] > 1 ? '[tooltip name=restock]' . sprintf(Lang::gameObject('restock'), Util::formatTime($_[2] * 1000)) . '[/tooltip][span class=tip tooltip=restock]' . $buff . '[/span]' : $buff;
     }
     // meeting stone [minLevel, maxLevel, zone]
     if ($this->subject->getField('type') == OBJECT_MEETINGSTONE) {
         if ($_ = $this->subject->getField('mStone')) {
             $this->extendGlobalIds(TYPE_ZONE, $_[2]);
             $m = Lang::game('meetingStone') . Lang::main('colon') . '[zone=' . $_[2] . ']';
             $l = $_[0];
             if ($_[0] > 1 && $_[1] > $_[0]) {
                 $l .= Lang::game('valueDelim') . min($_[1], MAX_LEVEL);
             }
             $infobox[] = $l ? '[tooltip name=meetingstone]' . sprintf(Lang::game('reqLevel'), $l) . '[/tooltip][span class=tip tooltip=meetingstone]' . $m . '[/span]' : $m;
         }
     }
     // capture area [minPlayer, maxPlayer, minTime, maxTime, radius]
     if ($this->subject->getField('type') == OBJECT_CAPTURE_POINT) {
         if ($_ = $this->subject->getField('capture')) {
             $buff = Lang::gameObject('capturePoint');
             if ($_[2] > 1 || $_[0]) {
                 $buff .= Lang::main('colon') . '[ul]';
             }
             if ($_[2] > 1) {
                 $buff .= '[li]' . Lang::game('duration') . Lang::main('colon') . ($_[3] > $_[2] ? Util::FormatTime($_[3] * 1000, true) . ' - ' : null) . Util::FormatTime($_[2] * 1000, true) . '[/li]';
             }
             if ($_[1]) {
                 $buff .= '[li]' . Lang::main('players') . Lang::main('colon') . $_[0] . ($_[1] > $_[0] ? ' - ' . $_[1] : null) . '[/li]';
             }
             if ($_[4]) {
                 $buff .= '[li]' . sprintf(Lang::spell('range'), $_[4]) . '[/li]';
             }
             if ($_[2] > 1 || $_[0]) {
                 $buff .= '[/ul]';
             }
         }
         $infobox[] = $buff;
     }
     // AI
     if (User::isInGroup(U_GROUP_EMPLOYEE)) {
         if ($_ = $this->subject->getField('ScriptName')) {
             $infobox[] = 'Script' . Lang::main('colon') . $_;
         } else {
             if ($_ = $this->subject->getField('AIName')) {
                 $infobox[] = 'AI' . Lang::main('colon') . $_;
             }
         }
     }
     /****************/
     /* Main Content */
     /****************/
     // pageText
     $pageText = [];
     if ($next = $this->subject->getField('pageTextId')) {
         while ($next) {
             $row = DB::World()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next);
             $next = $row['next_page'];
             $pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
         }
     }
     // add conditional js & css
     if ($pageText) {
         $this->addCSS(['path' => 'Book.css']);
         $this->addJS('Book.js');
     }
     // get spawns and path
     $map = null;
     if ($spawns = $this->subject->getSpawns(SPAWNINFO_FULL)) {
         $map = ['data' => ['parent' => 'mapper-generic'], 'mapperData' => &$spawns];
         foreach ($spawns as $areaId => &$areaData) {
             $map['extra'][$areaId] = ZoneList::getName($areaId);
         }
     }
     // consider pooled spawns
     $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
     $this->pageText = $pageText;
     $this->map = $map;
     $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true, BUTTON_VIEW3D => ['displayId' => $this->subject->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $this->typeId]);
     /**************/
     /* Extra Tabs */
     /**************/
     // tab: summoned by
     $conditions = array('OR', ['AND', ['effect1Id', [50, 76, 104, 105, 106, 107]], ['effect1MiscValue', $this->typeId]], ['AND', ['effect2Id', [50, 76, 104, 105, 106, 107]], ['effect2MiscValue', $this->typeId]], ['AND', ['effect3Id', [50, 76, 104, 105, 106, 107]], ['effect3MiscValue', $this->typeId]]);
     $summons = new SpellList($conditions);
     if (!$summons->error) {
         $this->extendGlobalData($summons->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
         $this->lvTabs[] = array('file' => 'spell', 'data' => $summons->getListviewData(), 'params' => array('id' => 'summoned-by', 'name' => '$LANG.tab_summonedby'));
     }
     // tab: related spells
     if ($_ = $this->subject->getField('spells')) {
         $relSpells = new SpellList(array(['id', $_]));
         if (!$relSpells->error) {
             $this->extendGlobalData($relSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
             $data = $relSpells->getListviewData();
             foreach ($data as $relId => $d) {
                 $data[$relId]['trigger'] = array_search($relId, $_);
             }
             $this->lvTabs[] = array('file' => 'spell', 'data' => $data, 'params' => array('id' => 'spells', 'name' => '$LANG.tab_spells', 'hiddenCols' => "\$['skill']", 'extraCols' => "\$[Listview.funcBox.createSimpleCol('trigger', 'Condition', '10%', 'trigger')]"));
         }
     }
     // tab: criteria of
     $acvs = new AchievementList(array(['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT]], ['ac.value1', $this->typeId]));
     if (!$acvs->error) {
         $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
         $this->lvTabs[] = array('file' => 'achievement', 'data' => $acvs->getListviewData(), 'params' => array('id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof'));
     }
     // tab: starts quest
     // tab: ends quest
     $startEnd = new QuestList(array(['qse.type', TYPE_OBJECT], ['qse.typeId', $this->typeId]));
     if (!$startEnd->error) {
         $this->extendGlobalData($startEnd->getJSGlobals());
         $lvData = $startEnd->getListviewData();
         $_ = [[], []];
         foreach ($startEnd->iterate() as $id => $__) {
             $m = $startEnd->getField('method');
             if ($m & 0x1) {
                 $_[0][] = $lvData[$id];
             }
             if ($m & 0x2) {
                 $_[1][] = $lvData[$id];
             }
         }
         if ($_[0]) {
             $this->lvTabs[] = array('file' => 'quest', 'data' => $_[0], 'params' => array('name' => '$LANG.tab_starts', 'id' => 'starts'));
         }
         if ($_[1]) {
             $this->lvTabs[] = array('file' => 'quest', 'data' => $_[1], 'params' => array('name' => '$LANG.tab_ends', 'id' => 'ends'));
         }
     }
     // tab: related quests
     if ($_ = $this->subject->getField('reqQuest')) {
         $relQuest = new QuestList(array(['id', $_]));
         if (!$relQuest->error) {
             $this->extendGlobalData($relQuest->getJSGlobals());
             $this->lvTabs[] = array('file' => 'quest', 'data' => $relQuest->getListviewData(), 'params' => array('name' => '$LANG.tab_quests', 'id' => 'quests'));
         }
     }
     // tab: contains
     $reqQuest = [];
     if ($_ = $this->subject->getField('lootId')) {
         $goLoot = new Loot();
         if ($goLoot->getByContainer(LOOT_GAMEOBJECT, $_)) {
             $extraCols = $goLoot->extraCols;
             $hiddenCols = ['source', 'side', 'slot', 'reqlevel'];
             $this->extendGlobalData($goLoot->jsGlobals);
             foreach ($goLoot->iterate() as &$lv) {
                 if (!empty($hiddenCols)) {
                     foreach ($hiddenCols as $k => $str) {
                         if (!empty($lv[$str])) {
                             unset($hiddenCols[$k]);
                         }
                     }
                 }
                 if (!$lv['quest']) {
                     continue;
                 }
                 $extraCols[] = 'Listview.extraCols.condition';
                 $reqQuest[$lv['id']] = 0;
                 $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]];
             }
             $extraCols[] = 'Listview.extraCols.percent';
             $this->lvTabs[] = array('file' => 'item', 'data' => $goLoot->getResult(), 'params' => array('name' => '$LANG.tab_contains', 'id' => 'contains', 'extraCols' => "\$[" . implode(', ', array_unique($extraCols)) . "]", 'hiddenCols' => $hiddenCols ? '$' . Util::toJSON(array_values($hiddenCols)) : null));
         }
     }
     if ($reqIds = array_keys($reqQuest)) {
         $conditions = array('OR', ['reqSourceItemId1', $reqIds], ['reqSourceItemId2', $reqIds], ['reqSourceItemId3', $reqIds], ['reqSourceItemId4', $reqIds], ['reqItemId1', $reqIds], ['reqItemId2', $reqIds], ['reqItemId3', $reqIds], ['reqItemId4', $reqIds], ['reqItemId5', $reqIds], ['reqItemId6', $reqIds]);
         $reqQuests = new QuestList($conditions);
         $this->extendGlobalData($reqQuests->getJSGlobals());
         foreach ($reqQuests->iterate() as $qId => $__) {
             if (empty($reqQuests->requires[$qId][TYPE_ITEM])) {
                 continue;
             }
             foreach ($reqIds as $rId) {
                 if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM])) {
                     $reqQuest[$rId] = $reqQuests->id;
                 }
             }
         }
     }
     // tab: Same model as .. whats the f*****g point..?
     $sameModel = new GameObjectList(array(['displayId', $this->subject->getField('displayId')], ['id', $this->typeId, '!']));
     if (!$sameModel->error) {
         $this->extendGlobalData($sameModel->getJSGlobals());
         $this->lvTabs[] = array('file' => 'object', 'data' => $sameModel->getListviewData(), 'params' => array('name' => '$LANG.tab_samemodelas', 'id' => 'same-model-as'));
     }
 }
Example #14
0
 public function notFound()
 {
     if ($this->mode == CACHE_TYPE_TOOLTIP) {
         header('Content-type: application/x-javascript; charset=utf-8');
         echo $this->generateTooltip(true);
         exit;
     } else {
         if ($this->mode == CACHE_TYPE_XML) {
             header('Content-type: text/xml; charset=utf-8');
             echo $this->generateXML(true);
             exit;
         } else {
             return parent::notFound(Lang::game('item'), Lang::item('notFound'));
         }
     }
 }
Example #15
0
echo table::td(Lang::item('home.latest_posts'), 2);
foreach ($recents as $recent) {
    echo table::tds(array(array('class' => 'tableb', 'text' => table::open(2) . table::tds(array(array('text' => sprintf(Lang::item('home.latest_post'), html::message_anchor($recent['msg_id'], $recent['subject']), html::profile_anchor($recent['poster_id'], $recent['poster_name']))), array('align' => 'right', 'text' => time::decode($recent['poster_time'])))) . table::close())));
}
echo table::close();
// left
$left_table = '';
$left_table .= table::open(3);
$left_table .= table::td(Lang::item('home.visitor_stats'), 4);
$left_table .= table::tds(array(array('class' => 'tableb', 'text' => Lang::item('home.t_r_m')), array('class' => 'tableb', 'text' => $stats['t_r_m']), array('class' => 'tableb', 'text' => Lang::item('home.t_li_u')), array('class' => 'tableb', 'text' => $stats['t_li_u'])));
$left_table .= table::tds(array(array('class' => 'tableb', 'text' => Lang::item('home.t_t')), array('class' => 'tableb', 'text' => $stats['t_t']), array('class' => 'tableb', 'text' => Lang::item('home.t_a_u')), array('class' => 'tableb', 'text' => $stats['t_a_u'])));
$left_table .= table::tds(array(array('class' => 'tableb', 'text' => Lang::item('home.t_r')), array('class' => 'tableb', 'text' => $stats['t_r']), array('class' => 'tableb', 'text' => '&nbsp;'), array('class' => 'tableb', 'text' => '&nbsp;')));
$left_table .= table::close();
// right
foreach ($newest_members as $k => $v) {
    $newest_members[$k] = html::profile_anchor($v['user_id'], $v['user_name']);
}
$newest_members = implode(', ', $newest_members);
foreach ($active_members as $k => $v) {
    $active_members[$k] = html::profile_anchor($v['user_id'], $v['user_name']);
}
$active_members = implode(', ', $active_members);
$right_table = '';
$right_table .= table::open(3);
$right_table .= table::td(Lang::item('home.members'));
$right_table .= table::tds(array('class' => 'tableb', 'text' => Lang::item('home.newest_members') . $newest_members));
$right_table .= table::tds(array('class' => 'tableb', 'text' => Lang::item('home.active_members') . $active_members));
$right_table .= table::close();
echo table::open(array('align' => 'center', 'width' => -1, 'border' => 0, 'cellspacing' => 1, 'cellpadding' => 0));
echo table::tds(array(array('width' => '50%', 'valign' => 'top', 'text' => $left_table), array('width' => '50%', 'valign' => 'top', 'text' => $right_table)));
echo table::close();
Example #16
0
  Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/
// start
pageheader($fr_title);
// forum header
echo html::spacer();
echo table::open(0);
echo table::tds(array(array('text' => Config::item('fr_title')), array('align' => 'right', 'text' => ($authorizer->is_user() ? html::button('forum.php?c=profile', Lang::item('home.fr_profile')) : '') . NBSP . html::button('forum.php?c=search', Lang::item('home.search')))));
echo table::close();
echo html::spacer();
echo table::open();
echo form::open('forum.php', 'search', 'get');
echo form::hidden('c', 'search');
echo table::tds(array(array('class' => 'tableb', 'text' => table::open(2) . table::tds(array(array('text' => html::span(forum::nagavitor($nagavitor))), array('align' => 'right', 'text' => Lang::item('home.dosearch') . form::text('search', '', false) . form::submit(Lang::item('home.submit_search'), 'submit') . html::anchor('forum.php?c=search', Lang::item('home.adv_search'))))) . table::close())));
echo form::close();
echo table::close();
echo html::spacer();
// forum body
echo $fr_contents;
// end
pagefooter();
Example #17
0
            document.getElementById('pv_subject').innerHTML = datas[0];
            document.getElementById('pv_body').innerHTML = datas[1];
        });
    });
});
-->
</script>
EOT;
echo "<div name=\"preview_area\" id=\"preview_area\" style=\"display: none;\">";
echo table::open();
echo table::td(Lang::item('board.topic_preview'), 1);
echo table::tds(array('class' => 'tableh2', 'id' => 'pv_subject', 'text' => ''));
echo table::tds(array('class' => 'tableb', 'id' => 'pv_body', 'text' => ''));
echo table::close();
echo "</div>";
echo table::open();
echo table::td(Lang::item('topic.new_topic'), 2);
echo form::open('forum.php?c=message&m=edit&id=' . $msg_id, 'editmsg');
if (count($errors) > 0) {
    echo table::td(table::error($errors), 2, 'tableh2');
}
echo table::tds(array(array('class' => 'tableb', 'width' => '30%', 'text' => Lang::item('topic.subject')), array('class' => 'tableb', 'width' => '70%', 'text' => form::text('subject', $form['subject']))));
if (Config::item('fr_msg_icons') == 1) {
    echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('topic.message_icon')), array('class' => 'tableb', 'text' => forum::generate_message_icons('icon', $icons, $form['icon']))));
}
echo table::tds(array(array('class' => 'tableb', 'text' => NBSP), array('class' => 'tableb', 'text' => forum::generate_bbcode_tags('editmsg', 'body'))));
echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('topic.message')), array('class' => 'tableb', 'text' => form::textarea('body', $form['body']))));
echo table::tds(array(array('class' => 'tableb', 'text' => NBSP), array('class' => 'tableb', 'text' => generate_smilies('editmsg', 'body'))));
echo table::tds(array(array('class' => 'tablef', 'text' => NBSP), array('class' => 'tablef', 'text' => form::submit(Lang::item('common.modify'), 'submit') . html::jsbutton('return false;', Lang::item('common.preview'), array('id' => 'preview')) . NBSP . html::button('forum.php?c=board&id=' . $board_id, Lang::item('common.cancel')))));
echo form::close();
echo table::close();
Example #18
0
// ip to config
$CONFIG['hdr_ip'] = $hdr_ip;
$CONFIG['raw_ip'] = $raw_ip;
// if admin page
if (substr_count($c, 'admin') > 0) {
    if (!GALLERY_ADMIN_MODE) {
        cpg_die(ERROR, Lang::item('error.access_denied'), __FILE__, __LINE__);
    }
}
// convert to file path
$source_file = BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'sources' . DS . $c . '.php';
// main controller + views
if (file_exists($source_file)) {
    include $source_file;
    $class_name = $c . '_controller';
    if (class_exists($class_name)) {
        $main = new $class_name();
        if (method_exists($main, $m)) {
            $main->{$m}();
        } else {
            // error
            cpg_die(ERROR, sprintf(Lang::item('error.missing_method'), $m, $c), __FILE__, __LINE__);
        }
    } else {
        // error
        cpg_die(ERROR, sprintf(Lang::item('error.missing_class'), $c), __FILE__, __LINE__);
    }
} else {
    // error
    cpg_die(ERROR, sprintf(Lang::item('error.missing_file'), $source_file), __FILE__, __LINE__);
}
Example #19
0
echo table::tds(array(array('class' => 'tablef', 'colspan' => 2, 'text' => form::submit(Lang::item('common.search'), 'submit'))));
echo form::close();
echo table::close();
if (count($messages) > 0) {
    echo html::spacer();
    // paging
    echo table::open();
    echo table::td(Lang::item('search.search_result') . ' - ' . sprintf(Lang::item('search.found'), $results));
    echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('board.page') . forum::paging($paging))));
    echo table::close();
    foreach ($messages as $message) {
        echo table::open();
        echo table::tds(array(array('class' => 'tableh1', 'text' => table::open(2) . table::tds(array(array('align' => 'left', 'width' => '70%', 'text' => forum::nagavitor($message['linkto'], '-->')), array('align' => 'right', 'width' => '30%', 'text' => Lang::item('search.on') . time::decode($message['poster_time'])))) . table::close())));
        echo table::tds(array(array('class' => 'tableh2', 'colspan' => 2, 'text' => Lang::item('search.start_by') . html::profile_anchor($message['starter_id'], $message['starter_name']) . ' | ' . Lang::item('search.message_by') . html::profile_anchor($message['poster_id'], $message['poster_name']))));
        echo table::tds(array(array('class' => 'tableb', 'colspan' => 2, 'text' => forum::format_message($message['body']))));
        echo table::close();
    }
    // paging
    echo table::open();
    echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('board.page') . forum::paging($paging))));
    echo table::close();
    echo html::spacer();
} else {
    if (isset($search)) {
        echo table::open();
        echo table::td(Lang::item('search.search_result'));
        echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('search.no_result'))));
        echo table::close();
        echo html::spacer();
    }
}
Example #20
0
<?php

/**************************************************
  Coppermine 1.5.x Plugin - forum
  *************************************************
  Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/
echo table::open();
echo table::tds(array(array('class' => 'tableh1', 'width' => '170px', 'text' => html::profile_anchor($message['poster_id'], $message['poster_name'])), array('class' => 'tableh1', 'text' => html::img($message['icon'], '65%') . NBSP . sprintf(Lang::item('topic.topic_title'), html::anchor('forum.php?c=message&m=single&id=' . $message['msg_id'], $message['subject']), time::decode($message['time'])))));
echo table::tds(array(array('class' => 'tablef', 'valign' => 'top', 'align' => 'left', 'text' => html::span(sprintf(Lang::item('topic.user_profile'), html::img($message['avatar'], Config::item('fr_avatar_size')), $message['poster_group'], $message['poster_posts'], $message['poster_registed']))), array('class' => 'tableb', 'valign' => 'top', 'text' => forum::format_message($message['body']) . (trim($message['signature']) != '' ? sprintf(Lang::item('topic.signature'), forum::format_message($message['signature'])) : ''))));
echo table::tds(array(array('class' => 'tablef', 'text' => html::button('profile.php?uid=' . $message['poster_id'], Lang::item('topic.profile')) . NBSP), array('class' => 'tablef', 'text' => ($authorizer->can_edit_msg($message['msg_id']) ? html::button('forum.php?c=message&m=edit&id=' . $message['msg_id'], Lang::item('common.modify')) . NBSP : '') . ($authorizer->can_delete_msg($message['msg_id']) ? html::jsbutton("button_confirm('" . Lang::item('message.confirm_delete') . "','forum.php?c=message&m=delete&id={$message['msg_id']}');", Lang::item('common.delete')) : ''))));
echo table::close();
Example #21
0
 protected function generateContent()
 {
     /***********/
     /* Infobox */
     /***********/
     $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     // reqLevel
     if ($_ = $this->subject->getField('requiredLevel')) {
         $infobox[] = sprintf(Lang::game('reqLevel'), $_);
     }
     // reqskill
     if ($_ = $this->subject->getField('skillLine')) {
         $this->extendGlobalIds(TYPE_SKILL, $_);
         $foo = sprintf(Lang::game('requires'), '&nbsp;[skill=' . $_ . ']');
         if ($_ = $this->subject->getField('skillLevel')) {
             $foo .= ' (' . $_ . ')';
         }
         $infobox[] = $foo;
     }
     /****************/
     /* Main Content */
     /****************/
     $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
     $this->effects = [];
     // 3 effects
     for ($i = 1; $i < 4; $i++) {
         $_ty = $this->subject->getField('type' . $i);
         $_qty = $this->subject->getField('amount' . $i);
         $_obj = $this->subject->getField('object' . $i);
         switch ($_ty) {
             case 1:
             case 3:
             case 7:
                 $sArr = $this->subject->getField('spells')[$i];
                 $spl = $this->subject->getRelSpell($sArr[0]);
                 $this->effects[$i]['name'] = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Type: ' . $_ty, Lang::item('trigger', $sArr[1])) : Lang::item('trigger', $sArr[1]);
                 $this->effects[$i]['proc'] = $sArr[3];
                 $this->effects[$i]['value'] = $_qty ?: null;
                 $this->effects[$i]['icon'] = array('name' => !$spl ? Util::ucFirst(Lang::game('spell')) . ' #' . $sArr[0] : Util::localizedString($spl, 'name'), 'id' => $sArr[0], 'count' => $sArr[2]);
                 break;
             case 5:
                 if ($_obj < 2) {
                     // [mana, health] are on [0, 1] respectively and are expected on [1, 2] ..
                     $_obj++;
                 }
                 // 0 is weaponDmg .. ehh .. i messed up somewhere
                 $this->effects[$i]['tip'] = [$_obj, Util::$itemMods[$_obj]];
                 // DO NOT BREAK!
             // DO NOT BREAK!
             case 2:
             case 6:
             case 8:
             case 4:
                 $this->effects[$i]['name'] = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Type: ' . $_ty, Lang::enchantment('types', $_ty)) : Lang::enchantment('types', $_ty);
                 $this->effects[$i]['value'] = $_qty;
                 if ($_ty == 4) {
                     $this->effects[$i]['name'] .= Lang::main('colon') . '(' . (User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'Object: ' . $_obj, Lang::getMagicSchools(1 << $_obj)) : Lang::getMagicSchools(1 << $_obj)) . ')';
                 }
         }
     }
     // activation conditions
     if ($_ = $this->subject->getField('conditionId')) {
         $x = '';
         if ($gemCnd = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantmentcondition WHERE id = ?d', $_)) {
             for ($i = 1; $i < 6; $i++) {
                 if (!$gemCnd['color' . $i]) {
                     continue;
                 }
                 $fiColors = function ($idx) {
                     $foo = '';
                     switch ($idx) {
                         case 2:
                             $foo = '0:3:5';
                             break;
                             // red
                         // red
                         case 3:
                             $foo = '2:4:5';
                             break;
                             // yellow
                         // yellow
                         case 4:
                             $foo = '1:3:4';
                             break;
                             // blue
                     }
                     return $foo;
                 };
                 $bLink = $gemCnd['color' . $i] ? '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['color' . $i]) . '">' . Lang::item('gemColors', $gemCnd['color' . $i] - 1) . '</a>' : '';
                 $cLink = $gemCnd['cmpColor' . $i] ? '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['cmpColor' . $i]) . '">' . Lang::item('gemColors', $gemCnd['cmpColor' . $i] - 1) . '</a>' : '';
                 switch ($gemCnd['comparator' . $i]) {
                     case 2:
                         // requires less <color> than (<value> || <comparecolor>) gems
                     // requires less <color> than (<value> || <comparecolor>) gems
                     case 5:
                         // requires at least <color> than (<value> || <comparecolor>) gems
                         $sp = (int) $gemCnd['value' . $i] > 1;
                         $x .= '<span class="q0">' . Lang::achievement('reqNumCrt') . ' ' . sprintf(Lang::item('gemConditions', $gemCnd['comparator' . $i], $sp), $gemCnd['value' . $i], $bLink) . '</span><br />';
                         break;
                     case 3:
                         // requires more <color> than (<value> || <comparecolor>) gems
                         $link = '<a href="?items=3&filter=ty=' . $fiColors($gemCnd['cmpColor' . $i]) . '">' . Lang::item('gemColors', $gemCnd['cmpColor' . $i] - 1) . '</a>';
                         $x .= '<span class="q0">' . Lang::achievement('reqNumCrt') . ' ' . sprintf(Lang::item('gemConditions', 3), $bLink, $cLink) . '</span><br />';
                         break;
                 }
             }
         }
         $this->activateCondition = $x;
     }
     /**************/
     /* Extra Tabs */
     /**************/
     // used by gem
     $gemList = new ItemList(array(['gemEnchantmentId', $this->typeId]));
     if (!$gemList->error) {
         $this->lvTabs[] = ['item', array('data' => array_values($gemList->getListviewData()), 'name' => '$LANG.tab_usedby + \' \' + LANG.gems', 'id' => 'used-by-gem')];
         $this->extendGlobalData($gemList->getJsGlobals());
     }
     // used by socket bonus
     $socketsList = new ItemList(array(['socketBonus', $this->typeId]));
     if (!$socketsList->error) {
         $this->lvTabs[] = ['item', array('data' => array_values($socketsList->getListviewData()), 'name' => '$LANG.tab_usedby + \' \' + \'' . Lang::item('socketBonus') . '\'', 'id' => 'used-by-socketbonus')];
         $this->extendGlobalData($socketsList->getJsGlobals());
     }
     // used by spell
     // used by useItem
     $cnd = array('OR', ['AND', ['effect1Id', [53, 54, 156, 92]], ['effect1MiscValue', $this->typeId]], ['AND', ['effect2Id', [53, 54, 156, 92]], ['effect2MiscValue', $this->typeId]], ['AND', ['effect3Id', [53, 54, 156, 92]], ['effect3MiscValue', $this->typeId]]);
     $spellList = new SpellList($cnd);
     if (!$spellList->error) {
         $spellData = $spellList->getListviewData();
         $this->extendGlobalData($spellList->getJsGlobals());
         $spellIds = $spellList->getFoundIDs();
         $conditions = array('OR', ['AND', ['spellTrigger1', [0, 5]], ['spellId1', $spellIds]], ['AND', ['spellTrigger2', [0, 5]], ['spellId2', $spellIds]], ['AND', ['spellTrigger3', [0, 5]], ['spellId3', $spellIds]], ['AND', ['spellTrigger4', [0, 5]], ['spellId4', $spellIds]], ['AND', ['spellTrigger5', [0, 5]], ['spellId5', $spellIds]]);
         $ubItems = new ItemList($conditions);
         if (!$ubItems->error) {
             $this->lvTabs[] = ['item', array('data' => array_values($ubItems->getListviewData()), 'name' => '$LANG.tab_usedby + \' \' + LANG.types[3][0]', 'id' => 'used-by-item')];
             $this->extendGlobalData($ubItems->getJSGlobals(GLOBALINFO_SELF));
         }
         // remove found spells if they are used by an item
         if (!$ubItems->error) {
             foreach ($spellList->iterate() as $sId => $__) {
                 // if Perm. Enchantment has a createItem its a Scroll of Enchantment (display both)
                 for ($i = 1; $i < 4; $i++) {
                     if ($spellList->getField('effect' . $i . 'Id') == 53 && $spellList->getField('effect' . $i . 'CreateItemId')) {
                         continue 2;
                     }
                 }
                 foreach ($ubItems->iterate() as $__) {
                     for ($i = 1; $i < 6; $i++) {
                         if ($ubItems->getField('spellId' . $i) == $sId) {
                             unset($spellData[$sId]);
                             break 2;
                         }
                     }
                 }
             }
         }
         $this->lvTabs[] = ['spell', array('data' => array_values($spellData), 'name' => '$LANG.tab_usedby + \' \' + LANG.types[6][0]', 'id' => 'used-by-spell')];
     }
     // used by randomAttrItem
     $ire = DB::Aowow()->select('SELECT *, ABS(id) AS ARRAY_KEY FROM ?_itemrandomenchant WHERE enchantId1 = ?d OR enchantId2 = ?d OR enchantId3 = ?d OR enchantId4 = ?d OR enchantId5 = ?d', $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId);
     if ($ire) {
         if ($iet = DB::World()->select('SELECT entry AS ARRAY_KEY, ench, chance FROM item_enchantment_template WHERE ench IN (?a)', array_keys($ire))) {
             $randIds = [];
             // transform back to signed format
             foreach ($iet as $tplId => $data) {
                 $randIds[$ire[$data['ench']]['id'] > 0 ? $tplId : -$tplId] = $ire[$data['ench']]['id'];
             }
             $randItems = new ItemList(array(CFG_SQL_LIMIT_NONE, ['randomEnchant', array_keys($randIds)]));
             if (!$randItems->error) {
                 $data = $randItems->getListviewData();
                 foreach ($randItems->iterate() as $iId => $__) {
                     $re = $randItems->getField('randomEnchant');
                     $data[$iId]['percent'] = $iet[abs($re)]['chance'];
                     $data[$iId]['count'] = 1;
                     // expected by js or the pct-col becomes unsortable
                     $data[$iId]['rel'] = 'rand=' . $ire[$iet[abs($re)]['ench']]['id'];
                     $data[$iId]['name'] .= ' ' . Util::localizedString($ire[$iet[abs($re)]['ench']], 'name');
                 }
                 $this->lvTabs[] = ['item', array('data' => array_values($data), 'id' => 'used-by-rand', 'name' => '$LANG.tab_usedby + \' \' + \'' . Lang::item('_rndEnchants') . '\'', 'extraCols' => ['$Listview.extraCols.percent'])];
                 $this->extendGlobalData($randItems->getJSGlobals(GLOBALINFO_SELF));
             }
         }
     }
 }
Example #22
0
            echo '                        <small class="q0">' . sprintf(Lang::item('_chance'), $i['chance']) . '</small><br />' . $i['enchantment'] . '</div></li>';
        }
    }
    ?>
                    </ul>
                </div>
<?php 
    if (count($this->subItems) > 1) {
        ?>
                <div class="random-enchantments" style="margin-right: 25px">
                    <ul>
<?php 
        foreach ($this->subItems['data'] as $k => $i) {
            if ($k >= count($this->subItems['data']) / 2) {
                echo '                        <li><div><span class="q' . $this->subItems['quality'] . '">...' . $i['name'] . '</span>';
                echo '                        <small class="q0">' . sprintf(Lang::item('_chance'), $i['chance']) . '</small><br />' . $i['enchantment'] . '</div></li>';
            }
        }
        ?>
                    </ul>
                </div>
<?php 
    }
}
$this->brick('book');
?>

                <h2 class="clear"><?php 
echo Lang::main('related');
?>
</h2>
Example #23
0
 /**
  * ****************************************************
  * UPDATE
  * ****************************************************
  */
 function update()
 {
     codebase_query(Lang::item('admin.update'), 'plugins' . DS . 'forum' . DS . 'sql' . DS . 'update.sql');
     forum::message(Lang::item('common.message'), Lang::item('admin.update_success'), 'forum.php?c=admin', 3);
 }
Example #24
0
 function remove_avatar()
 {
     $authorizer = check_model::getInstance();
     // user or not
     if (!$authorizer->is_user()) {
         cpg_die(ERROR, Lang::item('error.perm_denied'), __FILE__, __LINE__);
     }
     $data['fr_avatar'] = '';
     $this->forum->edit_profile(USER_ID, $data);
     forum::redirect('forum.php?c=profile');
 }
Example #25
0
 private function parseRating($type, $value, $interactive = false, &$scaling = false)
 {
     // clamp level range
     $ssdLvl = isset($this->ssd[$this->id]) ? $this->ssd[$this->id]['maxLevel'] : 1;
     $reqLvl = $this->curTpl['requiredLevel'] > 1 ? $this->curTpl['requiredLevel'] : MAX_LEVEL;
     $level = min(max($reqLvl, $ssdLvl), MAX_LEVEL);
     if (!Lang::item('statType', $type)) {
         // unknown rating
         return sprintf(Lang::item('statType', count(Lang::item('statType')) - 1), $type, $value);
     } else {
         if (in_array($type, Util::$lvlIndepRating)) {
             // level independant Bonus
             return Lang::item('trigger', 1) . str_replace('%d', '<!--rtg' . $type . '-->' . $value, Lang::item('statType', $type));
         } else {
             $scaling = true;
             if ($interactive) {
                 $js = '&nbsp;<small>(' . sprintf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)) . ')</small>';
             } else {
                 $js = "&nbsp;<small>(" . Util::setRatingLevel($level, $type, $value) . ")</small>";
             }
             return Lang::item('trigger', 1) . str_replace('%d', '<!--rtg' . $type . '-->' . $value . $js, Lang::item('statType', $type));
         }
     }
 }
Example #26
0
 public static function setRatingLevel($level, $type, $val)
 {
     if (in_array($type, [ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_DODGE_RATING, ITEM_MOD_PARRY_RATING, ITEM_MOD_BLOCK_RATING, ITEM_MOD_RESILIENCE_RATING]) && $level < 34) {
         $level = 34;
     }
     if (!isset(Util::$gtCombatRatings[$type])) {
         $result = 0;
     } else {
         if ($level > 70) {
             $c = 82 / 52 * pow(131 / 63, ($level - 70) / 10);
         } else {
             if ($level > 60) {
                 $c = 82 / (262 - 3 * $level);
             } else {
                 if ($level > 10) {
                     $c = ($level - 8) / 52;
                 } else {
                     $c = 2 / 52;
                 }
             }
         }
         $result = number_format($val / Util::$gtCombatRatings[$type] / $c, 2);
     }
     if (!in_array($type, array(ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_EXPERTISE_RATING))) {
         $result .= '%';
     }
     return sprintf(Lang::item('ratingString'), '<!--rtg%' . $type . '-->' . $result, '<!--lvl-->' . $level);
 }
Example #27
0
/**************************************************
  Coppermine 1.5.x Plugin - forum
  *************************************************
  Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/
// menu
echo table::open();
echo table::tds(array(array('class' => 'tableb', 'text' => html::button('forum.php?c=admin', Lang::item('admin.home')) . NBSP . html::button('forum.php?c=admin&amp;m=newcat', Lang::item('admin.new_category')) . NBSP . html::button('forum.php?c=admin&amp;m=setting', Lang::item('admin.setting')))));
echo table::close();
echo table::open();
echo form::open('forum.php?c=admin&m=editcat');
echo form::hidden('id', $cat_id);
echo table::td(Lang::item('admin.new_cat'), 2);
if (count($errors) > 0) {
    echo table::td(table::error($errors), 2, 'tableh2');
}
echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('admin.fullname')), array('class' => 'tableb', 'text' => form::text('name', $form['name']))));
echo table::tds(array(array('class' => 'tablef', 'colspan' => '2', 'text' => form::submit(Lang::item('common.modify'), 'submit'))));
echo form::close();
echo table::close();
Example #28
0
 private function parseRating($type, $value, $interactive = false, &$scaling = false)
 {
     // clamp level range
     $ssdLvl = isset($this->ssd[$this->id]) ? $this->ssd[$this->id]['maxLevel'] : 1;
     $reqLvl = $this->curTpl['requiredLevel'] > 1 ? $this->curTpl['requiredLevel'] : MAX_LEVEL;
     $level = min(max($reqLvl, $ssdLvl), MAX_LEVEL);
     // unknown rating
     if (in_array($type, [2, 8, 9, 10, 11]) || $type > ITEM_MOD_BLOCK_VALUE || $type < 0) {
         if (User::isInGroup(U_GROUP_EMPLOYEE)) {
             return sprintf(Lang::item('statType', count(Lang::item('statType')) - 1), $type, $value);
         } else {
             return null;
         }
     } else {
         if (in_array($type, Util::$lvlIndepRating)) {
             return Lang::item('trigger', 1) . str_replace('%d', '<!--rtg' . $type . '-->' . $value, Lang::item('statType', $type));
         } else {
             $scaling = true;
             if ($interactive) {
                 $js = '&nbsp;<small>(' . sprintf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)) . ')</small>';
             } else {
                 $js = '&nbsp;<small>(' . Util::setRatingLevel($level, $type, $value) . ')</small>';
             }
             return Lang::item('trigger', 1) . str_replace('%d', '<!--rtg' . $type . '-->' . $value . $js, Lang::item('statType', $type));
         }
     }
 }
Example #29
0
<?php

/**************************************************
  Coppermine 1.5.x Plugin - forum
  *************************************************
  Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/
pageheader($fr_title ? $fr_title : Config::item('fr_title'));
print html::spacer();
print table::open(0);
print table::tds(array(array('text' => $fr_title ? $fr_title : Config::item('fr_title')), array('align' => 'right', 'text' => ($authorizer->is_user() ? html::button('forum.php?c=profile', Lang::item('home.fr_profile')) : '') . NBSP . html::button('forum.php?c=search', Lang::item('home.search')))));
print table::close();
print html::spacer();
print table::open();
print form::hidden('c', 'search');
print table::tds(array(array('class' => 'tableb', 'text' => html::span(forum::nagavitor($nagavitor)))));
print table::close();
print html::spacer();
print $fr_contents;
pagefooter();
Example #30
0
    echo table::open();
    echo table::td(Lang::item('topic.no_message'), 1, 'tableb');
    echo table::close();
}
// paging
echo table::open();
echo table::tds(array(array('class' => 'tableb', 'text' => table::open(2) . table::tds(array(array('width' => '70%', 'align' => 'left', 'text' => Lang::item('board.page') . forum::paging($paging)), array('width' => '30%', 'align' => 'right', 'text' => (check_model::can_reply($topic_id) ? html::jsbutton('show_section(\'fastreply\');', Lang::item('topic.fast_reply')) . NBSP . html::button('forum.php?c=topic&m=reply&id=' . $topic_id, Lang::item('topic.reply')) : '') . NBSP . ($authorizer->is_user() ? html::jsbutton("button_confirm('" . ($authorizer->is_notify_topic($topic_id) ? Lang::item('topic.disable_notify') : Lang::item('topic.active_notify')) . "','" . ($authorizer->is_notify_topic($topic_id) ? 'forum.php?c=topic&m=unnotify&id=' . $topic_id : 'forum.php?c=topic&m=notify&id=' . $topic_id) . "');", Lang::item('topic.notify')) . NBSP : '')))) . table::close())));
echo html::spacer();
echo table::open();
echo table::tds(array(array('class' => 'tableb', 'text' => table::open(2) . table::tds(array(array('width' => '66%', 'text' => ($authorizer->can_moderator_topic($topic_id) ? html::button('forum.php?c=topic&m=locked&id=' . $topic_id, $authorizer->is_locked($topic_id) ? Lang::item('topic.unlock_topic') : Lang::item('topic.lock_topic')) . NBSP : '') . ($authorizer->can_moderator_topic($topic_id) ? html::button('forum.php?c=topic&m=sticky&id=' . $topic_id, $authorizer->is_sticky($topic_id) ? Lang::item('topic.unsticky_topic') : Lang::item('topic.sticky_topic')) . NBSP : '') . ($authorizer->can_moderator_topic($topic_id) ? html::jsbutton("button_confirm('" . Lang::item('topic.confirm_delete') . "','forum.php?c=topic&m=delete&id={$topic_id}');", Lang::item('topic.delete_topic')) . NBSP : '') . ($authorizer->can_moderator_topic($topic_id) ? html::button('forum.php?c=topic&m=move&id=' . $topic_id, Lang::item('topic.move_topic')) : '')), array('width' => '33%', 'align' => 'right', 'text' => forum::redirect_box($cbs, $board_id)))) . table::close())));
echo table::close();
echo "<div id=\"fastreply\" style=\"display: none;\">";
echo table::open();
echo form::open('forum.php?c=topic&m=reply&id=' . $topic_id, 'fastreply', 'post');
echo table::td(Lang::item('topic.topic_reply'), 4);
echo table::tds(array(array('class' => 'tableb', 'width' => '30%', 'text' => Lang::item('topic.subject')), array('class' => 'tableb', 'width' => '70%', 'text' => form::text('subject', Lang::item('topic.re') . $topic_name))));
if (Config::item('fr_msg_icons') == 1) {
    echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('topic.message_icon')), array('class' => 'tableb', 'text' => forum::generate_message_icons('icon', $icons, 'icon1'))));
}
echo table::tds(array(array('class' => 'tableb', 'text' => NBSP), array('class' => 'tableb', 'text' => forum::generate_bbcode_tags('fastreply', 'body'))));
echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('topic.message')), array('class' => 'tableb', 'text' => form::textarea('body'))));
global $CONFIG;
if ($CONFIG['comment_captcha'] == 1 || $CONFIG['comment_captcha'] == 2 && !USER_ID) {
    global $lang_common;
    print table::tds(array(array('class' => 'tableb', 'text' => $lang_common['confirm']), array('class' => 'tableb', 'text' => '<input type="text" name="confirmCode" size="5" maxlength="5" class="textinput" /><img src="captcha.php" align="middle" border="0" alt="" />')));
}
echo table::tds(array(array('class' => 'tableb', 'text' => NBSP), array('class' => 'tableb', 'text' => generate_smilies('fastreply', 'body'))));
echo table::tds(array(array('class' => 'tablef', 'text' => NBSP), array('class' => 'tablef', 'text' => form::submit(Lang::item('common.reply'), 'submit'))));
echo form::close();
echo table::close();
echo "</div>";