From 8b06d178223afa83719d5719942e315c41adc596 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 20 Oct 2005 20:14:34 +0200 Subject: auth update, incl. auth object, plain.class.php; resend password & update profile actions darcs-hash:20051020181434-50fdc-44222aa2074bb0e39a1c240c516259579b380740.gz --- inc/io.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'inc/io.php') diff --git a/inc/io.php b/inc/io.php index 1939dc6a0..e1c4d1eb9 100644 --- a/inc/io.php +++ b/inc/io.php @@ -92,10 +92,12 @@ function io_saveFile($file,$content,$append=false){ * * Uses gzip if extension is .gz * + * 2005-10-14 : added regex option -- Christopher Smith + * * @author Steven Danz * @return bool true on success */ -function io_deleteFromFile($file,$badline){ +function io_deleteFromFile($file,$badline,$regex=false){ if (!@file_exists($file)) return true; io_lock($file); @@ -108,10 +110,14 @@ function io_deleteFromFile($file,$badline){ } // remove all matching lines - $pos = array_search($badline,$lines); //return null or false if not found - while(is_int($pos)){ - unset($lines[$pos]); - $pos = array_search($badline,$lines); + if ($regex) { + $lines = preg_grep($badline,$lines,PREG_GREP_INVERT); + } else { + $pos = array_search($badline,$lines); //return null or false if not found + while(is_int($pos)){ + unset($lines[$pos]); + $pos = array_search($badline,$lines); + } } if(count($lines)){ -- cgit v1.2.3