$posts_attachments = array(); $attachments = array(); if (is_attachments_enabled($board)) { $posts_attachments = posts_attachments_get_by_posts($posts); $attachments = attachments_get_by_posts($posts); } $htfilter = function ($hidden_thread, $user) { if ($hidden_thread['user'] == $user) { return true; } return false; }; $hidden_threads = hidden_threads_get_filtred_by_boards(array($board), $htfilter, $_SESSION['user']); $upload_types = upload_types_get_by_board($board['id']); if (is_macrochan_enabled($board)) { $macrochan_tags = macrochan_tags_get_all(); } else { $macrochan_tags = array(); } if ($banners_board_id) { $banners = images_get_by_board($banners_board_id); if (count($banners) > 0) { $smarty->assign('banner', $banners[rand(0, count($banners) - 1)]); } } $favorites = favorites_get_by_user($_SESSION['user']); $smarty->assign('show_control', is_admin() || is_mod()); $smarty->assign('categories', $categories); $board['annotation'] = $board['annotation'] ? html_entity_decode($board['annotation'], ENT_QUOTES, Config::MB_ENCODING) : $board['annotation']; $smarty->assign('board', $board); $smarty->assign('boards', $boards);
call_user_func(Logging::$f['UPDATE_MACROCHAN_USE']); // Download data. include Config::ABS_PATH . '/res/macrochan_data.php'; // Remove tags what not exist anymore. $tags_removed = 0; $tag_names = kotoba_array_column($MACROCHAN_TAGS, 1); foreach (macrochan_tags_get_all() as $tag) { if (!in_array($tag['name'], $tag_names)) { macrochan_tags_delete_by_name($tag['name']); $tags_removed++; } } echo "Tags removed: {$tags_removed}<br>\n"; // Add tags what we havent. $tags_added = 0; $tag_names = kotoba_array_column(macrochan_tags_get_all(), 1); foreach ($MACROCHAN_TAGS as $tag) { if (!in_array($tag[1], $tag_names)) { macrochan_tags_add($tag[1]); $tags_added++; } } echo "Tags added: {$tags_added}<br>\n"; // Remove images what not exist anymore. $images_removed = 0; $image_names = kotoba_array_column($MACROCHAN_IMAGES, 1); foreach (macrochan_images_get_all() as $image) { if (!in_array($image['name'], $image_names)) { macrochan_images_delete_by_name($image['name']); $images_removed++; }
/** * Check if macrochan tag valid. * @param string $name Tag name. * @return string|boolean Returns safe macrochan tag name or boolean FALSE if * any error occurred and set last error to appropriate error object. */ function macrochan_tags_check($name) { $macrochan_tags = macrochan_tags_get_all(); foreach ($macrochan_tags as $tag) { if ($tag['name'] === $name) { return $tag['name']; } } kotoba_set_last_error(new MacrochanTagNameError()); return FALSE; }