reqUGroup = U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_SCREENSHOT; $this->generator = 'handleScreenshots'; $this->tpl = 'admin/screenshots'; array_push($this->path, 1, 5); $this->name = 'Screenshot Manager'; break; case 'phpinfo': $this->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 = 'admin/siteconfig'; array_push($this->path, 2, 18); $this->name = 'Site Configuration'; break; case 'weight-presets': $this->reqUGroup = U_GROUP_ADMIN | U_GROUP_DEV | U_GROUP_BUREAU; $this->generator = 'handleWeightPresets'; $this->tpl = 'admin/weight-presets'; array_push($this->path, 2, 16); $this->name = 'Weight Presets'; 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\'], .grid input[type=\'number\'] { width:250px; text-align:left; }'], ['string' => '.grid input[type=\'button\'] { width:65px; padding:2px; }'], ['string' => '.grid a.tip { margin:0px 5px; opacity:0.8; }'], ['string' => '.grid a.tip:hover { opacity:1; }'], ['string' => '.grid tr { height:30px; }'], ['string' => '.grid .disabled { opacity:0.4 !important; }'], ['string' => '.grid .status { position:absolute; right:5px; }'], )); $head = ''; $mainTab = []; $miscTab = []; foreach (Util::$configCats as $idx => $catName) { if ($rows = DB::Aowow()->select('SELECT * FROM ?_config WHERE cat = ?d ORDER BY `flags` DESC, `key` ASC', $idx)) { $buff = $head; foreach ($rows as $r) $buff .= $this->configAddRow($r); if (!$idx) //cat: misc $buff .= ''; $buff .= '
KeyValueOptions
new configuration
'; if ($idx) $mainTab[$catName] = $buff; else $miscTab[$catName] = $buff; } } foreach ($mainTab as $n => $t) $this->lvTabs[] = [null, array( 'data' => $t, 'name' => $n, 'id' => Profiler::urlize($n) )]; foreach ($miscTab as $n => $t) $this->lvTabs[] = [null, array( 'data' => $t, 'name' => $n, 'id' => Profiler::urlize($n) )]; } 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[] = [null, array( 'data' => $body, 'id' => strtolower(strtr($name, [' ' => ''])), 'name' => $name )]; } } else { $this->lvTabs[] = [null, array( 'data' => $buff, 'id' => strtolower($names[$i]), 'name' => $names[$i] )]; } } } private function handleScreenshots() { $this->addJS('screenshot.js'); $this->addCSS(array( ['string' => '.layout {margin: 0px 25px; max-width: inherit; min-width: 1200px; }'], ['string' => '#highlightedRow { background-color: #322C1C; }'] )); $ssGetAll = isset($_GET['all']) && empty($_GET['all']); $ssPages = []; $ssData = []; $nMatches = 0; if (!empty($_GET['type']) && !empty($_GET['typeid'])) { $ssData = CommunityContent::getScreenshotsForManager(intVal($_GET['type']), intVal($_GET['typeid'])); $nMatches = count($ssData); } else if (!empty($_GET['user'])) { $name = urldecode($_GET['user']); if (mb_strlen($name) >= 3) { if ($uId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE displayName = ?', ucFirst($name))) { $ssData = CommunityContent::getScreenshotsForManager(0, 0, $uId); $nMatches = count($ssData); } } } else $ssPages = CommunityContent::getScreenshotPagesForManager($ssGetAll, $nMatches); $this->getAll = $ssGetAll; $this->ssPages = $ssPages; $this->ssData = $ssData; $this->ssNFound = $nMatches; // ssm_numPagesFound } private function handleWeightPresets() { $this->addCSS(['string' => '.wt-edit {display:inline-block; vertical-align:top; width:350px;}']); $this->addJS('filters.js'); $head = $body = ''; $scales = DB::Aowow()->select('SELECT class AS ARRAY_KEY, id AS ARRAY_KEY2, name, icon FROM ?_account_weightscales WHERE userId = 0'); $weights = DB::Aowow()->selectCol('SELECT awd.id AS ARRAY_KEY, awd.field AS ARRAY_KEY2, awd.val FROM ?_account_weightscale_data awd JOIN ?_account_weightscales ad ON awd.id = ad.id WHERE ad.userId = 0'); foreach ($scales as $cl => $data) { $ul = ''; foreach ($data as $id => $s) { $weights[$id]['__icon'] = $s['icon']; $ul .= '[url=# onclick="loadScale.bind(this, '.$id.')();"]'.$s['name'].'[/url][br]'; } $head .= '[td=header]'.Lang::game('cl', $cl).'[/td]'; $body .= '[td valign=top]'.$ul.'[/td]'; } $this->extraText = '[table class=grid][tr]'.$head.'[/tr][tr]'.$body.'[/tr][/table]'; $this->extraHTML = '\n\n"; } private function configAddRow($r) { $buff = ''; $info = explode(' - ', $r['comment']); $key = $r['flags'] & CON_FLAG_PHP ? strtolower($r['key']) : 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_PERSISTENT)) $buff .= '|'; $buff .= ''; return $buff; } protected function generateTitle() {} protected function generatePath() {} } ?>