public function set_current_theme() { if (!$this->isAjax || $this->method != 'POST' || empty($this->postData['themename'])) { $this->app->abort(404, 'Page not found...'); } if ($no_auth = $this->checkAuth()) { return $no_auth; } $data = array(); $data['action'] = 'manageTheme'; $error = $this->setlocalization('There is no such skin'); $data['name'] = $data['title'] = $data['preview'] = ''; $themes = \Middleware::getThemes(); if (!empty($themes) && in_array($this->postData['themename'], $themes)) { $this->db->setCurrentTheme($this->postData['themename']); $error = ''; $event = new \SysEvent(); $event->setUserListByMac('online'); $event->sendReboot(); $data['name'] = $this->postData['themename']; $data['title'] = ucwords(str_replace('_', ' ', $this->postData['themename'])); $data['preview'] = $this->theme_path . $this->postData['themename'] . "/preview.png"; } $response = $this->generateAjaxResponse($data, $error); return new Response(json_encode($response), empty($error) ? 200 : 500); }
private function filter($profile) { if (empty($profile)) { throw new RESTNotFound("User not found"); } $profile = array_intersect_key($profile, $this->fields_map); $themes = \Middleware::getThemes(); $profile['theme'] = empty($profile['theme']) || !array_key_exists($profile['theme'], $themes) ? \Mysql::getInstance()->from('settings')->get()->first('default_template') : $profile['theme']; $profile['themes'] = $themes; return $profile; }
public function getUserPortalTheme() { return empty($this->params['theme']) || !array_key_exists($this->params['theme'], Middleware::getThemes()) ? Mysql::getInstance()->from('settings')->get()->first('default_template') : $this->params['theme']; }
private function buildUserForm(&$data = array(), $edit = FALSE) { $builder = $this->app['form.factory']; $additional_services = array(0 => $this->setLocalization('off'), 1 => $this->setLocalization('on')); $status = array(1 => $this->setLocalization('off'), 0 => $this->setLocalization('on')); $stb_groups = new \StbGroup(); $all_groups = $stb_groups->getAll(); $group_keys = $this->getFieldFromArray($all_groups, 'id'); $group_names = $this->getFieldFromArray($all_groups, 'name'); if (is_array($group_keys) && is_array($group_names) && count($group_keys) == count($group_names) && count($group_keys) > 0) { $all_groups = array_combine($group_keys, $group_names); } else { $all_groups = array(NULL); } if (!empty($data['id'])) { $tmp = $stb_groups->getMemberByUid($data['id']); if (!empty($tmp)) { $data['group_id'] = $tmp['stb_group_id']; } $tmp = $this->db->getUserFavItv($data['id']); if (!empty($tmp)) { $tmp = unserialize(base64_decode($tmp)); $data['fav_itv'] = is_array($tmp) ? count($tmp) : 0; $data['fav_itv_on'] = $data['fav_itv'] ? 1 : 0; } else { $data['fav_itv'] = 0; $data['fav_itv_on'] = 0; } $data['version'] = str_replace("; ", ";", $data['version']); $data['version'] = str_replace(";", ";\r\n", $data['version']); } if ($this->app['tarifPlanFlag']) { $tarif_plans = $this->db->getAllTariffPlans(); $plan_keys = $this->getFieldFromArray($tarif_plans, 'id'); $plan_names = $this->getFieldFromArray($tarif_plans, 'name'); if (is_array($plan_keys) && is_array($plan_names) && count($plan_keys) == count($plan_names) && count($plan_keys) > 0) { $tariff_plans = array_combine($plan_keys, $plan_names); if (!array_key_exists(0, $tariff_plans)) { $tariff_plans[0] = '---'; } } else { $tariff_plans = array(NULL); } if (!empty($data) && is_array($data) && array_key_exists('tariff_plan_id', $data) && (int) $data['tariff_plan_id'] == 0) { $user_default = array_filter(array_combine($plan_keys, $this->getFieldFromArray($tarif_plans, 'user_default'))); reset($user_default); list($default_id) = each($user_default); if (!empty($default_id)) { settype($default_id, 'int'); if (array_key_exists($default_id, $tariff_plans)) { $data['tariff_plan_id'] = $default_id; $data['tariff_plan_name'] = $tariff_plans[$default_id]; } } } } if (empty($this->app['reseller'])) { $resellers = array(array('id' => '-', 'name' => $this->setLocalization('Empty'))); $resellers = array_merge($resellers, $this->db->getAllFromTable('reseller')); $resellers = array_combine($this->getFieldFromArray($resellers, 'id'), $this->getFieldFromArray($resellers, 'name')); if (empty($data['reseller_id'])) { $data['reseller_id'] = '-'; } } $all_themes = \Middleware::getThemes(); $themes = array(); foreach ($all_themes as $alias => $theme) { $themes[$alias] = $alias; } $form = $builder->createBuilder('form', $data)->add('id', 'hidden')->add('fname', 'text', array('required' => FALSE))->add('login', 'text', $this->getAddUserFormParam($edit))->add('password', 'password', array('required' => FALSE))->add('phone', 'text', array('required' => FALSE))->add('ls', 'text', array('required' => FALSE))->add('group_id', 'choice', array('choices' => $all_groups, 'data' => !empty($data['group_id']) ? $data['group_id'] : NULL, 'required' => FALSE))->add('mac', 'text', $edit ? array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE) : array('required' => FALSE))->add('status', 'choice', array('choices' => $status, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($status)))), 'required' => FALSE))->add('theme', 'choice', array('choices' => $themes, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($themes)))), 'required' => FALSE))->add('comment', 'textarea', array('required' => FALSE))->add('save', 'submit'); // ->add('reset', 'reset'); if (!empty($data['id'])) { $form->add('ip', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('parent_password', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('settings_password', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('fav_itv', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('version', 'textarea', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('account_balance', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('video_out', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE)); } if ($this->app['tarifPlanFlag']) { $form->add('tariff_plan_id', 'choice', array('choices' => $tariff_plans, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($tariff_plans)))), 'required' => FALSE)); } else { $form->add('additional_services_on', 'choice', array('choices' => $additional_services, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($additional_services)))), 'required' => FALSE)); } if (\Config::getSafe('enable_internal_billing', 'false')) { $form->add('expire_billing_date', 'text', array('required' => FALSE)); } if (empty($this->app['reseller'])) { $form->add('reseller_id', 'choice', array('choices' => $resellers, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($resellers)))), 'required' => FALSE)); } return $form->getForm(); }
if (file_exists($file)) { readfile($file); } } } } elseif (strpos($_GET['type'], '.css') !== false) { if (preg_match('/_(\\d+)\\.css/', $_GET['type'], $match)) { $resolution_prefix = '_' . $match[1]; } else { $resolution_prefix = ''; } $user = Stb::getByMac($mac); if (empty($user)) { return false; } $theme = empty($user['theme']) || !array_key_exists($user['theme'], Middleware::getThemes()) ? Mysql::getInstance()->from('settings')->get()->first('default_template') : $user['theme']; $path = Config::getSafe('portal_url', '/stalker_portal/'); ob_start(function ($buffer) use($resolution_prefix, $theme, $path) { return str_replace(array('i' . $resolution_prefix . '/', 'i/', 'fonts/'), array($path . 'c/template/' . $theme . '/i' . $resolution_prefix . '/', $path . 'c/template/' . $theme . '/i/', $path . 'c/template/' . $theme . '/fonts/'), $buffer); }); header("Content-Type: text/css"); foreach ($available_modules as $module) { if (strpos($module, 'external_') === 0) { continue; } $file = PROJECT_PATH . '/../c/template/' . $theme . '/' . $module . $resolution_prefix . '.css'; if (file_exists($file)) { readfile($file); } } }
<?php session_start(); ob_start(); include "./common.php"; $error = ''; Admin::checkAuth(); Admin::checkAccess(AdminAccess::ACCESS_VIEW); $default_template = Mysql::getInstance()->from('settings')->get()->first('default_template'); if (!empty($_POST['template'])) { Admin::checkAccess(AdminAccess::ACCESS_EDIT); Mysql::getInstance()->update('settings', array('default_template' => $_POST['template'])); header("Location: themes.php"); exit; } $themes = Middleware::getThemes(); if (!empty($themes[$default_template])) { $current_theme = $themes[$default_template]; } else { $current_theme = array('name' => ucwords(str_replace('_', ' ', $default_template)), 'preview' => "../../c/template/" . $default_template . "/preview.png"); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> body { font-family: Arial, Helvetica, sans-serif; font-weight: bold; }