array("long" => "Hentai", "short" => "[H]"), 6 => array("long" => "Porn", "short" => '[P]'), 1 => array("long" => "Japanese", "short" => "[J]"), 2 => array("long" => "Anime", "short" => "[A]"), 3 => array("long" => "Game", "short" => "[G]"), 5 => array("long" => "Loop", "short" => "[L]"), 4 => array("long" => "Other", "short" => "[?]") ); return $tags; } function updatelog( $resno = 0, $rebuild = 0 ) { $tags = upboard_tags(); $imgdir = IMG_DIR2; $thumbdir = THUMB_DIR2; $imgurl = STATIC_IMG_DIR2; $sqlog = SQLLOG; // to make this a shite load easier $find = false; $resno = (int)$resno; log_cache(); if( $resno ) { $result = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `root` > 0 AND `no` = '$resno'" ); if( $result ) { $find = mysql_fetch_row( $result ); mysql_free_result( $result ); } if( !$find ) { $result2 = mysql_board_call( "SELECT `no`, `resto` FROM `$sqlog` WHERE `no` = '$resno'" ); list( $chkno, $resto ) = mysql_fetch_row( $result2 ); if( !$resto ) { error( S_REPORTERR ); } mysql_free_result( $result2 ); $result3 = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `no` = '$resto'" ); if( $result3 ) { $chkfind = mysql_fetch_row( $result3 ); mysql_free_result( $result3 ); } if( !$chkfind ) { error( S_REPORTERR ); } } } if( $resno ) { if( !$treeline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `root` > 0 AND `no` = '$resno' ORDER BY `root` DESC" ) ) { echo S_SQLFAIL; } } else { if( !$treeline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `root` > 0 ORDER BY `root` DESC" ) ) { echo S_SQLFAIL; } } if( $resno ) { //logtime("Generating thread JSON"); if( ENABLE_JSON ) generate_thread_json( $resno ); //$treeline = array( $resno ); //logtime("Formatting thread page"); } else { //logtime("Generating index JSON"); if( ENABLE_JSON_INDEXES ) generate_index_json(); if( ENABLE_JSON_CATALOG ) generate_board_catalogue(); if( ENABLE_JSON_THREADS ) generate_board_threads_json(); //$treeline = $log['THREADS']; //logtime("Formatting index page"); } if( !$result = mysql_board_call( "SELECT MAX(`no`) FROM `$sqlog`" ) ) { echo S_SQLFAIL; } $row = mysql_fetch_array( $result ); $lastno = (int)$row[0]; mysql_free_result( $result ); $counttree = mysql_num_rows( $treeline ); if( !$counttree ) { $logfilename = SELF_PATH2_FILE; $dat = ''; head( $dat, $resno ); form( $dat, $resno ); print_page( $logfilename, $dat ); } $page = 0; $dat = ''; head( $dat, $resno ); form( $dat, $resno ); if( !$resno ) { $st = $page; } $dat .= '
'; // here we go if( !$resno ) { $dat .= << No. Name File Tag Subject Size Date Replies HTML; } $delarr = array(); $limit = (int)round( DEF_PAGES * 0.83 ); $lim = DEF_PAGES - $limit; if( !$result = mysql_board_call( "SELECT COUNT(*) FROM `$sqlog` WHERE `resto` = '0'" ) ) { echo S_SQLFAIL; } $row = mysql_fetch_array( $result ); $countth = (int)$row[0]; if( $limit < $countth ) { if( !$result = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `resto` = '0' ORDER BY `no` ASC LIMIT $lim" ) ) { echo S_SQLFAIL; } while( $row = mysql_fetch_array( $result ) ) { $delarr[] = (int)$row[0]; } } mysql_free_result( $result ); for( $i = $st; $i < $st + DEF_PAGES; $i++ ) { // NO PAGES FOR /f/ (apparently!) //if( !mysql_fetch_assoc($treeline) ) continue; $thistree = mysql_fetch_assoc( $treeline ); if( !$thistree ) break; extract( $thistree ); //list($no,$sticky,$permasage,$closed,$now,$name,$email,$sub,$com,$host,$pwd,$filename,$ext,$w,$h,$tn_w,$tn_h,$tim,$time,$md5,$fsize,$root,$resto,$filedeleted,$tmd5,$id,$capcode)=mysql_fetch_row($treeline); $tag_matches = array(); $tag = 4; if( preg_match( '/^(\d+)\|/', $sub, $tag_matches ) ) { $tag = (int)( $tag_matches[1] ); $sub = preg_replace( '/^(\d+)\|/', '', $sub ); } if( $resno ) { if( !$no ) { break; } $sub = str_replace( ',', ',', $sub ); $emailstart = $emailend = ''; //if( $email != '' ) { // $email = emailencode($email); // $emailstart = ''; // $emailend = ''; //} // NEW CAPCODE STUFF switch( $capcode ) { case 'admin': $capcodeStart = ' ## Admin'; $capcode_class = ' capcodeAdmin'; $capcode = ' This user is the 4chan Administrator.'; $highlight = ''; break; case 'admin_highlight': $capcodeStart = ' ## Admin'; $capcode_class = ' capcodeAdmin'; $capcode = ' This user is the 4chan Administrator.'; $highlight = ' highlightPost'; break; case 'mod': $capcodeStart = ' ## Mod'; $capcode_class = ' capcodeMod'; $capcode = ' This user is a 4chan Moderator.'; $highlight = ''; break; case 'developer': $capcodeStart = ' ## Developer'; $capcode_class = ' capcodeDeveloper'; $capcode = ' This user is a 4chan Developer.'; $highlight = ''; break; case 'manager': $capcodeStart = ' ## Manager'; $capcode_class = ' capcodeManager'; $capcode = ' Manager Icon'; $highlight = ''; break; case 'verified': $capcodeStart = ' ## Verified'; $capcode_class = ' capcodeVerified'; $capcode = ''; $highlight = ''; break; default: $capcode = $capcodeStart = $highlight = $capcode_class = ''; break; } $com = auto_link( $com, $resno ); $subshort = $sub; if( mb_strlen( $sub ) > 28 ) { $subshort = '' . mb_substr( $sub, 0, 25, 'UTF-8' ) . '(...)'; } $file = ''; if( $ext ) { $img = IMG_DIR . $tim . $ext; $displaysrc = $imgdir . rawurlencode( $filename ) . $ext; $src = IMG_DIR . $filename . $ext; $longname = $filename . $ext; if( $fsize >= 1048576 ) { $size = round( $fsize / 1048576, 2 ) . ' M'; } elseif( $fsize >= 1024 ) { $size = round( $fsize / 1048 ) . ' K'; } else { $size = $fsize . ' '; } if( $filedeleted ) { $imgsrc = '[File Deleted]'; $class = ''; } else { $imgsrc = '' . S_PICNAME . ': ' . $longname . '-(' . $size . 'B, ' . $w . 'x' . $h . ', ' . $tags[$tag]['long'] . ')'; $class = ' class="fileInfo"'; } $imgClassStart = ( $imgsrc == '' ) ? '' : '
'; $imgClassEnd = ( $imgsrc == '' ) ? '' : '
'; $file = << $imgClassStart $imgsrc $imgClassEnd
HTML; } // Main creatio if( $sticky == 1 ) { $threadmodes .= ' Sticky'; } if( $closed == 1 ) { $threadmodes .= ' Closed'; } $href = ( $resno ) ? $no . PHP_EXT2 : RES_DIR2 . $no . PHP_EXT2; $quote = ( $resno ) ? 'javascript:quote(\'' . $no . '\');' : $href . '#q' . $no; $extra = ''; $stickies = array(); if( !$result = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `sticky` = '1'" ) ) { echo S_SQLFAIL; } while( $stickrow = mysql_fetch_row( $result ) ) { list( $stickno ) = $stickrow; $stickies[] = $stickno; } if( in_array( $no, $delarr ) ) { if( in_array( $no, $stickies ) ) { $stuck = 1; } if( $stuck != 1 ) { $extra = '' . S_OLD . ''; } } $dat .= <<
$file
$com
$postInfo
$extra HTML; if( !$resline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `resto` = '$no' ORDER BY `no`" ) ) { echo S_SQLFAIL; } $countres = mysql_num_rows( $resline ); $s = 0; while( $resrow = mysql_fetch_assoc( $resline ) ) { extract( $resrow ); //list($no,$sticky,$permasage,$closed,$now,$name,$email,$sub,$com,$host,$pwd,$filename,$ext,$w,$h,$tn_w,$tn_h,$tim,$time,$md5,$fsize,$root,$resto)=$resrow; if( !$no ) { break; } $emailstart = $emailend = ''; //if( $email != '' ) { // $email = emailencode($email); // $emailstart = ''; // $emailend = ''; //} // NEW CAPCODE STUFF switch( $capcode ) { case 'admin': $capcodeStart = ' ## Admin'; $capcode_class = ' capcodeAdmin'; $capcode = ' This user is the 4chan Administrator.'; $highlight = ''; break; case 'admin_highlight': $capcodeStart = ' ## Admin'; $capcode_class = ' capcodeAdmin'; $capcode = ' This user is the 4chan Administrator.'; $highlight = ' highlightPost'; break; case 'mod': $capcodeStart = ' ## Mod'; $capcode_class = ' capcodeMod'; $capcode = ' This user is a 4chan Moderator.'; $highlight = ''; break; case 'developer': $capcodeStart = ' ## Developer'; $capcode_class = ' capcodeDeveloper'; $capcode = ' This user is a 4chan Developer.'; $highlight = ''; break; case 'manager': $capcodeStart = ' ## Manager'; $capcode_class = ' capcodeManager'; $capcode = ' Manager Icon'; $highlight = ''; break; default: $capcode = $capcodeStart = $highlight = $capcode_class = ''; break; } $com = auto_link( $com, $no ); $subshort = $sub; if( mb_strlen( $sub ) > 28 ) { $subshort = '' . mb_substr( $sub, 0, 25, 'UTF-8' ) . '(...)'; } $href = ( $resno ) ? $resto . PHP_EXT2 : RES_DIR2 . $resto . PHP_EXT2; $quote = ( $resno ) ? 'javascript:quote(\'' . $no . '\');' : $href . '#q' . $no; $dat .= <<
>>
$com
HTML; } // end thread $dat .= '
'; //clearstatcache(); mysql_free_result( $resline ); $p++; break; } else { /** BUILD /f/ INDEX **/ if( !$resline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `resto` = '$no' ORDER BY `no`" ) ) { echo S_SQLFAIL; } $countres = mysql_num_rows( $resline ); if( $fsize >= 1048576 ) { $kbsize = round( ( $fsize / 1048576 ), 2 ) . ' M'; } elseif( $fsize >= 1024 ) { $kbsize = round( $fsize / 1024 ) . ' K'; } else { $kbsize = $fsize . ' '; } $kbsize .= 'B'; $emailstart = $emailend = ''; //if( $email != '' ) { // $email = emailencode($email); // $emailstart = ''; // $emailend = ''; //} if( mb_strlen( $filename ) > 25 ) { $shortname = mb_substr( $filename, 0, 25, 'UTF-8' ) . "(...)"; } else { $shortname = $filename; } if( $kbsize != '0 B' ) { $class = ''; if( in_array( $no, $delarr ) ) { $class = 'class="oldpost"'; } $texttag = $tags[$tag]['short']; if ($sub != '') { $sub = str_replace(',', ',', $sub); if (mb_strlen($sub) > 30) { $shortsub = mb_substr($sub, 0, 30, 'UTF-8') . '(...)'; } else { $shortsub = $sub; } } else { $com = str_replace(',', ',', $com); $com = explode('<', $com)[0]; if (mb_strlen($com) > 30) { $shortsub = mb_substr($com, 0, 30, 'UTF-8') . '(...)'; } else { $shortsub = $com; } } $replink = RES_DIR2 . $no . PHP_EXT2; $semantic_url = generate_href_context($sub, $com); if ($semantic_url != '') { $semantic_url = "/$semantic_url"; } $filelink = IMG_DIR2 . rawurlencode( $filename ) . '.swf'; // NEW CAPCODE STUFF if( $capcode === 'admin' ) { $capcodeStart = ' ## Admin'; $capcode_class = ' capcodeAdmin'; $capcode = ' This user is the 4chan Administrator.'; $highlight = ''; } elseif( $capcode === 'mod' ) { $capcodeStart = ' ## Mod'; $capcode_class = ' capcodeMod'; $capcode = ' This user is a 4chan Moderator.'; $highlight = ''; } elseif( $capcode === 'admin_highlight' ) { $capcodeStart = ' ## Admin'; $capcode_class = ' capcodeAdmin'; $capcode = ' This user is the 4chan Administrator.'; $highlight = ' highlightPost'; } else { $capcode = $capcodeStart = $highlight = $capcode_class = ''; } $oldclass = in_array( $no, $delarr ) ? ' class="highlightPost"' : ''; $dat .= << $no $emailStart$name$emailEnd$capcodeStart$capcode [$shortname] $texttag $shortsub $kbsize $now $countres [Reply] HTML; } //clearstatcache(); mysql_free_result( $resline ); } // end /f/ } // no pages for /f/ $lang = $resno ? S_FORM_REPLY : S_FORM_THREAD; if( !$resno ) { $dat .= '
'; } else { $dat .= '
'; $dat .= '
' . $lang . '
'; } if (!$resno) { $dat .= '
'; } else { $dat .= '
'; } /* if( AD_BOTTOM_ENABLE == 1 ) { $bottomad = ""; if( defined( "AD_BOTTOM_TEXT" ) && AD_BOTTOM_TEXT ) { $bottomad .= '
' . ad_text_for( AD_BOTTOM_TEXT ) . '
' . (defined('AD_BOTTOM_PLEA') ? AD_BOTTOM_PLEA : ''); } else if( defined( "AD_BOTTOM_TABLE" ) && AD_BOTTOM_TABLE ) { list( $bottomimg, $bottomlink ) = rid( AD_BOTTOM_TABLE, 1 ); $bottomad .= "
\"\"
"; } if( $bottomad ) { $dat .= "$bottomad
"; } } */ /** * ADS */ if (defined('AD_ADGLARE_BOTTOM') && AD_ADGLARE_BOTTOM) { $dat .= '

'; } if (defined('AD_ADGLARE_BOTTOM_MOBILE') && AD_ADGLARE_BOTTOM_MOBILE) { $dat .= '

'; } if (defined('AD_RC_BOTTOM') && AD_RC_BOTTOM) { $dat .= '

'; } if (defined('AD_RC_BOTTOM_MOBILE') && AD_RC_BOTTOM_MOBILE) { $dat .= '

'; } if (defined('AD_ADNIUM_BOTTOM_MOBILE') && AD_ADNIUM_BOTTOM_MOBILE) { $dat .= '

'; } $dat .= '
' . S_REPDEL . $resredir . ' [' . S_DELPICONLY . '] '; if( !defined( 'CSS_FORCE' ) ) { $dat .= 'Style: '; } $dat .= '
'; foot( $dat ); if( $page == 0 ) { $logfilename = SELF_PATH2_FILE; } if( $resno ) { $logfilename = RES_DIR . $resno . PHP_EXT; print_page( $logfilename, $dat ); if( !$rebuild ) { updatelog(); } } else { print_page( $logfilename, $dat ); } mysql_free_result( $treeline ); } function form( &$dat, $resno, $admin = '' ) { global $thread_unique_ips; $maxbyte = MAX_KB * 1024; $no = $resno; $closed = 0; $msg = $hidden = ''; $tags = upboard_tags(); if( $resno ) { if( !$cchk = mysql_board_call( "select closed from `" . SQLLOG . "` where no=" . $resno ) ) { echo S_SQLFAIL; } list( $closed ) = mysql_fetch_row( $cchk ); $msg .= '
'; } else { $msg .= '
'; } if( $admin ) { $hidden = ''; $msg = '

' . S_NOTAGS . '

'; } if( $closed != 1 ) { $dat .= $msg; form_ads( $dat ); $dat .= '
'; if( $no ) { $dat .= ' '; } $dat .= ' '; // TODO: ADS $spoilers = ''; if( SPOILERS == 1 ) { $spoilers = '[]'; } if( FORCED_ANON == 1 ) { $dat .= ' '; if( $spoilers ) { if( !$stripm ) $dat .= ' '; } } else { $dat .= ' '; if ($resno) { $dat .= ' '; } else { $dat .= ' '; } if( $spoilers ) { if( !$stripm ) $dat .= ' '; } } if( $admin ) { $dat .= ' '; } //if( EXPANDING_POST_ ) $dat .= ' '; if( CAPTCHA ) { $dat .= ' '; } if( !$resno ) { $dat .= ' '; } if ($resno && SHOW_THREAD_UNIQUES) { $unique = $thread_unique_ips; if ($unique) { $unique_plural = $unique > 1 ? 'are' : 'is'; $unique = sprintf("
  • There $unique_plural " . S_UNIQUE_POSTS_TH . '
  • ', $unique, $unique > 1 ? 's' : ''); } else { $unique = ''; } } elseif (SHOW_UNIQUES) { $unique = sprintf('
  • ' . S_UNIQUE_POSTS . '
  • ', $GLOBALS['ipcount']); } else { $unique = ''; } // XXX: mode=regist moved to the top $dat .= ' '; $blotter = $resno ? '' : get_blotter(); $dat .= '
    ' . S_EMAIL . '
    Spoilers []
    ' . S_NAME . '
    ' . S_EMAIL . '
    ' . S_EMAIL . '
    ' . S_SUBJECT . '
    ' . S_SPOILERS . ' []
    Reply ID [
    ' . S_COMMENT . '
    ' . S_CAPTCHA . ' ' . captcha_form() . '
    ' . S_PASS_NOTICE . '
    ' . S_UPLOADFILE . '
    Tag
      ' . S_RULES . ' ' . $unique . '
    ' . $blotter . '
    ' . DONATE . ' '; } else { // Closed thread form_ads( $dat ); $dat .= '
    Thread closed.
    You may not reply at this time.
    '; } if( AD_MIDDLE_ENABLE == 1 ) { $middlead = ""; if( defined( "AD_MIDDLE_TEXT" ) && AD_MIDDLE_TEXT ) { $middlead .= '
    ' . ad_text_for( AD_MIDDLE_TEXT ) . '
    ' . (defined('AD_MIDDLE_PLEA') ? AD_MIDDLE_PLEA : ''); } else if( defined( "AD_MIDDLE_TABLE" ) && AD_MIDDLE_TABLE ) { list( $middleimg, $middlelink ) = rid( AD_MIDDLE_TABLE, 1 ); $middlead .= "
    \"\"
    "; } if( $middlead ) { $dat .= "$middlead"; } } list($globalmsgtxt,$globalmsgdate) = global_msg_txt(); if( $globalmsgtxt ) { $dat .= "\n
    View Important Announcement
    " . $globalmsgtxt . "
    \n"; } if (defined('AD_ADGLARE_TOP') && AD_ADGLARE_TOP) { $dat .= '

    '; } else if (defined('AD_RC_TOP') && AD_RC_TOP) { $dat .= '

    '; } else if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) { list($_abc_left, $_abc_right) = explode(',', AD_ABC_TOP_DESKTOP); $dat .= '

    '; } if ($resno) { $dat .= '
    '; } } ?>