print is_array($res) ? $res[0] : $res;
    } else {
        if ($_REQUEST["check"] == 3) {
            //get human readable mask
            $res = titlemask_make($mask, $rectypeID, 2, null, _ERR_REP_MSG);
            print is_array($res) ? $res[0] : $res;
        } else {
            ///verify text title mask
            $check = check_title_mask2($mask, $rectypeID, true);
            if (!empty($check)) {
                print $check;
            } else {
                print "";
            }
        }
    }
} else {
    $recID = @$_REQUEST['rec_id'];
    $res = titlemask_value($mask, $recID);
    //."<br><br>".fill_title_mask_old($mask, $recID, $rectypeID);
    print $res;
    //echo fill_title_mask_old($mask, $recID, $rectypeID);
    /* it works - but beforehand verification is already done on client side
       $check = check_title_mask2($mask, $rectypeID, true);
       if(empty($check)){
           echo titlemask_value($mask, $recID); // fill_title_mask($mask, $recID, $rectypeID);
       }else{
          echo array("error"=>$check);
       }*/
}
exit;
/**
* Execute titlemask - replace tags with values
*
* @param mixed $mask
* @param mixed $rec_id
* @param mixed $rt
*/
function fill_title_mask($mask, $rec_id, $rt = null)
{
    return titlemask_value($mask, $rec_id);
}