[php-blog-cvs] serendipity/include functions_images.inc.php,1.42,1.43 functions_smarty.inc.php,1.19,
A reliable, secure & extensible PHP blog | Not mainstream since 2002
Brought to you by:
garvinhicking,
jhermanns
From: Tom S. <tom...@us...> - 2005-03-29 10:26:30
|
Update of /cvsroot/php-blog/serendipity/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7689/include Modified Files: functions_images.inc.php functions_smarty.inc.php Log Message: - Upgrade Smarty to v2.6.8 - Fix problem with serendipity_traversePath not being able to show files, at all, if $onlyDirs was false - Write our own Smarty template purge function, and call it during upgrade. It deleted all ".tpl.php$" files in the compile directory Index: functions_images.inc.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/include/functions_images.inc.php,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- functions_images.inc.php 7 Mar 2005 11:01:36 -0000 1.42 +++ functions_images.inc.php 29 Mar 2005 10:26:19 -0000 1.43 @@ -24,7 +24,7 @@ if (!empty($directory)) { $directorysql = ' WHERE path LIKE \'' . serendipity_db_escape_string($directory) . '%\' '; } - + if (!empty($filename)) { if (empty($directorysql)) { $directorysql = " WHERE name like '%" . serendipity_db_escape_string($filename) . "%'"; @@ -99,7 +99,7 @@ } else { printf(FILE_NOT_FOUND . '<br />', $dFile); } - } else { + } else { printf(DELETE_HOTLINK_FILE . '<br />', $file['name']); } @@ -139,7 +139,7 @@ } function serendipity_insertHotlinkedImageInDatabase($filename, $url, $authorid = 0, $time = NULL, $tempfile = NULL) { - global $serendipity; + global $serendipity; if (is_null($time)) { $time = time(); @@ -166,7 +166,7 @@ size, dimensions_width, dimensions_height, - path, + path, hotlink ) VALUES ( '%s', @@ -677,7 +677,7 @@ printf(SKIPPING_FILE_EXTENSION . '<br />', $files[$x]); continue; } - + $ffull = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $files[$x]; $fthumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $f[0] . '.' . $serendipity['thumbSuffix'] . '.' . $f[1]; $fbase = basename($f[0]); @@ -856,7 +856,7 @@ $newwidth = ($newwidth >= 1 ? $newwidth : 1); } - return array($newwidth, $newheight); + return array($newwidth, $newheight); } function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = false, $url = NULL, $show_upload = false) { @@ -1028,7 +1028,7 @@ } $preview .= '</div>'; } - + ?> <td nowrap="nowrap" align="center" valign="<?php echo $manage ? 'top' : 'middle' ?>" width="<?php echo round(1/$lineBreak*100) ?>%" class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo (($i % 2) ? 'even' : 'uneven') ?>"> <?php @@ -1187,11 +1187,11 @@ $files = array(); while (($file = @readdir($dh)) !== false) { if ( $file != '.' && $file != '..' ) { - if ( $onlyDirs === true && is_dir($basedir . '/' . $dir . '/' . $file) ) { + if ( $onlyDirs === false || ($onlyDirs === true && is_dir($basedir . '/' . $dir . '/' . $file)) ) { if ( is_null($pattern) || preg_match($pattern, $file) ) { $files[] = array( - 'name' => $file, - 'depth' => $depth, + 'name' => $file, + 'depth' => $depth, 'relpath' => ltrim(str_replace('\\', '/', $dir) . basename($file) . '/', '/') ); } Index: functions_smarty.inc.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/include/functions_smarty.inc.php,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- functions_smarty.inc.php 14 Mar 2005 11:29:05 -0000 1.19 +++ functions_smarty.inc.php 29 Mar 2005 10:26:19 -0000 1.20 @@ -198,7 +198,7 @@ 'serendipityRewritePrefix' => $serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '', 'serendipityIndexFile' => $serendipity['indexFile'], 'serendipityVersion' => $serendipity['version'], - + 'dateRange' => (!empty($serendipity['range']) ? $serendipity['range'] : array()) ) ); @@ -206,6 +206,24 @@ return true; } +/* Nukes all Smarty compiled templates and cache */ +function serendipity_smarty_purge() { + global $serendipity; + + /* Attempt to init Smarty, brrr */ + serendipity_smarty_init(); + + $files = serendipity_traversePath($serendipity['smarty']->compile_dir, '', false, '/.+\.tpl\.php$/'); + + if ( !is_array($files) ) { + return false; + } + + foreach ( $files as $file ) { + unlink($serendipity['smarty']->compile_dir . DIRECTORY_SEPARATOR . $file['name']); + } +} + /* Function can be called from foreign applications. ob_start() needs to have been called before, and will be parsed into Smarty here */ function serendipity_smarty_shutdown($serendipity_directory = '') { |