diff --git a/includes/ajaxHandler.class.php b/includes/ajaxHandler.class.php index 1b2aac30..557ab3ac 100644 --- a/includes/ajaxHandler.class.php +++ b/includes/ajaxHandler.class.php @@ -635,6 +635,83 @@ class AjaxHandler return null; } + private function handleAdmin() + { + if (empty($this->get['action']) || !$this->params) + return null; + + if ($this->params[0] == 'siteconfig') + { + if (!User::isInGroup(U_GROUP_DEV | U_GROUP_ADMIN)) + return null; + + switch ($this->get['action']) + { + case 'remove': + if (empty($this->get['id'])) + return 'invalid configuration option given'; + + if (DB::Aowow()->query('DELETE FROM ?_config WHERE `key` = ? AND (`flags` & ?d) = 0', $this->get['id'], CON_FLAG_PERSISTANT)) + return ''; + else + return 'option name is either protected or was not found'; + case 'add': + $key = strtolower(trim(@$this->get['id'])); + $val = trim(@$this->get['val']); + + if (!strlen($key)) + return 'empty option name given'; + if (!strlen($val)) + return 'empty value given'; + + if (preg_match('/[^a-z0-9_\.\-]/i', $key, $m)) + return 'invalid chars in option name: "'.$m[0].'"'; + + if (ini_get($key) === false || ini_set($key, $val) === false) + return 'this configuration option cannot be set'; + + if (DB::Aowow()->selectCell('SELECT 1 FROM ?_config WHERE `flags` & ?d AND `key` = ?', CON_FLAG_PHP, $key)) + return 'this configuration option is already in use'; + + DB::Aowow()->query('INSERT IGNORE INTO ?_config (`key`, `value`, `flags`) VALUES (?, ?, ?d)', $key, $val, CON_FLAG_TYPE_STRING | CON_FLAG_PHP); + return ''; + case 'update': + $key = trim(@$this->get['id']); + $val = trim(@$this->get['val']); + + if (!strlen($key)) + return 'empty option name given'; + if (!strlen($val)) + return 'empty value given'; + + if (substr($key, 0, 4) == 'CFG_') + $key = substr($key, 4); + + $flags = DB::Aowow()->selectCell('SELECT `flags` FROM ?_config WHERE `key` = ?', $key); + if (!$flags) + return 'configuration option not found'; + + if (preg_match('/[^a-z0-9_\-]/i', $key, $m)) + return 'invalid chars in option name: "'.$m[0].'"'; + + if ($flags & CON_FLAG_TYPE_INT && !preg_match('/^-?\d+$/i', $val)) + return "value must be integer"; + else if ($flags & CON_FLAG_TYPE_FLOAT && !preg_match('/^-?\d*(,|.)?\d+$/i', $val)) + return "value must be float"; + else if ($flags & CON_FLAG_TYPE_BOOL) + $val = (int)!!$val; // *snort* bwahahaa + + DB::Aowow()->query('UPDATE ?_config SET `value` = ? WHERE `key` = ?', $val, $key); + return ''; + default: + return null; + } + } + + return null; + } + + /**********/ /* Helper */ /**********/ @@ -996,8 +1073,6 @@ class AjaxHandler // hey, still here? you're not a Tauren/Nelf as bear or cat, are you? return DB::Aowow()->selectCell('SELECT IF(?d == 1, IFNULL(displayIdA, displayIdH), IFNULL(displayIdH, displayIdA)) FROM ?_shapeshiftform WHERE id = ?d', Util::sideByRaceMask(1 << ($char['race'] - 1)), $form); } - - } ?> diff --git a/includes/defines.php b/includes/defines.php index 57a4851a..9d4f3c82 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -83,6 +83,16 @@ define('SITEREP_ACTION_ARTICLE', 16); // Guide approved (a define('SITEREP_ACTION_USER_WARNED', 17); // Moderator Warning define('SITEREP_ACTION_USER_SUSPENDED', 18); // Moderator Suspension +// config flags +define('CON_FLAG_TYPE_INT', 0x01); // validate with intVal() +define('CON_FLAG_TYPE_FLOAT', 0x02); // validate with floatVal() +define('CON_FLAG_TYPE_BOOL', 0x04); // 0 || 1 +define('CON_FLAG_TYPE_STRING', 0x08); // +define('CON_FLAG_OPT_LIST', 0x10); // single option +define('CON_FLAG_BITMASK', 0x20); // multiple options +define('CON_FLAG_PHP', 0x40); // applied with ini_set() [restrictions apply!] +define('CON_FLAG_PERSISTANT', 0x80); // can not be deleted + // Auth Result define('AUTH_OK', 0); define('AUTH_WRONGUSER', 1); diff --git a/includes/kernel.php b/includes/kernel.php index 6288a435..1cbbe965 100644 --- a/includes/kernel.php +++ b/includes/kernel.php @@ -4,8 +4,6 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -ini_set('serialize_precision', 4); - require 'includes/defines.php'; require 'config/config.php'; require 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using variant: https://github.com/ivan1986/DbSimple/tree/master) @@ -66,9 +64,34 @@ unset($AoWoWconf); // link set up: dele // load config to constants -$sets = DB::Aowow()->select('SELECT `key` AS ARRAY_KEY, intValue as i, strValue as s FROM ?_config'); +$sets = DB::Aowow()->select('SELECT `key` AS ARRAY_KEY, `value`, `flags` FROM ?_config'); foreach ($sets as $k => $v) - define('CFG_'.strtoupper($k), $v['s'] ?: intVal($v['i'])); +{ + // this should not have been possible + if (!strlen($v['value'])) + continue; + + $php = $v['flags'] & CON_FLAG_PHP; + + if ($v['flags'] & CON_FLAG_TYPE_INT) + $val = intVal($v['value']); + else if ($v['flags'] & CON_FLAG_TYPE_FLOAT) + $val = floatVal($v['value']); + else if ($v['flags'] & CON_FLAG_TYPE_BOOL) + $val = (bool)$v['value']; + else if ($v['flags'] & CON_FLAG_TYPE_STRING) + $val = preg_replace('/[^\p{L}0-9\s_\-\'\.,]/ui', '', $v['value']); + else + { + Util::addNote(U_GROUP_ADMIN | U_GROUP_DEV, 'Kernel: '.($php ? 'PHP' : 'Aowow').' config value '.($php ? strtolower($k) : 'CFG_'.strtoupper($k)).' has no type set. Value forced to 0!'); + $val = 0; + } + + if ($php) + ini_set(strtolower($k), $val); + else + define('CFG_'.strtoupper($k), $val); +} $secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || CFG_FORCE_SSL; diff --git a/index.php b/index.php index 107f8674..8848ab7a 100644 --- a/index.php +++ b/index.php @@ -31,6 +31,8 @@ switch ($pageCall) /* called by user */ case '': // no parameter given -> MainPage $altClass = 'home'; + case 'home': + case 'admin': case 'account': // account management [nyi] case 'achievement': case 'achievements': @@ -81,7 +83,7 @@ switch ($pageCall) // case 'user': // tool: user profiles [nyi] case 'zone': case 'zones': - if (in_array($pageCall, ['account', 'profile'])) + if (in_array($pageCall, ['admin', 'account', 'profile'])) { if (($_ = (new AjaxHandler($pageParam))->handle($pageCall)) !== null) { diff --git a/pages/admin.php b/pages/admin.php new file mode 100644 index 00000000..689e5ca2 --- /dev/null +++ b/pages/admin.php @@ -0,0 +1,502 @@ +reqUGroup = U_GROUP_ADMIN | U_GROUP_DEV; + $this->generator = 'handlePhpInfo'; + $this->tpl = 'list-page-generic'; + + array_push($this->path, 2, 21); + $this->name = 'PHP Information'; + break; + case 'siteconfig': + $this->reqUGroup = U_GROUP_ADMIN | U_GROUP_DEV; + $this->generator = 'handleConfig'; + $this->tpl = 'list-page-generic'; + + array_push($this->path, 2, 18); + $this->name = 'Site Configuration'; + break; + default: // error out through unset template + } + + parent::__construct($pageCall, $pageParam); + } + + protected function generateContent() + { + if (!$this->generator || function_exists($this->generator)) + return; + + $this->{$this->generator}(); + } + + private function handleConfig() + { + $this->addCSS(array( + ['string' => '.grid input[type=\'text\'] { width:250px; }'], + ['string' => '.grid input[type=\'button\'] { width:65px; padding:2px; }'], + ['string' => '.disabled { opacity:0.4 !important; }'], + ['string' => '.grid a.tip { margin:0px 5px; opacity:0.8; }'], + ['string' => '.grid a.tip:hover { opacity:1; }'], + ['string' => '.status { position:absolute; right:5px; }'], + )); + + // well .. fuck! + ob_start(); +?> + +extraHTML = ob_get_contents(); + ob_end_clean(); + // eof (end of fuckup) + + $head = ''; + + // for aowow + if ($rows = DB::Aowow()->select('SELECT * FROM ?_config WHERE (flags & ?d) = 0 ORDER BY `key` ASC', CON_FLAG_PHP)) + { + $buff = $head; + foreach ($rows as $r) + $buff .= $this->configAddRow($r); + + $buff .= '
KeyValueOptions
'; + + $this->lvTabs[] = array( + 'file' => null, + 'data' => $buff, + 'params' => array( + 'name' => 'Aowow', + 'id' => 'aowow' + ) + ); + } + + // for php + $rows = DB::Aowow()->select('SELECT * FROM ?_config WHERE flags & ?d ORDER BY `key` ASC', CON_FLAG_PHP); + $buff = $head; + foreach ($rows as $r) + $buff .= $this->configAddRow($r); + + $buff .= 'new configuration'; + $buff .= ''; + + $this->lvTabs[] = array( + 'file' => null, + 'data' => $buff, + 'params' => array( + 'name' => 'PHP', + 'id' => 'php' + ) + ); + } + + private function handlePhpInfo() + { + $this->addCSS([ + 'string' => "\npre {margin: 0px; font-family: monospace;}\n" . + "td, th { border: 1px solid #000000; vertical-align: baseline;}\n" . + ".p {text-align: left;}\n" . + ".e {background-color: #ccccff; font-weight: bold; color: #000000;}\n" . + ".h {background-color: #9999cc; font-weight: bold; color: #000000;}\n" . + ".v {background-color: #cccccc; color: #000000;}\n" . + ".vr {background-color: #cccccc; text-align: right; color: #000000;}\n" + ]); + + $bits = [INFO_GENERAL, INFO_CONFIGURATION, INFO_ENVIRONMENT, INFO_MODULES]; + $names = ['General', '', '', 'Module']; + foreach ($bits as $i => $b) + { + ob_start(); + phpinfo($b); + $buff = ob_get_contents(); + ob_end_clean(); + + $buff = explode('
', $buff)[1]; + $buff = explode('
', $buff); + array_pop($buff); // remove last from stack + $buff = implode('', $buff); // sew it together + + if (strpos($buff, '

')) + $buff = explode('

', $buff)[1]; + + if (strpos($buff, '

')) + { + $parts = explode('

', $buff); + foreach ($parts as $p) + { + if (!preg_match('/\w/i', $p)) + continue; + + $p = explode('

', $p); + + $body = substr($p[1], 0, -7); // remove trailing "
\n" + $name = $names[$i] ? $names[$i].': ' : ''; + if (preg_match('/]*>([\w\s\d]+)<\/a>/i', $p[0], $m)) + $name .= $m[1]; + else + $name .= $p[0]; + + $this->lvTabs[] = array( + 'file' => null, + 'data' => $body, + 'params' => array( + 'id' => strtolower(strtr($name, [' ' => ''])), + 'name' => $name + ) + ); + } + } + else + { + $this->lvTabs[] = array( + 'file' => null, + 'data' => $buff, + 'params' => array( + 'id' => strtolower($names[$i]), + 'name' => $names[$i] + ) + ); + } + } + } + + private function configAddRow($r) + { + $buff = ''; + $info = explode(' - ', $r['comment']); + $key = $r['flags'] & CON_FLAG_PHP ? strtolower($r['key']) : 'CFG_'.strtoupper($r['key']); + + // name + if (!empty($info[1])) + $buff .= ''.sprintf(Util::$dfnString, $info[1], $key).''; + else + $buff .= ''.$key.''; + + // value + if ($r['flags'] & CON_FLAG_TYPE_BOOL) + $buff .= '
'; + else if ($r['flags'] & CON_FLAG_OPT_LIST && !empty($info[2])) + { + $buff .= ''; + } + else if ($r['flags'] & CON_FLAG_BITMASK && !empty($info[2])) + { + $buff .= '
'; + foreach (explode(', ', $info[2]) as $option) + { + $opt = explode(':', $option); + $buff .= ''; + } + $buff .= '
'; + } + else + $buff .= ''; + + // actions + $buff .= ''; + + $buff .= ''; + + if (strstr($info[0], 'default:')) + $buff .= '|'; + else + $buff .= '|'; + + if (!($r['flags'] & CON_FLAG_PERSISTANT)) + $buff .= '|'; + + $buff .= ''; + + return $buff; + } + + protected function generateTitle() {} + protected function generatePath() {} +} + +?> diff --git a/pages/genericPage.class.php b/pages/genericPage.class.php index f227be74..1b25d762 100644 --- a/pages/genericPage.class.php +++ b/pages/genericPage.class.php @@ -137,7 +137,7 @@ class GenericPage private function isSaneInclude($path, $file) // "template_exists" { - if (preg_match('/[^\w\-]/i', $file)) + if (preg_match('/[^\w\-]/i', str_replace('admin/', '', $file))) return false; if (!is_file($path.$file.'.tpl.php')) @@ -308,9 +308,9 @@ class GenericPage } // fetch announcements - if (preg_match('/^([a-z\-]+)=?.*$/i', $_SERVER['QUERY_STRING'], $match)) + if ($this->pageTemplate['pageName']) { - $ann = DB::Aowow()->Select('SELECT ABS(id) AS ARRAY_KEY, a.* FROM ?_announcements a WHERE status = 1 AND (page = ? OR page = "*") AND (groupMask = 0 OR groupMask & ?d)', $match[1], User::$groups); + $ann = DB::Aowow()->Select('SELECT ABS(id) AS ARRAY_KEY, a.* FROM ?_announcements a WHERE status = 1 AND (page = ? OR page = "*") AND (groupMask = 0 OR groupMask & ?d)', $this->pageTemplate['pageName'], User::$groups); foreach ($ann as $k => $v) { if ($t = Util::localizedString($v, 'text')) diff --git a/setup/updates/01_config.sql b/setup/updates/01_config.sql new file mode 100644 index 00000000..e067a79e --- /dev/null +++ b/setup/updates/01_config.sql @@ -0,0 +1,73 @@ +-- -------------------------------------------------------- +-- Host: 127.0.0.1 +-- Server Version: 5.6.16 - MySQL Community Server (GPL) +-- Server Betriebssystem: Win32 +-- HeidiSQL Version: 8.3.0.4834 +-- -------------------------------------------------------- + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +-- Exportiere Struktur von Tabelle world.aowow_config +DROP TABLE IF EXISTS `aowow_config`; +CREATE TABLE IF NOT EXISTS `aowow_config` ( + `key` varchar(25) NOT NULL, + `value` varchar(255) NOT NULL, + `flags` tinyint(3) unsigned NOT NULL DEFAULT '0', + `comment` varchar(255) NOT NULL, + PRIMARY KEY (`key`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- Exportiere Daten aus Tabelle world.aowow_config: 44 rows +/*!40000 ALTER TABLE `aowow_config` DISABLE KEYS */; +INSERT INTO `aowow_config` (`key`, `value`, `flags`, `comment`) VALUES + ('sql_limit_search', '500', 129, 'default: 500 - max results for search'), + ('sql_limit_default', '300', 129, 'default: 300 - max results for listviews'), + ('sql_limit_quicksearch', '10', 129, 'default: 10 - max results for suggestions'), + ('sql_limit_none', '0', 129, 'default: 0 - unlimited results (i wouldn\'t change that mate)'), + ('ttl_rss', '60', 129, 'default: 60 - time to live for RSS (in seconds)'), + ('cache_decay', '25200', 129, 'default: 60 * 60 * 7 - time to keep cache in seconds'), + ('session_timeout_delay', '3600', 129, 'default: 60 * 60 - non-permanent session times out in time() + X'), + ('failed_auth_exclusion', '900', 129, 'default: 15 * 60 - how long an account is closed after exceeding failed_auth_count (in seconds)'), + ('failed_auth_count', '5', 129, 'default: 5 - how often invalid passwords are tolerated'), + ('name', 'Aowow Database Viewer (ADV)', 136, ' - website title'), + ('name_short', 'Aowow', 136, ' - feed title'), + ('board_url', 'http://www.wowhead.com/forums?board=', 136, ' - another halfbaked javascript thing..'), + ('contact_email', 'feedback@aowow.org', 136, ' - displayed sender for auth-mails, ect'), + ('battlegroup', 'Pure Pwnage', 136, ' - pretend, we belong to a battlegroup to satisfy profiler-related Jscripts'), + ('allow_register', '0', 132, 'default: 1 - allow/disallow account creation (requires auth_mode 0)'), + ('debug', '1', 132, 'default: 0 - disable cache, enable sql-errors, enable error_reporting'), + ('maintenance', '0', 132, 'default: 0 - display brb gnomes and block access for non-staff'), + ('auth_mode', '0', 145, 'default: 0 - source to auth against - 0:aowow, 1:TC auth-table, 2:external script'), + ('rep_req_upvote', '125', 129, 'default: 125 - required reputation to upvote comments'), + ('rep_req_downvote', '250', 129, 'default: 250 - required reputation to downvote comments'), + ('rep_req_comment', '75', 129, 'default: 75 - required reputation to write a comment / reply'), + ('rep_req_supervote', '2500', 129, 'default: 2500 - required reputation for double vote effect'), + ('rep_req_votemore_base', '2000', 129, 'default: 2000 - gains more votes past this threshold'), + ('rep_reward_register', '100', 129, 'default: 100 - activated an account'), + ('rep_reward_upvoted', '5', 129, 'default: 5 - comment received upvote'), + ('rep_reward_downvoted', '0', 129, 'default: 0 - comment received downvote'), + ('rep_reward_good_report', '10', 129, 'default: 10 - filed an accepted report'), + ('rep_reward_bad_report', '0', 129, 'default: 0 - filed a rejected report'), + ('rep_reward_dailyvisit', '5', 129, 'default: 5 - daily visit'), + ('rep_reward_user_warned', '-50', 129, 'default: -50 - moderator imposed a warning'), + ('rep_reward_comment', '1', 129, 'default: 1 - created a comment (not a reply) '), + ('rep_req_premium', '25000', 129, 'default: 25000 - required reputation for premium status through reputation'), + ('rep_reward_upload', '10', 129, 'default: 10 - suggested / uploaded video / screenshot was approved'), + ('rep_reward_article', '100', 129, 'default: 100 - submitted an approved article/guide'), + ('rep_reward_user_suspended', '-200', 129, 'default: -200 - moderator revoked rights'), + ('user_max_votes', '50', 129, 'default: 50 - vote limit per day'), + ('rep_req_votemore_add', '250', 129, 'default: 250 - required reputation per additional vote past threshold'), + ('force_ssl', '0', 148, 'default: 0 - enforce SSL, if the server is behind a load balancer'), + ('cache_mode', '1', 161, 'default: 1 - set cache method - 0:filecache, 1:memcached'), + ('locales', '333', 161, 'default: 0x14D - allowed locales - 0:English, 2:French, 3:German, 6:Spanish, 8:Russian'), + ('account_create_save_decay', '604800', 129, 'default: 604800 - time in wich an unconfirmed account cannot be overwritten by new registrations'), + ('account_recovery_decay', '300', 129, 'default: 300 - time to recover your account and new recovery requests are blocked'), + ('serialize_precision', '4', 65, ' - some derelict code, probably unused'), + ('screenshot_min_size', '200', 129, 'default: 200 - minimum dimensions of uploaded screenshots in px (yes, it\'s square)'); +/*!40000 ALTER TABLE `aowow_config` ENABLE KEYS */; +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/static/css/aowow.css b/static/css/aowow.css index f89f4060..9d433663 100644 --- a/static/css/aowow.css +++ b/static/css/aowow.css @@ -129,10 +129,7 @@ h5 a.icontiny span { text-decoration:none !important; } .quote .quote, .quote .quote .quote .quote { background:#111; } .quote .quote .quote { background:#1b1b1b; } - -.quote .quote { - background:rgba(255,255,255,.065)!important; -} +.quote .quote { background:rgba(255,255,255,.065) !important; } .entryc .quote:after, .comment-body .quote:after, .text .quote:after, .text blockquote:after, @@ -1101,7 +1098,7 @@ Variations: .icon-report { padding-left: 16px !important; - background: url(../images/icons/report.gif) 3px center no-repeat; + background: url(../images/icons/report.png) no-repeat left center; } .icon-return { @@ -1124,6 +1121,11 @@ Variations: background: url(../images/icons/sticky.gif) no-repeat left center; } +.icon-tick { + padding-left:19px; + background: url(../images/icons/tick.png) no-repeat left center; +} + .icon-twitter { padding-left: 20px; background: url(../images/icons/twitter.gif) left center no-repeat; @@ -3694,7 +3696,7 @@ a#toplinks-language { background-repeat: no-repeat, no-repeat; } -/* the search.css is basicly empty without the styles for googleseach */ +/* the search.css is basicly empty without the styles for googlesearch */ .search-noresults { background:url(../images/search/noresults.jpg) left no-repeat; width:254px; diff --git a/static/images/icons/hearthstone-sm.png b/static/images/icons/hearthstone-sm.png deleted file mode 100644 index db9f0f3c..00000000 Binary files a/static/images/icons/hearthstone-sm.png and /dev/null differ diff --git a/static/js/staff.js b/static/js/staff.js index 03abc244..80a14bd0 100644 --- a/static/js/staff.js +++ b/static/js/staff.js @@ -1,69 +1,69 @@ var mn_content = [ - [22, 'Achievements', '?admin=achievements', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV | U_GROUP_BUREAU}], +// [22, 'Achievements', '?admin=achievements', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV | U_GROUP_BUREAU}], [3, 'Announcements', '?admin=announcements', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], - [25, 'Guides Awaiting Approval', '?admin=guides', null, {requiredAccess: U_GROUP_STAFF}], - [20, 'Global Images & Headers', '?admin=headers', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], - [21, 'Modelviewer', '?admin=modelviewer', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], +// [25, 'Guides Awaiting Approval', '?admin=guides', null, {requiredAccess: U_GROUP_STAFF}], +// [20, 'Global Images & Headers', '?admin=headers', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], +// [21, 'Modelviewer', '?admin=modelviewer', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], [23, 'Out of Date Comments', '?admin=out-of-date', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_MOD}], [5, 'Screenshots', '?admin=screenshots', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SCREENSHOT}], - [18, 'Upload Image', '?npc=15384#submit-a-screenshot', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_EDITOR, rel: 'np'}], +// [18, 'Upload Image', '?npc=15384#submit-a-screenshot', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_EDITOR, rel: 'np'}], [17, 'Videos', '?admin=videos', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO}], [, 'Homepage'], [13, 'Featured Box', '?admin=home-featuredbox', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU, breadcrumb: 'Homepage Featured Box'}], - [14, 'Oneliners', '?admin=home-oneliners', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU, breadcrumb: 'Homepage Oneliners'}], - [15, 'Skins', '?admin=home-skins', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SALESAGENT, breadcrumb: 'Homepage Skins'}], - [16, 'Titles', '?admin=home-titles', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU, breadcrumb: 'Homepage Titles'}], +// [14, 'Oneliners', '?admin=home-oneliners', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU, breadcrumb: 'Homepage Oneliners'}], +// [15, 'Skins', '?admin=home-skins', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SALESAGENT, breadcrumb: 'Homepage Skins'}], +// [16, 'Titles', '?admin=home-titles', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU, breadcrumb: 'Homepage Titles'}], - [, 'Articles'], - [8, 'List', '?admin=articles', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV | U_GROUP_EDITOR | U_GROUP_LOCALIZER, breadcrumb: 'List of Articles'}], - [9, 'Editors\' Lounge', '?admin=editors-lounge', null, {requiredAccess: U_GROUP_EMPLOYEE | U_GROUP_EDITOR | U_GROUP_LOCALIZER}], - [23, 'Related Links', '?admin=related-links', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], +// [, 'Articles'], +// [8, 'List', '?admin=articles', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV | U_GROUP_EDITOR | U_GROUP_LOCALIZER, breadcrumb: 'List of Articles'}], +// [9, 'Editors\' Lounge', '?admin=editors-lounge', null, {requiredAccess: U_GROUP_EMPLOYEE | U_GROUP_EDITOR | U_GROUP_LOCALIZER}], +// [23, 'Related Links', '?admin=related-links', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], - [, 'News'], - [10, 'New Post', '?edit=news', null, {requiredAccess: U_GROUP_EMPLOYEE | U_GROUP_BLOGGER, breadcrumb: 'News Post'}], - [11, 'Content Corner', '?admin=content-corner', null, {requiredAccess: U_GROUP_EMPLOYEE | U_GROUP_BLOGGER}], - [12, 'Tags', '?admin=newstag', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV | U_GROUP_BLOGGER, breadcrumb: 'News Tags'}], - [24, 'Patch Updates', '?admin=patch-updates', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], - [26, 'Featured Guides', '?admin=featuredguides', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU, breadcrumb: 'Featured Guides'}], +// [, 'News'], +// [10, 'New Post', '?edit=news', null, {requiredAccess: U_GROUP_EMPLOYEE | U_GROUP_BLOGGER, breadcrumb: 'News Post'}], +// [11, 'Content Corner', '?admin=content-corner', null, {requiredAccess: U_GROUP_EMPLOYEE | U_GROUP_BLOGGER}], +// [12, 'Tags', '?admin=newstag', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV | U_GROUP_BLOGGER, breadcrumb: 'News Tags'}], +// [24, 'Patch Updates', '?admin=patch-updates', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], +// [26, 'Featured Guides', '?admin=featuredguides', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU, breadcrumb: 'Featured Guides'}], - [, 'Community'], - [4, 'Contests', '?admin=contests', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SALESAGENT}], - [27, 'Top User Contest', '?admin=topuser-contest', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SALESAGENT}], - [19, 'Forums', '?admin=forums', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], - [6, 'Profanity Filter', '?admin=profanity', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], +// [, 'Community'], +// [4, 'Contests', '?admin=contests', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SALESAGENT}], +// [27, 'Top User Contest', '?admin=topuser-contest', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SALESAGENT}], +// [19, 'Forums', '?admin=forums', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], +// [6, 'Profanity Filter', '?admin=profanity', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}], - [, 'Other'], - [7, 'Holiday Gift Guide', '?admin=holidaygift', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}] +// [, 'Other'], +// [7, 'Holiday Gift Guide', '?admin=holidaygift', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU}] ]; var mn_dev = [ - [17, 'Cookies', '?admin=cookies', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [17, 'Cookies', '?admin=cookies', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], [21, 'PHP Information', '?admin=phpinfo', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], [18, 'Site Configuration', '?admin=siteconfig', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [16, 'Weight Presets', '?admin=weight-presets', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], - [22, 'API Keys', '?admin=apikey', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], +// [16, 'Weight Presets', '?admin=weight-presets', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], +// [22, 'API Keys', '?admin=apikey', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], - [, 'Cache'], - [2, 'Create Folders', '?admin=cache-folder', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Create Cache Folders'}], - [3, 'Expire Range', '?admin=cache-expire', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Expire Cache Range'}], - [1, 'Manage', '?admin=cache-manage', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Manage Cache'}], - [20, 'Memcached', '?admin=memcached', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Manage Memcached'}], +// [, 'Cache'], +// [2, 'Create Folders', '?admin=cache-folder', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Create Cache Folders'}], +// [3, 'Expire Range', '?admin=cache-expire', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Expire Cache Range'}], +// [1, 'Manage', '?admin=cache-manage', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Manage Cache'}], +// [20, 'Memcached', '?admin=memcached', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Manage Memcached'}], - [, 'Database'], - [8, 'Add Fake Item', '?admin=fakeitem', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [10, 'Add Fake NPC', '?admin=fakenpc', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [19, 'Check Consistency', '?admin=db-check-consistency', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Check Database Consistency'}], - [4, 'Execute SQL', '?admin=sql', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [9, 'Export Fake Item', '?admin=luaitem', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [26, 'Denormalized Fields Fix', '?admin=denormalized-fix', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [11, 'Minimum & Maximum Values', '?admin=minmax', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [7, 'SQL Find & Replace', '?admin=sql-replace', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [25, 'Switch Active Database', '?admin=active-db', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], - [5, 'Updates', '?admin=db-update', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Database Updates'}], +// [, 'Database'], +// [8, 'Add Fake Item', '?admin=fakeitem', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [10, 'Add Fake NPC', '?admin=fakenpc', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [19, 'Check Consistency', '?admin=db-check-consistency', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Check Database Consistency'}], +// [4, 'Execute SQL', '?admin=sql', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [9, 'Export Fake Item', '?admin=luaitem', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [26, 'Denormalized Fields Fix', '?admin=denormalized-fix', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [11, 'Minimum & Maximum Values', '?admin=minmax', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [7, 'SQL Find & Replace', '?admin=sql-replace', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [25, 'Switch Active Database', '?admin=active-db', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}], +// [5, 'Updates', '?admin=db-update', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV, breadcrumb: 'Database Updates'}], - [, 'Generators'], - [12, 'Talent Calculator Icons', '?admin=talentcalc-icons', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}] +// [, 'Generators'], +// [12, 'Talent Calculator Icons', '?admin=talentcalc-icons', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV}] ]; var mn_localization = [ @@ -103,10 +103,10 @@ var mn_users = [ var mn_staff = [ [1, 'Content', null, mn_content], [2, 'Development', null, mn_dev], - [3, 'Localization', null, mn_localization], - [7, 'Statistics', null, mn_statistics, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], - [4, 'Users', null, mn_users], - [5, 'View Reports', '?admin=reports', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_EDITOR | U_GROUP_MOD | U_GROUP_LOCALIZER | U_GROUP_SCREENSHOT | U_GROUP_VIDEO} ], +// [3, 'Localization', null, mn_localization], +// [7, 'Statistics', null, mn_statistics, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], +// [4, 'Users', null, mn_users], +// [5, 'View Reports', '?admin=reports', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_EDITOR | U_GROUP_MOD | U_GROUP_LOCALIZER | U_GROUP_SCREENSHOT | U_GROUP_VIDEO} ], [, 'Page'], [102, 'Validate', 'http://validator.w3.org/check/referer', null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV | U_GROUP_TESTER}]]; @@ -114,42 +114,42 @@ var mn_staff = [ mn_path.push([4, 'Staff', null, mn_staff]); $(document).ready(function () { - var f = $('div.stafffooter'); - if (f.length > 0) { - var g = $(window).height(); - if (f.offset().top < (g - 100)) { - var e = f.offset(); - e.top = g - 100; - f.offset(e) + var footer = $('div.stafffooter'); + if (footer.length > 0) { + var totalHeight = $(window).height(); + if (footer.offset().top < (totalHeight - 100)) { + var offset = footer.offset(); + offset.top = totalHeight - 100; + footer.offset(offset); } } - var a = U_GROUP_EMPLOYEE | U_GROUP_EDITOR | (Locale.getId() != LOCALE_ENUS ? U_GROUP_LOCALIZER : 0); - var j = $WH.g_getGets(); - var b; - var c = {}; - var h = null; - if (j.refresh != null) { - b = 'See Cached'; - c.refresh = null + var articleAccess = U_GROUP_EMPLOYEE | U_GROUP_EDITOR | (Locale.getId() != LOCALE_ENUS ? U_GROUP_LOCALIZER : 0); + var urlParams = $WH.g_getGets(); + var buff; + var refresh = {}; + var subMenu = null; + if (urlParams.refresh != null) { + buff = 'See Cached'; + refresh.refresh = null } else { - var k = {}; - var i = {}; - b = 'Refresh'; + var mCached = {}; + var fiCache = {}; + buff = 'Refresh'; if (PageTemplate.get('pageName') == 'home') { - c.home = ''; - k.home = ''; - i.home = '' + refresh.home = ''; + mCached.home = ''; + fiCache.home = '' } - c.refresh = ''; - k.refresh = 'memcached'; - i.refresh = 'filecache'; - h = [ - [1, 'Memcached', g_modifyUrl(location.href, k), null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], - [2, 'File cache', g_modifyUrl(location.href, i), null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}] + refresh.refresh = ''; + mCached.refresh = 'memcached'; + fiCache.refresh = 'filecache'; + subMenu = [ + [1, 'Memcached', g_modifyUrl(location.href, mCached), null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}], + [2, 'File cache', g_modifyUrl(location.href, fiCache), null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}] ] } - mn_staff.push([100, b, g_modifyUrl(location.href, c), h, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}]); + mn_staff.push([100, buff, g_modifyUrl(location.href, refresh), subMenu, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_DEV}]); if (location.href.match(/website-achievement=([0-9]+)(\/.*)?/i)) { mn_staff.push([, 'Achievement']); mn_staff.push([200, 'Manage', '?admin=achievements&action=edit&id=' + RegExp.$1, null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_DEV | U_GROUP_BUREAU}]) @@ -170,14 +170,14 @@ $(document).ready(function () { if ($WH.isset('g_pageInfo')) { if (g_pageInfo.type && g_pageInfo.typeId) { mn_staff.push([, 'DB Entry']); - mn_staff.push([1001, 'Edit Article', '?edit=article&type=' + g_pageInfo.type + '&typeid=' + g_pageInfo.typeId, null, {requiredAccess: a}]); +// mn_staff.push([1001, 'Edit Article', '?edit=article&type=' + g_pageInfo.type + '&typeid=' + g_pageInfo.typeId, null, {requiredAccess: articleAccess}]); mn_staff.push([1000, 'Manage Screenshots', '?admin=screenshots&type=' + g_pageInfo.type + '&typeid=' + g_pageInfo.typeId, null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SCREENSHOT}]); mn_staff.push([1000, 'Manage Videos', '?admin=videos&type=' + g_pageInfo.type + '&typeid=' + g_pageInfo.typeId, null, {requiredAccess: U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO}]) } if (g_pageInfo.articleUrl) { mn_staff.push([, 'Article']); - mn_staff.push([1002, 'Edit', '?edit=article&' + g_pageInfo.articleUrl, null, {requiredAccess: (g_pageInfo.editAccess ? g_pageInfo.editAccess: a)}]); - mn_staff.push([1003, 'Options', '?edit=article-options&url=' + g_pageInfo.articleUrl, null, {requiredAccess: a}]) + mn_staff.push([1002, 'Edit', '?edit=article&' + g_pageInfo.articleUrl, null, {requiredAccess: (g_pageInfo.editAccess ? g_pageInfo.editAccess: articleAccess)}]); + mn_staff.push([1003, 'Options', '?edit=article-options&url=' + g_pageInfo.articleUrl, null, {requiredAccess: articleAccess}]) } } Menu.sort(mn_staff) @@ -292,11 +292,10 @@ var TwigProfiler = new function () { var tbl = $('#footer-twig-table'); for (var i = 0; i < len; ++i) { tbl.append($('') - .append($('', { css: { 'white-space': 'nowrap', 'text-align': 'right' }, 'class': 'q2', text: rows[i].action })) - .append($('', { css: { 'white-space': 'nowrap' } }) - .append($('', { text: rows[i].name })) - .append($('', { css: { 'white-space': 'nowrap' } }) - .append($('', { text: rows[i].time }))))); + .append($('', {css: {'white-space': 'nowrap', 'text-align': 'right'}, 'class': 'q2', text: rows[i].action} )) + .append($('', {css: {'white-space': 'nowrap'}} ).append($('', {text: rows[i].name} ))) + .append($('', {css: {'white-space': 'nowrap'}} ).append($('', {text: rows[i].time} ))) + ); } } };