You'll want to try pulling it out - it would save a lot of headache if you could clean up and re-glue that joint.
There's small odds that you could cut the loose pipe short, then break out the remaining pipe in the fittings, and then clean the fitting up enough for re-use, if you can't just yank it out.
Otherwise you'll need all the fittings in the picture, plus 3 couplings (or unions, but those tend to be rare in PVC.) You 'll also need more pipe, as some will go for scrap with the fittings. A solvent-welded pipe is almost impossible to re-use.
You will also want PVC cement, AND primer AND cleaner. Dry everything well (if you can't, be sure to get special "wet use" cement - but try to dry it well...) Then clean both parts of the connection with the cleaner, and wait a minute; prime both parts with the primer, an wait as per directions (not too fast, but not so slowly it dries); then apply glue, as per directions, to both parts, and insert with a twist (1/4 turn is a typical goal) then hold them tight for a minute or so (they will try to push out somewhat due to the glue making the pipe expand a bit and the fittings being slightly tapered.) To get something like this where you are working in the middle together (without unions), you typically need to do at least one section of pipe on both ends at once, which is little tricky.
Or you can try to kludge it with rubber couplings (shudder, though it beats nothing for a temporary fix.)
Beware of old PVC cement - if it's not liquid, but has headed more to the "cold honey - taffy - brick" consistency, it's useless, even if you can still manage to spread it. New glue is cheap - buy small cans unless you have a large project in a short time, it does not keep well. It should be at least as runny as warm honey, probably a bit runnier.