/* Functions related to niche pages. Template in use: 'templates/niche.html' NB. Save admin settings to implement any changes in this file! Page constants you may use: DOMAIN - domain name. like 'somesite.com' LANGUAGE - current used language, like 'en' or 'de' REAL_ID - niche (category, tag) id, like '42334' DIR_ID - directory id for a niche, like 'A4B2C3S3E4'. DIR_ID = GetFolderId(REAL_ID) NICHE_NAME - niche name, like 'mature big tits' DIR_NAME - name of directory, like 'Mature-Big-Tits' DIR_NAME = GetFolderName(NICHE_NAME); TOTAL_VIDEOS - total number of videos in current niche (category) TOTAL_PAGES - total number of pages for the niche, like '22' CURRENT_PAGE_NUM - number of current page, like '2'. */ if (!defined('TAGS_LIMIT')) define('TAGS_LIMIT', $config['np_tags_amount']); if (!defined('VIDEO_DIR')) define('VIDEO_DIR', $config['video_folder']); // settngs for some pages if (!defined('INDEX_ARCHIVE')) define('INDEX_ARCHIVE', $config['index_archive']); // index all archive pages if (!defined('INDEX_NEW')) define('INDEX_NEW', $config['index_new']); // index 'All time Best' pages if (!defined('INDEX_ALLTIME_BEST')) define('INDEX_ALLTIME_BEST', $config['index_best']); // index 'All time Best' pages if (!defined('INDEX_MONTH_BEST')) define('INDEX_MONTH_BEST', $config['index_month']); // index 'Month Best' pages if (!defined('INDEX_WEEK_BEST')) define('INDEX_WEEK_BEST', $config['index_week']); // index 'Week Best' pages if (!defined('INDEX_HISTORY')) define('INDEX_HISTORY', $config['index_history_page']); // index 'History' pages if (!defined('INDEX_KEYWORDS')) define('INDEX_KEYWORDS', $config['index_keywords_page']); // index 'keywords (extra tags)' pages if (!defined('INDEX_SEARCH')) define('INDEX_SEARCH', $config['index_search_page']); // index 'Search' pages // Settings for the pages #2, #3 and so on if (!defined('INDEX_PAGINATION')) define('INDEX_PAGINATION', $config['index_pagination']); // Index all pages except first (#2, #3 and so on.) if (!defined('CANONICAL_PAGINATION')) define('CANONICAL_PAGINATION', $config['canonical_pagination']); // Add page # to canonincal links for the pages #2, #3 and so on.) function ShowTitle() { /* Displays page title in the section */ global $config; if (PAGE_TYPE == 'history') { echo ShowTranslatedWord('history', LANGUAGE); return; } if (PAGE_TYPE == 'search') { echo ShowTranslatedWord('Search results for', LANGUAGE) . " '" . SEARCH_QUERY . "'"; return; } if (PAGE_TYPE == 'keywords') { echo ucwords(KEYWORD) .' HD XXX Videos - Xporn'; return; } if (!empty($config['np_title'])) { if ($config['mp_role'] != 'cats') { // Main page role = specific page, so we display main page title instead of niche page title if ($config['mp_role'] == 'best' && REAL_ID == 9999997 || $config['mp_role'] == 'week' && REAL_ID == 9999998 || $config['mp_role'] == 'month' && REAL_ID == 9999999 || $config['mp_role'] == 'new' && REAL_ID == 0 || $config['mp_role'] == 'niche' && REAL_ID == $config['mp_niche']) { $result = isset($config['mp_title_key']) ? $config['mp_title_key'] : strtoupper(DOMAIN) . ' - Free HOT XXX Video Tube!'; if (preg_match_all('~%translate:([^%]+)%~is', $result, $matches)) { foreach ($matches[1] as $id => $word) { $result = str_replace($matches[0][$id], translateWord($word, LANGUAGE), $result); } } echo $result; return true; } } $result = str_replace('%ucwords_sitename%', ucwords(DOMAIN), $config['np_title']); if(IS_ACTOR) $result = str_replace('%ucwords_niche%', ucwords(translate(REAL_ID, 'en')), $result); else $result = str_replace('%ucwords_niche%', mb_ucst(translate(REAL_ID, LANGUAGE)), $result); $result = str_replace('%video_amount%', number_format(TOTAL_VIDEOS), $result); $result = str_replace('%page_num%', CURRENT_PAGE_NUM, $result); if (preg_match_all('~%translate:([^%]+)%~is', $result, $matches)) { foreach ($matches[1] as $id => $word) { $result = str_replace($matches[0][$id], translateWord($word, LANGUAGE), $result); } } } else $result = ucwords(DOMAIN) . "| " . mb_ucst(translate(REAL_ID, LANGUAGE)) . ": " . number_format(TOTAL_VIDEOS) . " videos. Page " . CURRENT_PAGE_NUM; echo $result; } function ShowH1Title() { /* Displays page

title */ global $config; if (PAGE_TYPE == 'history') { echo ShowTranslatedWord('history', LANGUAGE); return; } if (PAGE_TYPE == 'search') { echo ShowTranslatedWord('Search results for', LANGUAGE) . " '" . SEARCH_QUERY . "'"; return; } if (PAGE_TYPE == 'keywords') { echo ucwords(KEYWORD); return; } if (!empty($config['np_h1'])) { if(IS_ACTOR) $result = str_replace('%ucwords_niche%', mb_ucst(translate(REAL_ID, 'en')), $config['np_h1']); else $result = str_replace('%ucwords_niche%', mb_ucst(translate(REAL_ID, LANGUAGE)), $config['np_h1']); $result = str_replace('%video_amount%', number_format(TOTAL_VIDEOS), $result); $result = str_replace('%page_num%', CURRENT_PAGE_NUM, $result); if (preg_match_all('~%translate:([^%]+)%~is', $result, $matches)) { foreach ($matches[1] as $id => $word) { $result = str_replace($matches[0][$id], translateWord($word, LANGUAGE), $result); } } } else $result = str_replace('%ucwords_niche%', mb_ucst(translate(REAL_ID, LANGUAGE)), 'Hot %ucwords_niche% videos.'); echo $result; } $pagination = null; function ShowPagination() { /* Displays pagination */ global $pagination; if (!empty($pagination)) { echo $pagination; return; } // TODO: add to sites's settings //if (PAGE_TYPE == 'search' || PAGE_TYPE == 'keywords') return ''; if (TOTAL_PAGES < 2) return ''; $page_type = PAGE_TYPE == 'archive' ? 'archive/' : ''; $current = CURRENT_PAGE_NUM == 'best' ? 1 : CURRENT_PAGE_NUM; $next = $current + 1; $prev = $current - 1; $p = $prev == 1 ? '' : $prev; if (PAGE_TYPE == 'keywords') $path = getKeywordsFolder().'/'; elseif (PAGE_TYPE == 'search') $path = getSearchFolder().'/'; else $path = getNicheFolder(DIR_ID,DIR_NAME); $pagination = ''; echo $pagination; } function trimTags($input_tags = array()) { /* Trimming tags before displaying when their amount exceeds TAGS_LIMIT */ global $bad_tags_ids; $result = array(); $tags = array(); if (is_array($input_tags) && sizeof($input_tags)) foreach ($input_tags as $k => $v) if (!isset($bad_tags_ids[$v])) $tags[] = $v; $tags_count = count($tags); if ($tags_count > TAGS_LIMIT) { $step = floor($tags_count / TAGS_LIMIT); if ($step < 1) return array(); $current = TAGS_SHIFT % $step; for ($num = 1; $num <= TAGS_LIMIT; $num++) { if (isset($tags[$current])) { $result[] = $tags[$current]; } $current += $step; } } else $result = $tags; return $result; } function DrawNicheSpot() { global $config; $record = GetNextRecord(); if (empty($record)) return ''; if ($config['np_show_spons']) { $sponsor_id = 10000000 + $record['sponsor']; $sponsor_name = translate($sponsor_id, LANGUAGE); $sponsor = '
{$sponsor_name}
"; } else $sponsor = ''; $ago = floor(time() - $record['added']); if ($ago < 86400) { // less than a day $ago = floor($ago / 3600); $added_ago = $ago > 1 ? $ago . " hours ago" : "1 hour ago"; } elseif ($ago < 2592000) { //less than a month $ago = floor($ago / 86400); $added_ago = $ago > 1 ? $ago . " days ago" : "1 day ago"; } elseif ($ago < 31536000) { //less than a year $ago = floor($ago / 2592000); $added_ago = $ago > 1 ? $ago . " months ago" : "1 month ago"; } else { //more than a year $ago = floor($ago / 31536000); $added_ago = $ago > 1 ? $ago . " years ago" : "1 year ago"; } $tag_text = '
'; if ($config['np_show_tags']) { if (is_array($record['tags']) && count($record['tags'])) { $tags_code = array(); foreach ($record['tags'] as $tag_id) { if(!empty($record['actors']) && in_array($tag_id,$record['actors'])) continue; $tag_name = translate($tag_id, LANGUAGE); if ($tag_name == 'unknown!') continue; $tag_en = translate($tag_id, 'en'); $dir_name = GetFolderName($tag_en); $dir_id = GetFolderId($tag_id); $tags_code[] = getNicheLink($dir_id, $dir_name, $tag_name); } if (count($tags_code)) $tag_text = '
' . join(', ', $tags_code) . '
'; else $tag_text = '
'; } } else { $tags_to_title = ''; if ($config['np_tags_to_title']) { if (is_array($record['tags']) && count($record['tags'])) { $tags_code = array(); foreach ($record['tags'] as $tag_id => $v) { $tags_code[] = translate($tag_id, LANGUAGE); } if (count($tags_code)) $tags_to_title = join(", ", $tags_code); else $tags_to_title = ''; } } } $link = getVideoFolder($record['desc'], $record['id']); $alt = $title = $config['np_tags_to_title'] ? $tags_to_title : $record['desc']; $record['desc'] = ucfirst($record['desc']); $alt = $config['np_show_alt'] ? ' alt="' . $alt . '"' : ''; $title = $config['np_show_title'] ? ' title="' . $title . '"' : ''; $desc = $config['np_show_desc'] ? "{$record['desc']}" : ''; if (empty($record['duration'])) $record['duration'] = rand(1, 6) . ':' . rand(0, 59); // better than nothing $data_id = $record['src'] == $record['id'] ? '' : 'data-id="' . $record['id'] . '" '; $code = '
' . $desc . $tag_text . $sponsor . '
'; echo $code; } function mb_ucst($str) { $fc = mb_strtoupper(mb_substr($str, 0, 1)); return $fc . mb_substr($str, 1); } function ShowRelatedCategories($amount = 20) { /* function GetExtraCategories($amount=20): $amount - number of related categories to show, 20 by default */ $extra_categories = GetExtraCategories($amount); if (!empty($extra_categories)) { $code = ''; } else $code = ''; echo $code; } function ShowButtonClass($button_name = null) { switch ($button_name) { case 'latest': echo PAGE_TYPE == 'best' ? "btn-default" : 'btn-default active'; break; case 'best': echo PAGE_TYPE == 'best' ? "btn-default active" : 'btn-default'; break; case 'home': echo "btn-default"; break; case 'new': echo REAL_ID == 0 ? 'btn-default sel' : 'btn-default'; break; case 'alltime': echo REAL_ID == 9999997 ? 'btn-default sel' : 'btn-default'; break; case 'week': echo REAL_ID == 9999998 ? 'btn-default sel' : 'btn-default'; break; case 'month': echo REAL_ID == 9999999 ? 'btn-default sel' : 'btn-default'; break; case 'history': echo PAGE_TYPE == 'history' ? 'btn-default sel' : 'btn-default'; break; default: echo "btn-default"; } } function ShowMetaDescription() { global $config; /* Displays meta description. There are 10 sample templates. Each niche will use the same description template all the time. */ if ($config['mp_role'] != 'cats') { // Main page role = specific page, so we display main page description instead of niche page description if ($config['mp_role'] == 'best' && REAL_ID == 9999997 || $config['mp_role'] == 'week' && REAL_ID == 9999998 || $config['mp_role'] == 'month' && REAL_ID == 9999999 || $config['mp_role'] == 'new' && REAL_ID == 0 || $config['mp_role'] == 'niche' && REAL_ID == $config['mp_niche']) { if (isset($config['mp_description'])) echo $config['mp_description']; return true; } } $phrase = NICHE_NAME; if (PAGE_TYPE == 'keywords') $phrase = ucwords(KEYWORD); if (PAGE_TYPE == 'search') $phrase = SEARCH_QUERY; // As an idea. Phrase 'Watch free porn' need to be translated. //echo translateWord('Watch free porn', LANGUAGE) . ': ' . $phrase; //return; $d_id = PAGE_TYPE == 'best' || PAGE_TYPE == 'archive' ? (REAL_ID % 10) : rand(0, 9); $desc_templates = array('This page is dedicated to _TAG_', 'Here is we collected all that you wanted about _TAG_', 'All about _TAG_. Page updates daily!', 'All what you wanted to see about _TAG_', 'Latest _TAG_ updates. We add new porn videos hourly.', 'Are you looking for _TAG_? This page is all you need! New clips every hour.', 'Interesting in _TAG_? Here you are!', 'Daily updated _TAG_ content!', 'Dreamed of _TAG_? We have some for you! Bookmark this page to see daily updates.', 'We collected for you best of _TAG_ of this page. Fresh videos added on hourly basis!'); echo str_replace('_TAG_', $phrase, $desc_templates[$d_id]); } function ShowMetaKeywords() { /* Displays meta keywords */ echo ""; } function ShowLink($link_name = null) { /* Displays either link to 'best' page or to 'archive' page */ $path = getNicheFolder(DIR_ID, DIR_NAME); echo $link_name == 'best' ? $path : $path . 'archive'; } function ShowLanguageSelector() { // Displays dropdown language selector global $ALL_LANGS; if(!SHOW_LANG_SELECT) return false; $lang_names = array(); $lang_names['en'] = 'English'; $lang_names['de'] = 'Deutsch'; $lang_names['fr'] = 'Français'; $lang_names['it'] = 'Italiano'; $lang_names['ru'] = 'Русский'; $lang_names['es'] = 'Español'; $lang_names['tr'] = 'Türkçe'; $lang_names['vi'] = 'Vietnamese'; $lang_names['pt'] = 'Português'; $lang_names['nl'] = 'Nederlands'; $lang_names['sv'] = 'Svenska'; $lang_names['id'] = 'Indonesia'; $lang_names['ms'] = 'Malay'; $lang_names['ur'] = 'اردو'; $lang_names['ja'] = '日本語'; $lang_names['ko'] = '한국어'; $lang_names['th'] = 'ภาษาไทย'; $lang_names['hi'] = 'हिंदी'; $lang_names['zh'] = '中文'; $lang_names['ar'] = 'العربية'; $lang_names['cs'] = 'Čeština'; $lang_names['da'] = 'Dansk'; $lang_names['el'] = 'Ελληνικά'; $lang_names['hu'] = 'Magyar'; $lang_names['no'] = 'Norsk'; $lang_names['sk'] = 'Slovenčina'; $lang_names['sl'] = 'Slovenščina'; $lang_names['fi'] = 'Suomi'; if (!MULTI_LANGUAGES){ // No languages in URLs $name = isset($lang_names[LANGUAGE]) ? $lang_names[LANGUAGE] : 'English'; echo "
  • \n
  • "; return true; } $text = "
  • \n\n
  • "; echo $text; } function getHistoryFolder($language = null){ global $config; // history_URL //'1' => test.com/en/history, //'2' => test.com/history, if(empty($language))$language = LANGUAGE; if($config['history_URL']=='1') return '/'.$language.'/'.$config['history_folder']; return '/'.$config['history_folder']; } function getSearchFolder($language = null, $text = null){ global $config; $phrase = !is_null($text)?$text:SEARCH_QUERY; if(empty($language))$language = LANGUAGE; if($config['search_URL']=='1') return '/'.$language.'/'.$config['search_folder']; elseif ($config['search_URL']=='2') return '/'.$config['search_folder']; elseif ($config['search_URL']=='3') return '/'.$language.'/'.$config['search_folder'].'/'.str_replace(' ','-',ucwords($phrase)); return '/'.$config['search_folder'].'/'.str_replace(' ','-',ucwords($phrase)); } function getKeywordsFolder($language = null){ global $config; if(empty($language))$language = LANGUAGE; if($config['keywords_URL']=='1') return '/'.$config['keywords_folder'].'/'.$language.'/'.GetFolderName(KEYWORD); elseif ($config['keywords_URL']=='2') return '/'.$language.'/'.$config['keywords_folder'].'/'.GetFolderName(KEYWORD); return '/'.$config['keywords_folder'].'/'.GetFolderName(KEYWORD); } function ShowRelPagination() { // Displays Next/Prev rel links in section if(PAGE_TYPE=='keywords'||PAGE_TYPE=='history'||PAGE_TYPE=='search')return true; $page_type = PAGE_TYPE == 'archive' ? 'archive/' : ''; $links = "\n"; if (CURRENT_PAGE_NUM > 1) { $prev = CURRENT_PAGE_NUM - 1; if ($prev == 1) $prev = ''; $links .= ' \n"; } if (CURRENT_PAGE_NUM < TOTAL_PAGES) { $next = CURRENT_PAGE_NUM + 1; $links .= ' \n"; } echo $links; } function ShowCanonicalLink() { // Displays canonical Link for a page if (PAGE_TYPE == 'keywords') $link = PROTOCOL . '://' . WWW . DOMAIN . getKeywordsFolder(); elseif (PAGE_TYPE == 'history') $link = PROTOCOL . '://' . WWW . DOMAIN . getHistoryFolder(); elseif(PAGE_TYPE == 'search') $link = PROTOCOL . '://' . WWW . DOMAIN . getSearchFolder(); elseif(PAGE_TYPE == 'new') $link = PROTOCOL . '://' . WWW . DOMAIN . showHeaderLink('new',null, true); elseif(REAL_ID == '9999997') $link = PROTOCOL . '://' . WWW . DOMAIN . showHeaderLink('best',null, true); elseif(REAL_ID == '9999998') $link = PROTOCOL . '://' . WWW . DOMAIN . showHeaderLink('week',null, true); elseif(REAL_ID == '9999999') $link = PROTOCOL . '://' . WWW . DOMAIN . showHeaderLink('month',null, true); else { if (PAGE_TYPE == 'archive') { $page_type = CURRENT_PAGE_NUM != 'best' && CURRENT_PAGE_NUM > 1 ? 'archive/' : 'archive'; } else $page_type = ''; $link = PROTOCOL . '://' . WWW . DOMAIN . getNicheFolder(DIR_ID, DIR_NAME) . $page_type; if (CANONICAL_PAGINATION && CURRENT_PAGE_NUM != 'best' && CURRENT_PAGE_NUM > 1) $link .= CURRENT_PAGE_NUM; } echo ' '; if ((PAGE_TYPE == 'keywords' && !INDEX_KEYWORDS) || (PAGE_TYPE == 'search' && !INDEX_SEARCH) || (PAGE_TYPE == 'history' && !INDEX_HISTORY) || (PAGE_TYPE == 'archive' && !INDEX_ARCHIVE) || (PAGE_TYPE == 'new' && !INDEX_NEW) || (REAL_ID == 9999997 && !INDEX_ALLTIME_BEST) || (REAL_ID == 9999998 && !INDEX_WEEK_BEST) || (REAL_ID == 9999999 && !INDEX_MONTH_BEST) || (CURRENT_PAGE_NUM > 1 && !INDEX_PAGINATION)) { echo ' '; } } function ShowAlternateLinks() { // Displays alternate links global $ALL_LANGS; if (!MULTI_LANGUAGES) return true; $result = "\n"; if (PAGE_TYPE == 'keywords') $path = PROTOCOL . '://' . WWW . DOMAIN . getKeywordsFolder(DEFAULT_LANG); elseif (PAGE_TYPE == 'history') $path = PROTOCOL . '://' . WWW . DOMAIN . getHistoryFolder(DEFAULT_LANG); elseif (PAGE_TYPE == 'search') $path = PROTOCOL . '://' . WWW . DOMAIN . getSearchFolder(DEFAULT_LANG); else { $page_type = PAGE_TYPE == 'archive' ? '/archive' : ''; $path = PROTOCOL . '://' . WWW . DOMAIN . getNicheFolder(DIR_ID, DIR_NAME, DEFAULT_LANG) . $page_type; if (CANONICAL_PAGINATION && CURRENT_PAGE_NUM != 'best' && CURRENT_PAGE_NUM > 1) $path .= '/' . CURRENT_PAGE_NUM; } $result .= ' \n"; foreach ($ALL_LANGS as $language) { if (PAGE_TYPE == 'keywords') $path = PROTOCOL . '://' . WWW . DOMAIN . getKeywordsFolder($language); elseif (PAGE_TYPE == 'history') $path = PROTOCOL . '://' . WWW . DOMAIN . getHistoryFolder($language); elseif (PAGE_TYPE == 'search') $path = PROTOCOL . '://' . WWW . DOMAIN . getSearchFolder($language); else { $page_type = PAGE_TYPE == 'archive' ? '/archive' : ''; $path = PROTOCOL . '://' . WWW . DOMAIN . getNicheFolder(DIR_ID, DIR_NAME, $language) . $page_type; if (CANONICAL_PAGINATION && CURRENT_PAGE_NUM != 'best' && CURRENT_PAGE_NUM > 1) $path .= '/' . CURRENT_PAGE_NUM; } $result .= ' \n"; } echo $result; return true; } function NeedLinks() { /* Returns true if it's needed to show 'Best' & 'Latest' links We don't need to show those links on 'All time best', 'Month best' & 'Week best' pages */ return PAGE_TYPE == 'keywords' || PAGE_TYPE == 'history' || PAGE_TYPE == 'search' || REAL_ID == 9999997 || REAL_ID == 9999998 || REAL_ID == 9999999 ? false : true; } ?>
    Fatal error: Uncaught Error: Call to undefined function trimTags() in /var/www/vhosts/pornohd.top/xporn.uk/buran/niche.php:1654 Stack trace: #0 /var/www/vhosts/pornohd.top/xporn.uk/buran/niche.php(420): drawNiche() #1 /var/www/vhosts/pornohd.top/xporn.uk/buran/niche.php(1802): parseRequest() #2 /var/www/vhosts/pornohd.top/xporn.uk/router.php(74): include('/var/www/vhosts...') #3 {main} thrown in /var/www/vhosts/pornohd.top/xporn.uk/buran/niche.php on line 1654