<?php
ob_start();
if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/includesroutinesservice.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/includesroutinesservice.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/includesroutinesservice.inc');
}

if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/db/mysqlroutines.mail.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/db/mysqlroutines.mail.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/db/mysqlroutines.mail.inc');
}

if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/mail.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/mail.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/mail.inc');
}


if(isset($_REQUEST[ "idpolltype" ]) && isset($_REQUEST[ "skbranch" ])){
  $cn = db_connect();
  $usr_arr = GetUserIDs();
  db_createMailQueue_UncompletedPolls($cn, $_REQUEST[ "idpolltype" ], (isset($_REQUEST[ "skproject" ]) ? $_REQUEST[ "skproject" ] : NULL), $_REQUEST[ "skbranch" ], $usr_arr );
  db_disconnect($cn);
  echo "done";
}
?>