I need to adjust the way which a content is determined as published or not published. The editor of particular content (this is a separate non-administrative role) should have a possibility to set the published flag for particular node (it can be achieved using Override Node Options module directly or by implementing it's techniques). He should also be able to set two additional publication attributes, i.e. publication start date and publication end date (the fields can be added using Content Construction Kit). These optional fields should be used to determine node's published status. Let's say that if specified, they will override published flag.
Basically I would like to be able to add my bits of SQL code to the WHERE section of proper query or to postprocess result of such query. Maybe to overwrite some function or provide some callback. Any ideas and corrections of my reasoning are welcome. Solutions based on writing of custom modules are fully acceptable (I am a programmer).
I am not experienced with Drupal internal architecture and API enough to solve the problem as fast as I need to, so I thank you in advance for any even smaller bits of help.
I am using Drupal 6.