Esempio n. 1
0
            $module_url = 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/' . Config::getSafe('portal_url', '/stalker_portal/') . 'server/api/ext_module.php?name=' . $module;
            echo file_get_contents($module_url);
        } else {
            $file = PROJECT_PATH . '/../c/' . $module . '.js';
            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)) {
 foreach ($f_cont as $cont_str) {
     list($ls, $macs, $ch) = explode(",", $cont_str);
     $macs_arr = explode(";", $macs);
     $ch = trim($ch);
     $ls = trim($ls);
     foreach ($macs_arr as $mac) {
         if (preg_match("/[а-я,А-Я]/", $mac)) {
             _log('mac "' . $mac . '", ЛС ' . $ls . ' содержит русские буквы ');
         }
         if (strpos($mac, 'ts') !== false) {
             $mac = str_replace('ts', '', $mac);
             $ch = '00203';
         }
         $mac = Middleware::normalizeMac($mac);
         if (@array_key_exists($mac, $stb_id_map)) {
             $stb = Stb::getByMac($mac);
             $status = $stb['status'];
             if ($status == 1 && $update_status) {
                 Mysql::getInstance()->update('users', array('status' => 0, 'last_change_status' => 'NOW()'), array('mac' => $mac));
                 $event = new SysEvent();
                 $event->setUserListByMac($mac);
                 $event->sendCutOn();
                 $cut_on++;
             }
             $stb_id = $stb_id_map[$mac];
             $stb_id_arr[] = $stb_id;
             if (array_key_exists($ch, $service_id_map)) {
                 if (!@array_key_exists($stb_id, $result)) {
                     $result[$stb_id] = array();
                 }
                 $result[$stb_id][] = intval($service_id_map[$ch]);
 private function checkLoginAndMac($params)
 {
     if (empty($params['login'])) {
         throw new SoapMissingRequiredParam();
     }
     if (!empty($params['stb_mac'])) {
         $params['stb_mac'] = \Middleware::normalizeMac($params['stb_mac']);
         if (empty($params['stb_mac'])) {
             throw new SoapWrongMacFormat(__METHOD__, __FILE__ . ':' . __FILE__);
         }
         $user = \User::getByLogin($params['login']);
         if (empty($user) || $user->getMac() != $params['stb_mac']) {
             $stb = \Stb::getByMac($params['stb_mac']);
             if (!empty($stb)) {
                 throw new SoapMacAddressInUse(__METHOD__, __FILE__ . ':' . __FILE__);
             }
         }
     }
 }