summaryrefslogtreecommitdiff
path: root/inc/io.php
diff options
context:
space:
mode:
authorchris <chris@teacherscpd.co.uk>2005-10-20 20:14:34 +0200
committerchris <chris@teacherscpd.co.uk>2005-10-20 20:14:34 +0200
commit8b06d178223afa83719d5719942e315c41adc596 (patch)
tree3a2a7e18d883a8aff5ba2db763e6d1eed6793578 /inc/io.php
parent453493f24ca09d6d213a95e42de8d91bb5577458 (diff)
downloadrpg-8b06d178223afa83719d5719942e315c41adc596.tar.gz
rpg-8b06d178223afa83719d5719942e315c41adc596.tar.bz2
auth update, incl. auth object, plain.class.php; resend password & update profile actions
darcs-hash:20051020181434-50fdc-44222aa2074bb0e39a1c240c516259579b380740.gz
Diffstat (limited to 'inc/io.php')
-rw-r--r--inc/io.php16
1 files changed, 11 insertions, 5 deletions
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 <chris@jalakai.co.uk>
+ *
* @author Steven Danz <steven-danz@kc.rr.com>
* @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)){