$catalogjson, 'count' => count( $log['THREADS'] ), 'slug' => BOARD_DIR, 'anon' => S_ANONAME, 'mtime' => time(), 'pagesize' => DEF_PAGES ); if (!REPLIES_SHOWN && IS_REBUILDD) { $catalogjson['no_lr'] = true; } if (SHOW_COUNTRY_FLAGS) { $catalogjson['flags'] = true; } if( SPOILERS ) $catalogjson['custom_spoiler'] = (int)SPOILER_NUM; $catalogjson = json_encode( $catalogjson ); $catalog = catalog( $catalogjson ); print_page( INDEX_DIR . 'catalog.html', $catalog ); return true; } function catalog_thread($res, &$json, $pos) { global $log; $reps = $res['replycount']; $sub = $res['sub']; $imgs = $res['imgreplycount']; $last_reply_id = null; $capcodelist = array(); if (TEXT_ONLY) { $time_prop = 'now'; } else { $time_prop = 'time'; } foreach( $res['children'] as $reply => $unused ) { $last_reply_id = $reply; if( META_BOARD && $log[$reply]['capcode'] != 'none' ) { $tCapcode = $log[$reply]['capcode']; if( $tCapcode == 'admin_highlight' ) $tCapcode = 'admin'; if( $tCapcode != 'none' ) { $capcodelist[$tCapcode] = 1; } } } if ($last_reply_id === null) { $last_reply = array( 'id' => $res['no'] ); } else { $lr_data = $log[$last_reply_id]; $last_reply = array( 'id' => $last_reply_id, 'date' => $lr_data['time'] ); if( $lr_data['capcode'] != 'none' ) $last_reply['capcode'] = $lr_data['capcode']; $force_anon = ( ( FORCED_ANON || META_BOARD ) && $lr_data['capcode'] != 'admin' && $lr_data['capcode'] != 'admin_highlight' ); if( !$force_anon ) { if( strpos( $lr_data['name'], ' ' ) !== false ) { list( $last_reply['author'], $last_reply['trip'] ) = explode( ' ', $lr_data['name'] ); } else { $last_reply['author'] = $lr_data['name']; } } else { $last_reply['author'] = S_ANONAME; } } $json[$res['no']] = array( 'date' => $res[$time_prop], 'file' => mb_convert_encoding($res['filename'], 'UTF-8', 'UTF-8') . $res['ext'], 'r' => $reps, 'i' => $imgs, 'lr' => $last_reply, 'b' => $pos ); /* if( META_BOARD && $capcodelist ) { $json[$res['no']]['capcodereps'] = implode(',', array_keys($capcodelist)); } */ if ($res['capcode'] == 'none') { if (SHOW_COUNTRY_FLAGS && (!ENABLE_BOARD_FLAGS || $res['board_flag'] == '')) { $json[$res['no']]['country'] = $res['country']; } } $com = $res['com']; if( strpos( $com, 'class="abbr"' ) !== false ) { $com = preg_replace( '#()+(.+)$#s', '', $com ); } if (!TEXT_ONLY) { $com = preg_replace( '#()+#', ' ', $com ); } else { $com = preg_replace( '#()+#', "\n", $com ); } if (BOARD_DIR === 'b') { // fixme, hardcoded for now $com = truncate_comment($com, 300, true); } else { if (SJIS_TAGS) { $com = preg_replace('//', '[SJIS]', $com); } $com = strip_tags($com, ''); } $has_spoilers = (bool)SPOILERS; if (!$res['permaage'] && !$res['sticky']) { if( $reps >= MAX_RES ) $json[$res['no']]['bumplimit'] = 1; if( $imgs >= MAX_IMGRES ) $json[$res['no']]['imagelimit'] = 1; } if( $res['sticky'] ) $json[$res['no']]['sticky'] = 1; if( $res['closed'] ) $json[$res['no']]['closed'] = 1; if( $res['capcode'] != 'none' ) $json[$res['no']]['capcode'] = $res['capcode']; $force_anon = ( ( FORCED_ANON || META_BOARD ) && $res['capcode'] != 'admin' && $res['capcode'] != 'admin_highlight' ); if( !$force_anon ) { if( strpos( $res['name'], ' ' ) !== false ) { list( $json[$res['no']]['author'], $json[$res['no']]['trip'] ) = explode( ' ', $res['name'] ); } else { $json[$res['no']]['author'] = $res['name']; } } else { $json[$res['no']]['author'] = S_ANONAME; } if( $res['fsize'] != 0 && $res['filedeleted'] != 1 ) { $json[$res['no']]['imgurl'] = $res['tim']; $json[$res['no']]['tn_w'] = $res['tn_w']; $json[$res['no']]['tn_h'] = $res['tn_h']; } if( $res['filedeleted'] == 1 ) $json[$res['no']]['imgdel'] = true; if( strpos( $res['sub'], 'SPOILER<>' ) !== false ) { $json[$res['no']]['imgspoiler'] = true; $sub = substr( $res['sub'], 9 ); } $json[$res['no']]['sub'] = $sub; $json[$res['no']]['teaser'] = $com; } function catalog($catjson) { $nav = file_get_contents_cached( NAV_TXT ); $foot = file_get_contents_cached( NAV2_TXT ); $nav = preg_replace( '/href="(\/\/boards.(?:4chan|4channel).org)?\/([a-z0-9]+)\/"/', 'href="$1/$2/catalog"', $nav ); $nav = preg_replace( '/href="(\/\/boards.(?:4chan|4channel).org)?\/f\/catalog"/', 'href="$1/f/"', $nav ); $title = strip_tags( TITLE ); $js = ''; // danbo ads start if (defined('ADS_DANBO') && ADS_DANBO) { $js .= ''; $js .= ''; } // danbo ads end // PubFuture if (DEFAULT_BURICHAN) { $js .= ''; } if (TEST_BOARD) { // Main catalog JS $js .= ''; // Painter JS + CSS if (ENABLE_PAINTERJS) { $js .= '' . ''; } // Core JS $js .= ''; } else { // Main catalog JS $js .= ''; // Painter JS + CSS if (ENABLE_PAINTERJS) { $js .= '' . ''; } // Core JS $js .= ''; } $css = STATIC_SERVER . 'css'; $cssv = TEST_BOARD ? CSS_VERSION_TEST : CSS_VERSION_CATALOG; $style_group = style_group(); $flags = SHOW_COUNTRY_FLAGS ? '' : ''; $titlepart = $subtitle = ''; if( TITLE_IMAGE_TYPE == 1 ) { $titleimg = rand_from_flatfile( YOTSUBA_DIR, 'title_banners.txt' ); $titlepart .= ''; } elseif( TITLE_IMAGE_TYPE == 2 ) { $titlepart .= ''; } if( defined( 'SUBTITLE' ) ) { $subtitle = '' . SUBTITLE . ''; } /** * ADS */ $topad = ''; $bottomad = ''; if (defined('AD_CUSTOM_BOTTOM') && AD_CUSTOM_BOTTOM) { $bottomad .= '' . AD_CUSTOM_BOTTOM . ''; }/* else if (defined('AD_ABC_BOTTOM_MOBILE') && AD_ABC_BOTTOM_MOBILE) { $bottomad .= ''; } else if (defined('AD_BIDGEAR_BOTTOM') && AD_BIDGEAR_BOTTOM) { $bottomad .= ''; }*/ else if (defined('ADS_DANBO') && ADS_DANBO) { $bottomad .= '[Advertise on 4chan]'; } $favicon = FAVICON; $meta_robots = META_ROBOTS; $meta_description = META_DESCRIPTION; $meta_keywords = META_KEYWORDS; $body_class = explode('_', $style_group); $body_class = $body_class[0]; $body_class .= ' is_catalog board_' . BOARD_DIR; $canonical = ''; $embedearly = EMBEDEARLY; $embedlate = EMBEDLATE; $adembedearly = AD_EMBEDEARLY; $start_thread = S_FORM_THREAD; $jsVersion = TEST_BOARD ? JS_VERSION_TEST : JS_VERSION; $comlen = MAX_COM_CHARS; $maxfs = MAX_KB * 1024; $jsCooldowns = json_encode(array( 'thread' => RENZOKU3, 'reply' => RENZOKU, 'image' => RENZOKU2 )); if (defined('CSS_EVENT_NAME') && CSS_EVENT_NAME) { $event_css_html = 'Special'; // Christmas 2021 if (CSS_EVENT_NAME === 'tomorrow') { $js .= << JJS; } $js .= ''; } else { $event_css_html = ''; } if (PARTY) { $partyHats = 'var partyHats = "' . PARTY_IMAGE . '";'; } else { $partyHats = ''; } if (ENABLE_ARCHIVE) { $archive_link = ' ' . S_ARCHIVE . ''; } else { $archive_link = ''; } if (TEXT_ONLY) { $text_only = 'var text_only = true;'; $body_text_css = ' text_only'; $ctrl_css = ' hidden'; } else { $text_only = $body_text_css = ''; $ctrl_css = ''; } $adg_js = 'var _adg = 1;'; $postform = ''; form( $postform, 0, '', false, true ); $cat = << $title - Catalog - 4chan $canonical $js $flags $embedearly $adembedearly $nav $titlepart $title $subtitle $topad $start_thread $postform Return$archive_link Bottom Refresh — Filtered threads: — Hidden threads: Show — Search results for: Sort By: Bump order Last reply Creation date Reply count Image Size: Small Large Show OP Comment: Off On Filters Search ✖ Return$archive_link Top Refresh — Filtered threads: — Hidden threads: Show — Search results for: $bottomad Style: Yotsuba Yotsuba‌ B Futaba Burichan Tomorrow Photon$event_css_html $foot Your web browser must have JavaScript enabled in order for this site to display correctly. $embedlate HTML; return $cat; }