Changed supplier credit note to only show items for a period, default 30 days back.
[fa-stable.git] / includes / main.inc
index 19279f04d74a68c5b85524907024de65f9ad8af8..4d6e9130c8165329aa8ccf46e98b6fd281504c3d 100644 (file)
@@ -51,7 +51,7 @@
     function flush_dir($path) {
        $dir = opendir($path);
        while(false !== ($fname = readdir($dir))) {
-               if($fname=='.' || $fname=='..') continue;
+               if($fname=='.' || $fname=='..' || $fname=='index.php') continue;
                if(is_dir($path.'/'.$fname)) {
                    flush_dir($path.'/'.$fname);
                    @rmdir($path.'/'.$fname);
@@ -248,4 +248,37 @@ function js_compress($sJS)
        }
        return $sJS;
 }
+//-----------------------------------------------------------------------------
+//     Inserts $elements into $array at position $index.
+//     $elements is list of any objects
+//
+function array_insert(&$array, $index, $elements)
+{
+       if (!is_array($elements)) $elements = array($elements);
+
+       $head  = array_splice($array, 0, $index);
+       $array = array_merge($head, $elements, $array);
+}
+
+function array_remove(&$array, $index, $len=1)
+{
+       array_splice($array, $index, $len);
+}
+
+function array_replace(&$array, $index, $len, $elements)
+{
+       array_splice($array, $index, $len);
+       array_insert($array, $index, $elements);
+}
+
+function array_append(&$array, $elements)
+{
+       foreach($elements as $key => $el) {
+               if(is_int($key))
+                       $array[] = $el;
+               else
+                       $array[$key] = $el;
+       }
+}
+
 ?>
\ No newline at end of file