logo       

Re: Problem with custom resource compiled filenames: msg#00018

Subject: Re: Problem with custom resource compiled filenames
That would be fine with me, although Smarty uses crc32() everywhere instead of md5() since it is 10x faster.

Ivo Jansch wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Ivo Jansch wrote:

how would you handle the case that the filenames is invalid just
because it is too long?
I was thinking of generating a 32-character hash.

I was able to solve the problem by changing the code in Smarty.class.php to:

if(isset($auto_source)) {
 // make source name safe for filename
 $_filename = urlencode(basename($auto_source));
 $_crc32 = sprintf('%08X', crc32($auto_source));
 // prepend %% to avoid name conflicts with
 // with $params['auto_id'] names
 $_crc32 = substr($_crc32, 0, 2) . $_compile_dir_sep .
                  substr($_crc32, 0, 3) . $_compile_dir_sep .
                   $_crc32;

 // Ivo hack.. use hash instead of actual name, if actual name has an
 // invalid length
 if (strlen($_filename)>100) {
   $_filename = md5($_filename);
 }
 // end ivo hack
 $_return .= '%%' . $_crc32 . '%%' . $_filename;
}


Would you consider modifying this code in the Smarty base code?

Greetings,
Ivo

- --
Ivo Jansch <ivo@xxxxxxxxxxxxx>
ibuildings.nl BV - information technology
http://www.ibuildings.nl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDCcLT95NUnGFZm9cRAhx7AJ49LZwQr25t7RVFA0CihAfkBOZh/QCdFqu4
OH93xnn/FnT+sZe8SRiA6nU=
=CYlR
-----END PGP SIGNATURE-----


--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe