当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::exist方法代码示例

本文整理汇总了PHP中Config::exist方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::exist方法的具体用法?PHP Config::exist怎么用?PHP Config::exist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Config的用法示例。


在下文中一共展示了Config::exist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unsubscribeFromPackage

 public function unsubscribeFromPackage($ext_package_id)
 {
     if (!Config::exist('on_unsubscribe_hook_url')) {
         return true;
     }
     return $this->onSubscriptionHookResult('on_unsubscribe_hook_url', $ext_package_id);
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:7,代码来源:simpleosswrapper.class.php

示例2: getConnectionForRead

 private function getConnectionForRead()
 {
     if (!Config::exist('read_mysql_host')) {
         $this->links['read'] = $this->getConnectionForWrite();
     } elseif (!isset($this->links['read'])) {
         $this->links['read'] = $this->getConnection(Config::get('read_mysql_host'), Config::getSafe('read_mysql_port', 3306), Config::get('read_mysql_user'), Config::get('read_mysql_pass'), Config::get('read_db_name'));
     }
     return $this->links['read'];
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:9,代码来源:mysql.class.php

示例3: __construct

 public function __construct()
 {
     if (Config::exist('http_proxy')) {
         $this->context_params['http']['proxy'] = Config::get('http_proxy');
         $this->context_params['http']['request_fulluri'] = true;
         if (Config::exist('http_proxy_login') && Config::exist('http_proxy_password')) {
             $this->context_params['http']['header'] = "Proxy-Authorization: Basic " . base64_encode(Config::get('http_proxy_login') . ":" . Config::get('http_proxy_password')) . "\r\n";
         }
     }
     $this->cache_table = strtolower(get_called_class()) . '_cache';
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:11,代码来源:weatherprovider.class.php

示例4: filterDocument

 public function filterDocument($document)
 {
     if (empty($document)) {
         throw new RESTNotFound("Document not found");
     }
     $document = array_intersect_key($document, $this->fields_map);
     $document['account'] = $document['ls'];
     unset($document['ls']);
     $document['logo'] = \Config::exist('portal_logo_url') ? \Config::get('portal_logo_url') : null;
     if (is_readable(realpath(PROJECT_PATH . '/../new/launcher/img/1080/bg.jpg'))) {
         $document['background'] = \Config::getSafe('portal_url', '/stalker_portal/') . 'new/launcher/img/1080/bg.jpg';
     } else {
         $document['background'] = null;
     }
     return $document;
 }
开发者ID:nowaym,项目名称:stalker_portal,代码行数:16,代码来源:restapiusersdocument.class.php

示例5: setChannelLinkStatus

 public static function setChannelLinkStatus($link_id, $status)
 {
     if (strpos($link_id, 's') === 0) {
         // stream balanser monitoring
         $balanser_link_id = substr($link_id, 1);
         Mysql::getInstance()->update('ch_link_on_streamer', array('monitoring_status' => $status), array('id' => $balanser_link_id));
         $balanser_link = Mysql::getInstance()->from('ch_link_on_streamer')->where(array('id' => $balanser_link_id))->get()->first();
         if (empty($balanser_link)) {
             return false;
         }
         $link = Mysql::getInstance()->from('ch_links')->where(array('id' => $balanser_link['link_id']))->get()->first();
         if (empty($link)) {
             return false;
         }
         if ($status == 0) {
             $other_good_balanser_links = Mysql::getInstance()->from('ch_link_on_streamer')->where(array('link_id' => $link['id'], 'id!=' => $balanser_link_id, 'monitoring_status' => 1))->get()->all();
             if (empty($other_good_balanser_links)) {
                 Mysql::getInstance()->update('ch_links', array('status' => $status), array('id' => $link['id']));
             }
         } else {
             Mysql::getInstance()->update('ch_links', array('status' => $status), array('id' => $link['id']));
         }
         $ch_id = $link['ch_id'];
     } else {
         Mysql::getInstance()->update('ch_links', array('status' => $status), array('id' => $link_id));
         $ch_id = (int) Mysql::getInstance()->from('ch_links')->where(array('id' => $link_id))->get()->first('ch_id');
     }
     $channel = Mysql::getInstance()->from('itv')->where(array('id' => $ch_id))->get()->first();
     if (empty($channel)) {
         return false;
     }
     $good_links = Mysql::getInstance()->from('ch_links')->where(array('ch_id' => $ch_id, 'status' => 1))->get()->all();
     if (!empty($good_links) && $channel['monitoring_status'] == 0) {
         Mysql::getInstance()->update('itv', array('monitoring_status' => 1), array('id' => $ch_id));
         if (Config::exist('administrator_email')) {
             $message = sprintf(_("Channel %s set to active because at least one of its URLs became available."), $channel['number'] . ' ' . $channel['name']);
             mail(Config::get('administrator_email'), 'Channels monitoring report: channel enabled', $message, "Content-type: text/html; charset=UTF-8\r\n");
         }
     } else {
         if (empty($good_links) && $channel['monitoring_status'] == 1) {
             Mysql::getInstance()->update('itv', array('monitoring_status' => 0), array('id' => $ch_id));
             if (Config::exist('administrator_email')) {
                 $message = sprintf(_('Channel %s set to inactive because all its URLs are not available.'), $channel['number'] . ' ' . $channel['name']);
                 mail(Config::get('administrator_email'), 'Channels monitoring report: channel disabled', $message, "Content-type: text/html; charset=UTF-8\r\n");
             }
         }
     }
     return Mysql::getInstance()->update('itv', array('monitoring_status_updated' => 'NOW()'), array('id' => $ch_id))->result();
 }
开发者ID:saydulk,项目名称:stalker_portal,代码行数:49,代码来源:itv.class.php

示例6: getInfoById

 public static function getInfoById($id)
 {
     $movie_info = array('kinopoisk_id' => $id);
     $movie_url = 'http://www.kinopoisk.ru/film/' . $id . '/';
     $movie_info['kinopoisk_url'] = $movie_url;
     $movie_info['cover'] = 'http://st.kinopoisk.ru/images/film/' . $id . '.jpg';
     $cover_big_url = 'http://st.kinopoisk.ru/images/film_big/' . $id . '.jpg';
     $big_cover_headers = get_headers($cover_big_url, 1);
     if ($big_cover_headers !== false) {
         if (strpos($big_cover_headers[0], '302') !== false && !empty($big_cover_headers['Location'])) {
             $movie_info['cover_big'] = $big_cover_headers['Location'];
         } else {
             $movie_info['cover_big'] = $cover_big_url;
         }
     }
     $ch = curl_init();
     $curl_options = array(CURLOPT_URL => $movie_url, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array('Connection: keep-alive', 'Cache-Control: no-cache', 'Pragma: no-cache', 'User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5', 'Accept: text/css,*/*;q=0.1', 'Accept-Encoding: deflate,sdch', 'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4', 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.3'));
     if (Config::exist('http_proxy')) {
         $curl_options[CURLOPT_PROXY] = str_replace('tcp://', '', Config::get('http_proxy'));
         if (Config::exist('http_proxy_login') && Config::exist('http_proxy_password')) {
             $curl_options[CURLOPT_PROXYUSERPWD] = Config::get('http_proxy_login') . ":" . Config::get('http_proxy_password');
         }
     }
     curl_setopt_array($ch, $curl_options);
     $page = curl_exec($ch);
     curl_close($ch);
     //var_dump($page);
     libxml_use_internal_errors(true);
     $dom = new DomDocument();
     $dom->loadHTML($page);
     libxml_use_internal_errors(false);
     $xpath = new DomXPath($dom);
     // Translated name
     $node_list = $xpath->query('//*[@id="headerFilm"]/h1');
     if ($node_list !== false && $node_list->length != 0) {
         $movie_info['name'] = self::getNodeText($node_list->item(0));
     }
     if (empty($movie_info['name'])) {
         throw new KinopoiskException("Movie name in '" . $movie_url . "' not found", $page);
     }
     // Original name
     $node_list = $xpath->query(".//*[@id='headerFilm']/span");
     if ($node_list !== false && $node_list->length != 0) {
         $movie_info['o_name'] = self::getNodeText($node_list->item(0));
     }
     if (empty($movie_info['o_name'])) {
         $movie_info['o_name'] = $movie_info['name'];
     }
     // Year
     $node_list = $xpath->query('//*[@id="infoTable"]/table/tr[1]/td[2]/div/a');
     if ($node_list !== false && $node_list->length != 0) {
         $movie_info['year'] = self::getNodeText($node_list->item(0));
     }
     // Country
     $node_list = $xpath->query('//*[@id="infoTable"]/table/tr[2]/td[2]/div');
     if ($node_list !== false && $node_list->length != 0) {
         $movie_info['country'] = self::getNodeText($node_list->item(0));
     }
     // Duration
     $node_list = $xpath->query('//*[@id="runtime"]');
     if ($node_list !== false && $node_list->length != 0) {
         $movie_info['duration'] = (int) self::getNodeText($node_list->item(0));
     }
     // Director
     $node_list = $xpath->query('//*[@id="infoTable"]/table/tr[4]/td[2]/a');
     if ($node_list !== false && $node_list->length != 0) {
         $movie_info['director'] = self::getNodeText($node_list->item(0));
     }
     // Actors
     $node_list = $xpath->query('//*[@id="actorList"]/ul[1]/li');
     if ($node_list !== false && $node_list->length != 0) {
         $actors = array();
         foreach ($node_list as $node) {
             $actors[] = self::getNodeText($node);
         }
         if ($actors[count($actors) - 1] == '...') {
             unset($actors[count($actors) - 1]);
         }
         $movie_info['actors'] = implode(", ", $actors);
     }
     // Description
     //$node_list = $xpath->query('//*[@id="syn"]/tr[1]/td/table/tr[1]/td');
     $node_list = $xpath->query('//div[@itemprop="description"]');
     if ($node_list !== false && $node_list->length != 0) {
         $movie_info['description'] = self::getNodeText($node_list->item(0));
     }
     // Age limit
     $node_list = $xpath->query('//div[contains(@class, "ageLimit")]');
     if ($node_list !== false && $node_list->length != 0) {
         $class = $node_list->item(0)->attributes->getNamedItem('class')->nodeValue;
         $movie_info['age'] = substr($class, strrpos($class, 'age') + 3);
         if ($movie_info['age']) {
             $movie_info['age'] .= '+';
         }
     }
     // Rating MPAA
     $node_list = $xpath->query('//td[contains(@class, "rate_")]');
     if ($node_list !== false && $node_list->length != 0) {
         $class = $node_list->item(0)->attributes->getNamedItem('class')->nodeValue;
         $movie_info['rating_mpaa'] = strtoupper(substr($class, 5));
//.........这里部分代码省略.........
开发者ID:riderby,项目名称:video-portal,代码行数:101,代码来源:kinopoisk.class.php

示例7: getInfoByName

 public static function getInfoByName($orig_name)
 {
     if (empty($orig_name)) {
         return false;
     }
     $ch = curl_init();
     if ($ch === false) {
         throw new KinopoiskException("Curl initialization error", curl_error($ch));
     }
     $orig_name = iconv("utf-8", "windows-1251", $orig_name);
     $orig_name = urlencode($orig_name);
     $search_url = 'http://www.kinopoisk.ru/index.php?level=7&from=forma&result=adv&m_act[from]=forma&m_act[what]=content&m_act[find]=' . $orig_name . '&m_act[content_find]=film,serial&first=yes';
     $curl_options = array(CURLOPT_URL => $search_url, CURLOPT_HEADER => 1, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array('Connection: keep-alive', 'Cache-Control: no-cache', 'Pragma: no-cache', 'User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5', 'Accept: text/css,*/*;q=0.1', 'Accept-Encoding: gzip,deflate,sdch', 'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4', 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.3'));
     if (Config::exist('http_proxy')) {
         $curl_options[CURLOPT_PROXY] = str_replace('tcp://', '', Config::get('http_proxy'));
         if (Config::exist('http_proxy_login') && Config::exist('http_proxy_password')) {
             $curl_options[CURLOPT_PROXYUSERPWD] = Config::get('http_proxy_login') . ":" . Config::get('http_proxy_password');
         }
     }
     curl_setopt_array($ch, $curl_options);
     $response = curl_exec($ch);
     curl_close($ch);
     if ($response === false) {
         throw new KinopoiskException("Curl exec failure", curl_error($ch));
     }
     if (preg_match("/Location: ([^\\s]*)/", $response, $match)) {
         $location = $match[1];
     }
     if (empty($location)) {
         throw new KinopoiskException("Empty location header", $response);
     }
     if (strpos($location, 'http') === 0) {
         throw new KinopoiskException("Wrong location header. Location: ('" . $location . "')", $response);
     }
     if (preg_match("/\\/([\\d]*)\\/\$/", $location, $match)) {
         $movie_id = $match[1];
     } else {
         throw new KinopoiskException("Location does not contain movie id. Location: ('" . $location . "')", $response);
     }
     return self::getInfoById($movie_id);
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:41,代码来源:kinopoisk.class.php

示例8: getInfoByName

 public static function getInfoByName($orig_name)
 {
     if (empty($orig_name)) {
         return false;
     }
     $ch = curl_init();
     if ($ch === false) {
         throw new tmdbException("Curl initialization error", curl_error($ch));
     }
     $orig_name = iconv("utf-8", "windows-1251", $orig_name);
     $orig_name = urlencode($orig_name);
     $lang = self::getLanguage();
     $search_url = 'http://api.themoviedb.org/3/search/movie?query=' . $orig_name . '&api_key=' . Config::get('tmdb_api_key') . "&language={$lang}&include_image_language={$lang}";
     $curl_options = array(CURLOPT_URL => $search_url, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array('Connection: keep-alive', 'Cache-Control: no-cache', 'Pragma: no-cache', 'Accept: application/json'));
     if (Config::exist('http_proxy')) {
         $curl_options[CURLOPT_PROXY] = str_replace('tcp://', '', Config::get('http_proxy'));
         if (Config::exist('http_proxy_login') && Config::exist('http_proxy_password')) {
             $curl_options[CURLOPT_PROXYUSERPWD] = Config::get('http_proxy_login') . ":" . Config::get('http_proxy_password');
         }
     }
     curl_setopt_array($ch, $curl_options);
     $response = curl_exec($ch);
     curl_close($ch);
     if ($response === false) {
         throw new tmdbException("Curl exec failure", curl_error($ch));
     }
     $results = json_decode($response, true);
     if ((!array_key_exists('status_code', $results) || $results['status_code'] == 1) && !empty($results['results'])) {
         $movie_id = $results['results'][0]['id'];
         return self::getInfoById($movie_id);
     }
     return $results;
 }
开发者ID:saydulk,项目名称:stalker_portal,代码行数:33,代码来源:tmdb.class.php

示例9: setClaimGlobal

 /**
  * Main claim method.
  *
  * @param string $media_type
  */
 protected function setClaimGlobal($media_type)
 {
     $id = intval($_REQUEST['id']);
     $type = $_REQUEST['real_type'];
     $this->db->insert('media_claims_log', array('media_type' => $media_type, 'media_id' => $id, 'type' => $type, 'uid' => $this->stb->id, 'added' => 'NOW()'));
     $total_media_claims = $this->db->from('media_claims')->where(array('media_type' => $media_type, 'media_id' => $id))->get()->first();
     $sound_counter = 0;
     $video_counter = 0;
     $no_epg_counter = 0;
     $wrong_epg_counter = 0;
     if ($type == 'video') {
         $video_counter++;
     } else {
         if ($type == 'sound') {
             $sound_counter++;
         } else {
             if ($type == 'no_epg') {
                 $no_epg_counter++;
             } else {
                 if ($type == 'wrong_epg') {
                     $wrong_epg_counter++;
                 }
             }
         }
     }
     if (!empty($total_media_claims)) {
         $this->db->update('media_claims', array('sound_counter' => $total_media_claims['sound_counter'] + $sound_counter, 'video_counter' => $total_media_claims['video_counter'] + $video_counter, 'no_epg' => $total_media_claims['no_epg'] + $no_epg_counter, 'wrong_epg' => $total_media_claims['wrong_epg'] + $wrong_epg_counter), array('media_type' => $media_type, 'media_id' => $id));
     } else {
         $this->db->insert('media_claims', array('sound_counter' => $sound_counter, 'video_counter' => $video_counter, 'no_epg' => $no_epg_counter, 'wrong_epg' => $wrong_epg_counter, 'media_type' => $media_type, 'media_id' => $id));
     }
     $total_daily_claims = $this->db->from('daily_media_claims')->where(array('date' => 'CURDATE()'))->get()->first();
     $media_name = 'undefined';
     if ($media_type == 'itv') {
         $media = Itv::getById($id);
         if (!empty($media['name'])) {
             $media_name = $media['name'];
         }
     } elseif ($media_type == 'vclub') {
         $media = Video::getById($id);
         if (!empty($media['name'])) {
             $media_name = $media['name'];
         }
     } elseif ($media_type == 'karaoke') {
         $media = Karaoke::getById($id);
         if (!empty($media['name'])) {
             $media_name = $media['name'];
         }
     }
     if (Config::exist('administrator_email')) {
         $message = sprintf(_("New claim on %s - %s (%s, id: %s). From %s"), $media_type, $type, $media_name, $id, $this->stb->mac);
         mail(Config::get('administrator_email'), 'New claim on ' . $media_type . ' - ' . $type, $message, "Content-type: text/html; charset=UTF-8\r\n");
     }
     if (!empty($total_daily_claims)) {
         return $this->db->update('daily_media_claims', array($media_type . '_sound' => $total_daily_claims[$media_type . '_sound'] + $sound_counter, $media_type . '_video' => $total_daily_claims[$media_type . '_video'] + $video_counter, 'no_epg' => $total_daily_claims['no_epg'] + $no_epg_counter, 'wrong_epg' => $total_daily_claims['wrong_epg'] + $wrong_epg_counter), array('date' => 'CURDATE()'))->result();
     } else {
         return $this->db->insert('daily_media_claims', array($media_type . '_sound' => $sound_counter, $media_type . '_video' => $video_counter, 'no_epg' => $no_epg_counter, 'wrong_epg' => $wrong_epg_counter, 'date' => 'CURDATE()'))->insert_id();
     }
 }
开发者ID:Rockystar2,项目名称:stalker_portal,代码行数:63,代码来源:ajaxresponse.class.php

示例10: setChannelLinkStatus

 public static function setChannelLinkStatus($link_id, $status)
 {
     if (empty($link_id) || !is_numeric($link_id)) {
         return false;
     }
     $channel = Mysql::getInstance()->from('radio')->where(array('id' => $link_id))->get()->first();
     if (empty($channel)) {
         return false;
     }
     if ((int) $status != (int) $channel['monitoring_status']) {
         if ((int) $status == 0) {
             if (Config::exist('administrator_email')) {
                 $message = sprintf(_("Radio-channel %s set to active because its URL became available."), $channel['number'] . ' ' . $channel['name']);
                 mail(Config::get('administrator_email'), 'Radio-channels monitoring report: channel enabled', $message, "Content-type: text/html; charset=UTF-8\r\n");
             }
         } else {
             if (Config::exist('administrator_email')) {
                 $message = sprintf(_('Radio-channel %s set to inactive because its URL are not available.'), $channel['number'] . ' ' . $channel['name']);
                 mail(Config::get('administrator_email'), 'Radio-channels monitoring report: channel disabled', $message, "Content-type: text/html; charset=UTF-8\r\n");
             }
         }
         Mysql::getInstance()->update('radio', array('monitoring_status' => $status), array('id' => $link_id))->result();
     }
     return Mysql::getInstance()->update('radio', array('monitoring_status_updated' => 'NOW()'), array('id' => $link_id))->result();
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:25,代码来源:radio.class.php

示例11: array

<?php

$page = 'testimonios';
$page2 = 'nav-testimonios';
require "template/header.php";
?>
<div class="container">
  <div class="row">
  <?php 
require "template/nav_testimonios.php";
?>
  <?php 
if (Utils::checkPost("add")) {
    if (Config::exist("bgtestimonios")) {
        $edit = array("value" => File::upload("background"));
        $confirm = Config::edit($edit, array("name", "=", "bgtestimonios"));
    } else {
        $new = array("name" => "bgtestimonios", "value" => File::upload("background"));
        $confirm = Config::add($new);
    }
}
?>
  
  
  <div class="grid col-9">
  <div class="row">
	<form action="" method="post" enctype="multipart/form-data" >
    <p><?php 
if (isset($confirm) && $confirm > 0) {
    echo "Modificación exitosa";
}
开发者ID:EzequielDot175,项目名称:muysimple,代码行数:31,代码来源:testimonios_gral_background.php

示例12: create

 public static function create($data)
 {
     if (!empty($data['mac'])) {
         $user = Stb::getUidByMacs($data['mac']);
         if (!empty($user)) {
             throw new ErrorException('Stb already exists');
         }
     }
     $data['created'] = 'NOW()';
     if (Config::exist('default_stb_status') && !isset($data['status'])) {
         $data['status'] = intval(!Config::get('default_stb_status'));
     }
     try {
         OssWrapper::getWrapper()->registerSTB(Stb::getInstance()->mac, isset($_REQUEST['sn']) ? $_REQUEST['sn'] : '', isset($_REQUEST['stb_type']) ? $_REQUEST['stb_type'] : '');
     } catch (OssException $e) {
         self::logOssError($e);
     }
     $data['serial_number'] = isset($_REQUEST['sn']) ? $_REQUEST['sn'] : '';
     $user_id = Mysql::getInstance()->insert('users', $data)->insert_id();
     if ($user_id && !empty($data['password'])) {
         $update_data = array('password' => md5(md5($data['password']) . $user_id));
         if (empty($data['login'])) {
             $update_data['login'] = $user_id;
         }
         Mysql::getInstance()->update('users', $update_data, array('id' => $user_id));
     }
     self::$just_created = true;
     return $user_id;
 }
开发者ID:macblizzard,项目名称:stalker_portal,代码行数:29,代码来源:stb.class.php

示例13: play

 /**
  * Trying to create a link of media file in stb home directory
  *
  * @param int $media_id
  * @param int $series_num
  * @param bool $from_cache
  * @param string $forced_storage
  * @return array contains path to media or error
  */
 public function play($media_id, $series_num = 0, $from_cache = true, $forced_storage = "")
 {
     $this->initMedia($media_id);
     $res = array('id' => 0, 'cmd' => '', 'storage_id' => '', 'load' => '', 'error' => '');
     if (!empty($this->rtsp_url)) {
         $res['id'] = $this->media_id;
         $res['cmd'] = $this->rtsp_url;
         return $res;
     }
     if (!empty($forced_storage)) {
         $from_cache = false;
     }
     $good_storages = $this->getAllGoodStoragesForMedia($this->media_id, !$from_cache);
     if (!empty($forced_storage)) {
         if (array_key_exists($forced_storage, $good_storages)) {
             $good_storages = array($forced_storage => $good_storages[$forced_storage]);
         } else {
             $good_storages = array();
         }
     }
     $default_error = 'nothing_to_play';
     foreach ($good_storages as $name => $storage) {
         if ($storage['load'] < 1) {
             if ($series_num > 0) {
                 $file = $storage['series_file'][array_search($series_num, $storage['series'])];
             } else {
                 $file = $storage['first_media'];
             }
             preg_match("/([\\S\\s]+)\\.([\\S]+)\$/", $file, $arr);
             $ext = $arr[2];
             //var_dump($this->storages[$name]);
             if ($this->storages[$name]['external'] == 0) {
                 try {
                     //$this->clients[$name]->createLink($this->stb->mac, $this->media_name, $file, $this->media_id, (($this->media_protocol == 'http') ? 'http_' : '') . $this->media_type);
                     $this->clients[$name]->resource($this->media_type)->create(array('media_name' => $this->getMediaPath($file), 'media_id' => $this->media_id, 'proto' => $this->media_protocol));
                 } catch (Exception $exception) {
                     $default_error = 'link_fault';
                     $this->parseException($exception);
                     if ($exception instanceof RESTClientException && !$exception instanceof RESTClientRemoteError) {
                         $storage = new Storage(array('name' => $name));
                         $storage->markAsFailed($exception->getMessage());
                         continue;
                     }
                     if ($this->from_cache) {
                         return $this->play($media_id, $series_num, false);
                     } else {
                         continue;
                     }
                 }
                 if ($this->media_protocol == 'http' || $this->media_type == 'remote_pvr') {
                     if (Config::exist('nfs_proxy')) {
                         $base_path = 'http://' . Config::get('nfs_proxy') . '/media/' . $name . '/' . RESTClient::$from . '/';
                     } elseif (!empty($this->storages[$name]['wowza_server'])) {
                         $base_path = 'http://' . $this->storages[$name]['storage_ip'] . ':' . $this->storages[$name]['wowza_port'] . '/' . $this->storages[$name]['wowza_app'] . '/_definst_/mp4:' . $this->getMediaPath($file) . '/';
                     } else {
                         $base_path = 'http://' . $this->storages[$name]['storage_ip'] . '/media/' . $name . '/' . RESTClient::$from . '/';
                     }
                 } else {
                     $base_path = '/media/' . $name . '/';
                 }
                 if (strpos($base_path, 'http://') !== false) {
                     $res['cmd'] = 'ffmpeg ';
                 } else {
                     $res['cmd'] = 'auto ';
                 }
                 if (empty($this->storages[$name]['wowza_server'])) {
                     $res['cmd'] .= $base_path . $this->media_id . '.' . $ext;
                     // nginx secure link
                     $secret = Config::get('nginx_secure_link_secret');
                     if (preg_match('/http(s)?:\\/\\/([^\\/]+)\\/(.+)$/', $res['cmd'], $match)) {
                         $uri = '/' . $match[3];
                     } else {
                         $uri = '';
                     }
                     $remote_addr = $this->stb->ip;
                     $expire = time() + Config::getSafe('vclub_nginx_tmp_link_ttl', 7200);
                     $hash = base64_encode(md5($secret . $uri . $remote_addr . $expire, true));
                     $hash = strtr($hash, '+/', '-_');
                     $hash = str_replace('=', '', $hash);
                     $res['cmd'] .= '?st=' . $hash . '&e=' . $expire;
                 } else {
                     $res['cmd'] .= $base_path . 'playlist.m3u8?token=' . $this->createTemporaryLink("1");
                 }
                 $file_info = array_filter($storage['files'], function ($info) use($file) {
                     return $info['name'] == $file;
                 });
                 $file_info = array_values($file_info);
                 if (!empty($file_info) && !empty($file_info[0]['subtitles'])) {
                     $ip = $this->stb->ip;
                     $res['subtitles'] = array_map(function ($subtitle) use($base_path, $file, $ip) {
                         $file_base = substr($file, 0, strrpos($file, '.'));
//.........这里部分代码省略.........
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:101,代码来源:master.class.php

示例14: checkUserAuth

 public function checkUserAuth($username, $password, $mac = null, $serial_number = null, OAuthRequest $request)
 {
     sleep(1);
     // anti brute-force delay
     $user = null;
     if ($username) {
         $user = \User::getByLogin($username);
     } elseif (!$password && $mac) {
         $_COOKIE['mac'] = $mac;
         if ($serial_number) {
             $_REQUEST['serial_number'] = $serial_number;
         }
         if ($request->getVersion()) {
             $_REQUEST['version'] = $request->getVersion();
         }
         if ($request->getDeviceId2()) {
             $_REQUEST['device_id2'] = $request->getDeviceId2();
             $_REQUEST['signature'] = $request->getSignature();
         }
         // init user as STB
         \Stb::getInstance()->getProfile();
         $user = \User::getByMac(\Stb::getInstance()->mac);
         if ($user) {
             $request->setUsername($user->getLogin());
         }
     }
     if (\Config::exist('auth_url') && strpos(\Config::get('auth_url'), 'auth_every_load') && empty($username) && empty($password)) {
         return false;
     }
     if (!$user || !empty($username) && !empty($password) && \Config::getSafe('oss_url', '')) {
         $user = \User::authorizeFromOss($username, $password, $mac);
     }
     if (!$user) {
         return false;
     }
     $possible_user = $user->getProfile();
     if (!$password && $mac) {
         $request->setUsername($user->getLogin());
     }
     if (!$password && $mac || \Config::exist('auth_url') && $username && $password) {
         $verified_user = $possible_user;
     } elseif (strlen($possible_user['password']) == 32 && md5(md5($password) . $possible_user['id']) == $possible_user['password'] || strlen($possible_user['password']) < 32 && $password == $possible_user['password']) {
         if (\Config::getSafe('oauth_force_mac_check', false) && \Config::getSafe('oauth_force_serial_number_check', false)) {
             if ($mac == $possible_user['mac'] && ($serial_number == $possible_user['serial_number'] || $possible_user['serial_number'] == '')) {
                 $verified_user = $possible_user;
             }
         } else {
             if (\Config::getSafe('oauth_force_mac_check', false)) {
                 if ($mac == $possible_user['mac']) {
                     $verified_user = $possible_user;
                 }
             } else {
                 if (\Config::getSafe('oauth_force_serial_number_check', false)) {
                     if ($serial_number == $possible_user['serial_number'] || $possible_user['serial_number'] == '') {
                         $verified_user = $possible_user;
                     }
                 } else {
                     $verified_user = $possible_user;
                 }
             }
         }
     }
     if (!empty($verified_user)) {
         $user->setSerialNumber($serial_number);
         $user->updateUserInfoFromOSS();
         if (\Config::getSafe('bind_stb_auth_and_oauth', true)) {
             // invalidate stb access_token
             $user->resetAccessToken();
         }
     }
     $user->updateIp();
     return !empty($verified_user);
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:73,代码来源:authaccesshandler.class.php

示例15: define

if (!defined("PATH_SEPARATOR")) {
    define("PATH_SEPARATOR", getenv("COMSPEC") ? ";" : ":");
}
define('PROJECT_PATH', dirname(__FILE__));
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . PROJECT_PATH);
/*function __autoload($class_name) {

    $class = PROJECT_PATH.'/lib/'.strtolower($class_name).'.class.php';

    if (!file_exists($class)){
        throw new Exception('Class file for "'.$class_name.'" not found');
    }
    
    require $class;
}*/
require "lib/splclassloader.class.php";
$classLoader = new SplClassLoader(null, PROJECT_PATH . DIRECTORY_SEPARATOR . 'lib');
$classLoader->setFileExtension('.class.php');
$classLoader->setExcludeNs('Stalker\\Lib');
$classLoader->register();
if (Config::exist('default_timezone')) {
    date_default_timezone_set(Config::get('default_timezone'));
}
if (Config::exist('http_proxy')) {
    $default_context = array('http' => array('proxy' => Config::get('http_proxy'), 'request_fulluri' => true));
    if (Config::exist('http_proxy_login') && Config::exist('http_proxy_password')) {
        $default_context['http']['header'] = "Proxy-Authorization: Basic " . base64_encode(Config::get('http_proxy_login') . ":" . Config::get('http_proxy_password')) . "\r\n";
    }
    stream_context_set_default($default_context);
    libxml_set_streams_context(stream_context_create($default_context));
}
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:31,代码来源:common.php


注:本文中的Config::exist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。