function barcode_encode($code,$encoding)
{
    global $genbarcode_loc;

    if (
    ((preg_match("/^ean$/i", $encoding)
    && ( strlen($code)==12 || strlen($code)==13)))

    || (($encoding) && (preg_match("/^isbn$/i", $encoding))
    && (( strlen($code)==9 || strlen($code)==10) ||
    (((preg_match("/^978/", $code) && strlen($code)==12) ||
    (strlen($code)==13)))))

    || (( !isset($encoding) || !$encoding || (preg_match("/^ANY$/i", $encoding) ))
    && (preg_match("/^[0-9]{12,13}$/", $code)))
    )
    {
        /* use built-in EAN-Encoder */
        dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean");
        $bars=barcode_encode_ean($code, $encoding);
    }
    else if (file_exists($genbarcode_loc))	// For example C39
    {
        /* use genbarcode */
        dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding);
        $bars=barcode_encode_genbarcode($code, $encoding);
    }
    else
    {
        print "barcode_encode needs an external programm for encodings other then EAN/ISBN<BR>\n";
        print "<UL>\n";
        print "<LI>download gnu-barcode from <A href=\"http://www.gnu.org/software/barcode/\">www.gnu.org/software/barcode/</A>\n";
        print "<LI>compile and install them\n";
        print "<LI>download genbarcode from <A href=\"http://www.ashberg.de/bar/\">www.ashberg.de/bar/</A>\n";
        print "<LI>compile and install them\n";
        print "<LI>specify path the genbarcode in barcode module setup\n";
        print "</UL>\n";
        print "<BR>\n";
        return false;
    }
    return $bars;
}
The product receives input or data, but it does
        not validate or incorrectly validates that the input has the
        properties that are required to process the data safely and
        correctly.