I solved Cryptographic Issues in Thirdparty

This commit is contained in:
Paula V. Quispe
2015-04-08 17:35:40 -04:00
parent c59bbc53b6
commit a67169c5fe
24 changed files with 296 additions and 35 deletions

View File

@@ -189,10 +189,19 @@ class Creole {
trigger_error("The Creole::NO_ASSOC_LOWER flag has been deprecated, and is now the default behavior. Use Creole::COMPAT_ASSOC_LOWER to lowercase resulset keys.", E_USER_WARNING);
}
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
// sort $dsninfo by keys so the serialized result is always the same
// for identical connection parameters, no matter what their order is
ksort($dsninfo);
$connectionMapKey = crc32(serialize($dsninfo + array('compat_flags' => ($flags & Creole::COMPAT_ALL))));
$connectionMapKey = G::encryptCrc32(serialize($dsninfo + array('compat_flags' => ($flags & Creole::COMPAT_ALL))));
// see if we already have a connection with these parameters cached
if(isset(self::$connectionMap[$connectionMapKey]) && $dsninfo['phptype'] !== 'dbarray')

View File

@@ -3738,10 +3738,19 @@ class GeSHi {
/** NOTE: memorypeak #1 */
$parsed_code = preg_replace('#<span[^>]+>(\s*)</span>#', '\\1', $parsed_code);
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
// If we are using IDs for line numbers, there needs to be an overall
// ID set to prevent collisions.
if ($this->add_ids && !$this->overall_id) {
$this->overall_id = 'geshi-' . substr(md5(microtime()), 0, 4);
$this->overall_id = 'geshi-' . substr(G::encryptOld(microtime()), 0, 4);
}
// Get code into lines

View File

@@ -57,11 +57,20 @@ class CheckBox extends GenericFormattedBox {
* @see CheckBox::CheckBox()
*/
function &create(&$root, &$pipeline) {
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$value = $root->get_attribute('value');
if (trim($value) == "") {
error_log("Checkbox with empty 'value' attribute");
$value = sprintf("___Value%s",md5(time().rand()));
$value = sprintf("___Value%s",G::encryptOld(time().rand()));
};
$box =& new CheckBox($root->has_attribute('checked'),

View File

@@ -19,12 +19,21 @@ class RadioBox extends SimpleInlineBox {
var $_value;
function &create(&$root, &$pipeline) {
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$checked = $root->has_attribute('checked');
$value = $root->get_attribute('value');
if (trim($value) == "") {
error_log("Radiobutton with empty 'value' attribute");
$value = sprintf("___Value%s",md5(time().rand()));
$value = sprintf("___Value%s",G::encryptOld(time().rand()));
};
$css_state = $pipeline->getCurrentCSSState();

View File

@@ -15,7 +15,16 @@ class CSSCache {
}
function _getCacheFilename($url) {
return CACHE_DIR.md5($url).'.css.compiled';
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
return CACHE_DIR.G::encryptOld($url).'.css.compiled';
}
function _isCached($url) {

View File

@@ -80,7 +80,16 @@ class Image {
// allowed file name length (especially after escaping specialy symbols)
// thus, we generate long almost random 32-character name using the md5 hash function
//
return CACHE_DIR.md5(time() + $url + rand());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
return CACHE_DIR.G::encryptOld(time() + $url + rand());
}
// Checks if cache directory is available

View File

@@ -67,7 +67,16 @@ class Log_console extends Log
function Log_console($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);

View File

@@ -74,7 +74,16 @@ class Log_daemon extends Log
$name = LOG_SYSLOG;
}
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_name = $name;
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);

View File

@@ -54,7 +54,16 @@ class Log_display extends Log
function Log_display($name = '', $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);

View File

@@ -52,7 +52,16 @@ class Log_error_log extends Log
function Log_error_log($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_type = $name;
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);

View File

@@ -98,7 +98,16 @@ class Log_file extends Log
function Log_file($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_filename = $name;
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);

View File

@@ -81,7 +81,16 @@ class Log_firebug extends Log
function Log_firebug($name = '', $ident = 'PHP', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);
if (isset($conf['buffering'])) {

View File

@@ -103,7 +103,16 @@ class Log_mail extends Log
function Log_mail($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_recipients = $name;
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);

View File

@@ -74,7 +74,16 @@ class Log_mcal extends Log
function Log_mcal($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_name = $name;
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);

View File

@@ -115,7 +115,16 @@ class Log_mdb2 extends Log
function Log_mdb2($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_table = $name;
$this->_mask = Log::UPTO($level);

View File

@@ -30,7 +30,16 @@ class Log_null extends Log
function Log_null($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_id = md5(microtime());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->_id = G::encryptOld(microtime());
$this->_ident = $ident;
$this->_mask = Log::UPTO($level);
}

View File

@@ -167,7 +167,16 @@ class Net_DIME_Record extends PEAR
function generateID()
{
$id = md5(time());
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$id = G::encryptOld(time());
$this->setID($id);
return $id;
}
@@ -373,6 +382,15 @@ class Net_DIME_Message extends PEAR
function startChunk(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN)
{
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$this->me = 0;
$this->cf = 1;
$this->type = $type;
@@ -380,7 +398,7 @@ class Net_DIME_Message extends PEAR
if ($id) {
$this->id = $id;
} else {
$this->id = md5(time());
$this->id = G::encryptOld(time());
}
return $this->_makeRecord($data, $this->typestr, $this->id, $this->type);
}

View File

@@ -29,6 +29,15 @@ class Net_UserAgent_Detect_APC extends Net_UserAgent_Detect
$restored = false;
$ua_cache_timeout = apc_fetch('useragent:cache_timeout'); // don't cache after time period
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
if ($ua_cache_window > 0) {
if (!$ua_cache_timeout) {
// check apc uptime and disable after x mins
@@ -49,7 +58,7 @@ class Net_UserAgent_Detect_APC extends Net_UserAgent_Detect
if ($in_detect !== null) {
$key_flags = implode('-', $in_detect);
}
$this->key = 'useragent:'.md5($in_userAgent.$key_flags);
$this->key = 'useragent:'.G::encryptOld($in_userAgent.$key_flags);
}
if ($data = apc_fetch($this->key)) {

View File

@@ -232,8 +232,17 @@ class PEAR_Installer extends PEAR_Common
$fp = fopen($orig_file, "r");
$contents = fread($fp, filesize($orig_file));
fclose($fp);
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
if (isset($atts['md5sum'])) {
$md5sum = md5($contents);
$md5sum = G::encryptOld($contents);
}
$subst_from = $subst_to = array();
foreach ($atts['replacements'] as $a) {
@@ -863,11 +872,20 @@ class PEAR_Installer extends PEAR_Common
if (!function_exists("md5_file")) {
function md5_file($filename) {
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$fp = fopen($filename, "r");
if (!$fp) return null;
$contents = fread($fp, filesize($filename));
fclose($fp);
return md5($contents);
return G::encryptOld($contents);
}
}

View File

@@ -53,7 +53,16 @@ class wsdlcache {
* @access private
*/
function createFilename($wsdl) {
return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
return $this->cache_dir.'/wsdlcache-' . G::encryptOld($wsdl);
}
/**
@@ -112,15 +121,24 @@ class wsdlcache {
* @access private
*/
function obtainMutex($filename, $mode) {
if (isset($this->fplock[md5($filename)])) {
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
if (isset($this->fplock[G::encryptOld($filename)])) {
$this->debug("Lock for $filename already exists");
return false;
}
$this->fplock[md5($filename)] = fopen($filename.".lock", "w");
if ($mode == "r") {
return flock($this->fplock[md5($filename)], LOCK_SH);
return flock($this->fplock[G::encryptOld($filename)], LOCK_SH);
} else {
return flock($this->fplock[md5($filename)], LOCK_EX);
return flock($this->fplock[G::encryptOld($filename)], LOCK_EX);
}
}

View File

@@ -1360,8 +1360,17 @@ class PHPMailer {
public function CreateHeader() {
$result = '';
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
// Set the boundaries
$uniq_id = md5(uniqid(time()));
$uniq_id = G::encryptOld(uniqid(time()));
$this->boundary[1] = 'b1_' . $uniq_id;
$this->boundary[2] = 'b2_' . $uniq_id;
$this->boundary[3] = 'b3_' . $uniq_id;
@@ -1777,6 +1786,15 @@ class PHPMailer {
$mime = array();
$cidUniq = array();
$incl = array();
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
// Add all attachments
foreach ($this->attachment as $attachment) {
@@ -1792,7 +1810,7 @@ class PHPMailer {
$path = $attachment[0];
}
$inclhash = md5(serialize($attachment));
$inclhash = G::encryptOld(serialize($attachment));
if (in_array($inclhash, $incl)) { continue; }
$incl[] = $inclhash;
$filename = $attachment[1];
@@ -2486,6 +2504,15 @@ class PHPMailer {
*/
public function MsgHTML($message, $basedir = '') {
preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images);
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
if(isset($images[2])) {
foreach($images[2] as $i => $url) {
// do not change urls for absolute images (thanks to corvuscorax)
@@ -2495,7 +2522,7 @@ class PHPMailer {
if ($directory == '.') {
$directory = '';
}
$cid = 'cid:' . md5($url);
$cid = 'cid:' . G::encryptOld($url);
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$mimeType = self::_mime_types($ext);
if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; }

View File

@@ -165,11 +165,20 @@ abstract class BaseObject {
*/
public function hashCode()
{
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$ok = $this->getPrimaryKey();
if ($ok === null) {
return crc32(serialize($this));
return G::encryptCrc32(serialize($this));
}
return crc32(serialize($ok)); // serialize because it could be an array ("ComboKey")
return G::encryptCrc32(serialize($ok)); // serialize because it could be an array ("ComboKey")
}
/**

View File

@@ -1669,14 +1669,23 @@ class Criterion {
*/
public function hashCode()
{
$h = crc32(serialize($this->value)) ^ crc32($this->comparison);
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
$h = G::encryptCrc3(serialize($this->value)) ^ G::encryptCrc3($this->comparison);
if ($this->table !== null) {
$h ^= crc32($this->table);
$h ^= G::encryptCrc3($this->table);
}
if ($this->column !== null) {
$h ^= crc32($this->column);
$h ^= G::encryptCrc3($this->column);
}
foreach ( $this->clauses as $clause ) {
@@ -1687,7 +1696,7 @@ class Criterion {
$sb = '';
$params = array();
$clause->appendPsTo($sb,$params);
$h ^= crc32(serialize(array($sb,$params)));
$h ^= G::encryptCrc3(serialize(array($sb,$params)));
unset ( $sb, $params );
}

View File

@@ -85,6 +85,15 @@ class TCPDF2DBarcode {
* @public
*/
public function getBarcodeSVG($w=3, $h=3, $color='black') {
if(!class_exists('G')){
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.g.php');
}
// send headers
$code = $this->getBarcodeSVGcode($w, $h, $color);
header('Content-Type: application/svg+xml');
@@ -92,7 +101,7 @@ class TCPDF2DBarcode {
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Disposition: inline; filename="'.md5($code).'.svg";');
header('Content-Disposition: inline; filename="'.G::encryptOld($code).'.svg";');
//header('Content-Length: '.strlen($code));
echo $code;
}