Circuit to detect in which port sensor inserted
This should be possible to do if you use a window comparator, and detect whether the input is pulled 'high' or 'low' from a known midpoint. We take advantage of the fact that both NPN and PNP type sensors use open-collector outputs.
Example (simulate it here):

The window comparator is high when the input voltage is between 1/3 and 1/3 of 12V (that is, between 4 and 8V). If it is pulled above that by the PNP, or below that by the NPN, the output goes low.
The comparators have open-drain outputs and are wire-OR, so this can tie to your logic with the appropriate logic voltage pull-up. I show 5V here; it can be 3.3V or whatever your system requires.
Basically, this looks like an NPN type to your system, so you need only 1 input. If you want to use two, then you can separate the comparator outputs and detect whether you have a PNP or NPN type plugged in.
Like this (simulate it here):

The upper comparator goes low when NPN is inserted and active, the lower one when PNP is inserted and active. So now you know which kind of sensor is in use, if it matters to you.