browseType(); } /* browse redirect check */ public static function browseInit() { $p_t = self::browsetype(); $p_t = $p_t == 'broadcasts' ? 'live' : $p_t; $type = $p_t; $rd_to = $type; $_SESSION['q'] = null; $_SESSION['tf'] = null; $_SESSION['uf'] = null; $_SESSION['df'] = null; $_SESSION['ff'] = null; if ($type == '') { $rd_to = ($type == '' and self::$cfg['video_module'] == 1) ? 'video' : (($type == '' and self::$cfg['short_module'] == 1) ? 'short' : (($type == '' and self::$cfg['live_module'] == 1) ? 'live' : (($type == '' and self::$cfg['image_module'] == 1) ? 'image' : (($type == '' and self::$cfg['audio_module'] == 1 ? 'audio' : (($type == '' and self::$cfg['document_module'] == 1 ? 'document' : ($type == '' and self::$cfg['blog_module'] == 1 ? 'blog' : null)))))))); } $guest_for = ($p_t == '' ? $rd_to : $p_t); switch ($guest_for) { case "live":$u = self::$href['broadcasts']; break; case "video":$u = self::$href['videos']; break; case "short":$u = self::$href['shorts']; break; case "image":$u = self::$href['images']; break; case "audio":$u = self::$href['audios']; break; case "doc": case "document":$u = self::$href['documents']; break; case "blog":$u = self::$href['blogs']; break; } $guest_chk = $_SESSION['USER_ID'] == '' ? VHref::guestPermissions('guest_browse_' . ($guest_for == 'document' ? 'doc' : $guest_for), $u) : null; if ($p_t === '' or ($p_t != '' and self::$cfg[$p_t . "_module"] == 0)) { header("Location: " . self::$cfg['main_url']); } return $rd_to; } /* browse files layout */ public static function browseLayout($force_type = false) { if ($force_type) { switch ($force_type) { case self::$href['broadcasts']:self::$type = 'live'; break; case self::$href['videos']:self::$type = 'video'; break; case self::$href['shorts']:self::$type = 'short'; break; case self::$href['images']:self::$type = 'image'; break; case self::$href['audios']:self::$type = 'audio'; break; case self::$href['documents']:self::$type = 'doc'; break; case self::$href['blogs']:self::$type = 'blog'; break; } } $res_promoted = self::$cfg['file_promo'] == 1 ? self::getPromoted() : null; $res_live = self::$type == 'live' ? self::getPromoted(1, 'livenow') : null; $res_media = self::getMedia(); $res_watchlist = self::watchlistEntries(); $html .= self::$type == 'live' ? self::listPromoted($res_live, $res_watchlist, 'livenow') : null; //streams live now $html .= (self::$cfg['file_promo'] == 1 and $res_promoted->fields['file_key']) ? self::listPromoted($res_promoted, $res_watchlist) : null; $html .= self::listMedia($res_media, $res_watchlist); return $html; } /* category file count */ public static function categoryCount($type, $ct_id, $mobile = '', $be = '') { $_u = $_GET['u'] != '' ? sprintf("AND C.`usr_id`='%s'", self::$dbc->singleFieldValue('db_accountuser', 'usr_id', 'usr_key', self::$filter->clr_str(substr($_GET['u'], 1)))) : null; $sql = sprintf("SELECT C.`file_key`, COUNT(*) AS `total` FROM `db_%sfiles` C WHERE C.`file_category` = '%s' %s AND C.`approved` = '1' AND C.`deleted` = '0' AND C.`active` = '1' %s %s;", $type, $ct_id, ($be == '' ? "AND C.`privacy` = 'public'" : null), ($mobile == 1 ? "AND C.`file_mobile`='1'" : null), $_u); $res = self::$db_cache ? self::$db->CacheExecute(self::$cfg['cache_browse_categories_menu'], $sql) : self::$db->execute($sql); return VFiles::numFormat($res->fields['total']); } /* build url from type */ private static function baseUrl() { switch (self::$type[0]) { case "l": $key = 'broadcasts'; break; case "v": $key = 'videos'; break; case "s": $key = 'shorts'; break; case "i": $key = 'images'; break; case "a": $key = 'audios'; break; case "d": $key = 'documents'; break; case "b": $key = 'blogs'; break; } return self::$cfg['main_url'] . '/' . self::$href[$key]; } /* category nav menu */ public static function categoryMenu($type = false, $new_layout = false) { $type = !$type ? self::$type : $type; $get = self::$filter->clr_str($_GET['c']); $sql = sprintf("SELECT `ct_id`, `ct_name`, `ct_lang`, `ct_slug`, `ct_icon` FROM `db_categories` WHERE `ct_type`='%s' AND `sub_id`='0' AND `ct_active`='1' AND `ct_menu`='1' ORDER BY `ct_index` ASC;", $type); $ct = self::$db_cache ? self::$db->CacheExecute(self::$cfg['cache_browse_categories_menu'], $sql) : self::$db->execute($sql); $html = VGenerate::advHTML(13); if ($ct) { if (!$new_layout) { $html .= '