public function buildPost($post, $page) { $post_files = $this->db->select("post_files")->fields("post_files")->condition("file_board", $this->board->board_id)->condition("file_post", $post->post_id)->execute()->fetchAll(); foreach ($post_files as $line) { $post->file_name[] = $line->file_name; $post->file_type[] = $line->file_type; $post->file_original[] = $line->file_original; $post->file_size[] = $line->file_size; $post->file_size_formatted[] = $line->file_size_formatted; $post->file_image_width[] = $line->file_image_width; $post->file_image_height[] = $line->file_image_height; $post->file_thumb_width[] = $line->file_thumb_width; $post->file_thumb_height[] = $line->file_thumb_height; } $post = $this->formatPost($post, $page); if (!empty($post->file_type)) { foreach ($post->file_type as $key => $type) { if (isset($this->board->embeds) && in_array($type, $this->board->embeds)) { $post->videobox = $this->embeddedVideoBox($post); } if ($type == 'mp3') { //Grab the ID3 info. TODO: Make this work for load-balanced boards. // include getID3() library require_once KX_ROOT . '/lib/getid3/getid3.php'; // Initialize getID3 engine $getID3 = new getID3(); $post->id3[$key] = $getID3->analyze(KX_BOARD . '/' . $this->board->board_name . '/src/' . $post->file_name[$key] . '.mp3'); getid3_lib::CopyTagsToComments($post->id3[$key]); } if ($type != 'jpg' && $type != 'gif' && $type != 'png' && $type != '' && !in_array($type, $this->board->embeds)) { if (!isset($filetype_info[$type])) { $filetype_info[$type] = kxFunc::getFileTypeInfo($type); } $post->nonstandard_file[$key] = kxEnv::Get('kx:paths:main:path') . '/public/filetypes/' . $filetype_info[$type][0]; if ($post->post_thumb_width != 0 && $post->post_thumb_height != 0) { if (file_exists(KX_BOARD . '/' . $this->board->board_name . '/thumb/' . $post->file_name[$key] . 's.jpg')) { $post->nonstandard_file[$key] = kxEnv::Get('kx:paths:main:path') . '/' . $this->board->board_name . '/thumb/' . $post->file_name[$key] . 's.jpg'; } elseif (file_exists(KX_BOARD . '/' . $this->board['name'] . '/thumb/' . $post['file'] . 's.png')) { $post->nonstandard_file[$key] = kxEnv::Get('kx:paths:main:path') . '/' . $this->board->board_name . '/thumb/' . $post->file_name[$key] . 's.png'; } elseif (file_exists(KX_BOARD . '/' . $this->board['name'] . '/thumb/' . $post['file'] . 's.gif')) { $post->nonstandard_file[$key] = kxEnv::Get('kx:paths:main:path') . '/' . $this->board->board_name . '/thumb/' . $post->file_name[$key] . 's.gif'; } else { $post->post_thumb_width[$key] = $filetype_info[$type][1]; $post->post_thumb_height[$key] = $filetype_info[$type][2]; } } else { $post->post_thumb_width[$key] = $filetype_info[$type][1]; $post->post_thumb_height[$key] = $filetype_info[$type][2]; } } } } return $post; }