public function generate() { $item = $this->getItem(); if ($item->getIndex() === null || $item->getSection() === null) { return str_repeat('F', Config::get('item.size', 20)); } $hex = ''; $hex .= $this->_generateByte1(); $hex .= $this->_generateByte2(); $hex .= $this->_generateByte3(); $hex .= $this->_generateByte4to7(); $hex .= $this->_generateByte8(); if (MuVersion::is(MuVersion::V97)) { $hex .= '0000'; } else { if (MuVersion::is(MuVersion::V100)) { $hex .= $this->_generateByte9(); $hex .= '00'; } else { $hex .= $this->_generateByte9(); $hex .= $this->_generateByte10(); $hex .= $this->_generateByte11(); $hex .= $this->_generateByte12to16(); } } return strtoupper($hex); }
public function fetch($template, $data = null) { $app = Application::getInstance(); if ($this->_defaultDir === null) { $this->_defaultDir = $this->templatesDirectory; } $layout = $this->getLayout($data); if (strpos($template, '.') !== false) { $parts = explode('.', $template); $plugin = $parts[0]; $active = Plugin::isActive($plugin); if ($active) { $template = join('.', array_slice($parts, 1)); $this->templatesDirectory = Config::get('path.plugins') . DS . $plugin . DS . 'src' . DS . ($app->inAdmin() ? 'admin' . DS : '') . 'views' . DS; } } else { $this->templatesDirectory = $this->_defaultDir; } $result = $this->render($template . '.php', $data); if (!$app->request()->isAjax() && is_string($layout)) { $this->templatesDirectory = $this->_defaultDir; $result = $this->renderLayout($layout, $result, $data); } return $result; }
public static function autoload($loader) { $instance = static::getInstance(); foreach ($instance->getPlugins() as $plugin) { $loader->addPsr4($plugin . '\\', Config::get('path.plugins') . $plugin . DS . 'src' . DS . 'lib', true); } }
public static function vipName($code) { $vips = Config::get('vip.types', []); if (isset($vips[$code])) { return $vips[$code]; } return ''; }
public function redirect($url, $status = 302) { if (filter_var($url, FILTER_VALIDATE_URL) === false) { parent::redirect((Config::get('url_rewrite', true) ? '' : '/index.php') . $url, $status); } else { parent::redirect($url, $status); } }
public function setMessageFromTemplate($file, $data) { $smarty = new \Smarty(); $vars = ['template_dir' => Config::get('path.templates') . 'mail/', 'compile_dir' => Config::get('path.cache') . 'smarty/', 'cache_dir' => Config::get('path.cache')]; foreach ($vars as $name => $value) { $smarty->{$name} = $value; } foreach ($data as $key => $value) { $smarty->assign($key, $value); } $smarty->assign('content', $smarty->fetch($file . '.html')); $this->Body = $smarty->fetch('layout.html'); return $this; }
public static function getAllServices() { $instance = static::getInstance(); if (empty($instance->_services)) { foreach (DriverManager::getConnection()->fetchAll('SELECT * from mw_services order by sequence') as $service) { $types = Config::get('vip.types'); $viptypes = []; foreach (DriverManager::getConnection()->fetchAll('SELECT * from mw_viptype_services where service_id = :service_id', ['service_id' => $service['id']]) as $viptype) { $viptypes[] = $types[$viptype['viptype']]; } $instance->_services[$service['service']] = array_merge($service, ['viptypes' => $viptypes]); } } return $instance->_services; }
public function generate() { $temp = []; for ($y = 0; $y < $this->getHeight(); $y++) { for ($x = 0; $x < $this->getWidth(); $x++) { $item = $this->getItem($x, $y); if ($item == null) { $temp[] = str_repeat('f', Config::get('item.size', 20)); } else { $temp[] = $item->generate(); } } } return join('', $temp); }
public function isHexEmpty() { return strtoupper($this->getHex()) === str_repeat('F', Config::get('item.size', 20)) || $this->getHex() === str_repeat('0', Config::get('item.size', 20)); }
public function update() { if ($this->getUsername() != null) { DriverManager::getConnection()->transactional(function () { DriverManager::getConnection()->update('MEMB_INFO', ['memb__pwd' => $this->getUsername(), 'memb_name' => $this->getName(), 'sno__numb' => $this->getPersonalId(), 'tel__numb' => $this->getPhone(), 'phon_numb' => $this->getPhone(), 'mail_addr' => $this->getEmail(), 'mail_chek' => $this->isConfirmedEmail(), 'fpas_ques' => $this->getSecretQuestion(), 'fpas_answ' => $this->getSecretAnswer(), 'bloc_code' => $this->isBlocked(), Config::get('credit.column') => $this->getCredit(), Config::get('vip.column_type') => $this->getVipType(), Config::get('vip.column_expire') => $this->getVipExpire()], ['memb___id' => $this->getUsername()], ['string', 'string', 'string', 'string', 'string', 'string', 'integer', 'string', 'string', 'integer', 'float', 'integer', 'datetime']); $this->_saveCoins(); }); } }
public static function className($class) { $map = Config::get('characters.classes', []); return isset($map[$class]) ? $map[$class] : '-'; }