fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11631] Merge 11623:11630 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [11631] Merge 11623:11630 from trunk
Date: Sun, 26 Jan 2014 16:46:44 +0000

Revision: 11631
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11631
Author:   sigurdne
Date:     2014-01-26 16:46:43 +0000 (Sun, 26 Jan 2014)
Log Message:
-----------
Merge 11623:11630 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/phpgwapi/inc/class.vfs_braArkiv.inc.php
    
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.vfs_shared.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
    branches/Version-1_0-branch/property/inc/class.boproject.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
    branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
    
branches/Version-1_0-branch/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
    branches/Version-1_0-branch/property/templates/base/project.xsl
    branches/Version-1_0-branch/setup/templates/base/config.tpl

Added Paths:
-----------
    
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.vfs_braArkiv.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.vfs_braArkiv.inc.php 
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.vfs_braArkiv.inc.php 
2014-01-26 16:46:43 UTC (rev 11631)
@@ -65,15 +65,28 @@
                        */
                        $conf = CreateObject('phpgwapi.config', 'phpgwapi');
                        $conf->read();
-                       if($conf->config_data['file_store_contents'] == 
'filesystem' || !$conf->config_data['file_store_contents'])
+
+                       if(isset($conf->config_data['file_store_contents']) && 
$conf->config_data['file_store_contents'])
                        {
-                               $this->file_actions = 1;
+                               $file_store_contents = 
$conf->config_data['file_store_contents'];
                        }
                        else
                        {
-                               $this->file_actions = 0;
+                               $file_store_contents = 'filesystem';
                        }
+                       
+                       switch ($file_store_contents)
+                       {
+                               case 'filesystem':
+                                       $this->file_actions = 1;
+                                       break;
+                               default:
+                                       $this->file_actions = 0;
+                                       break;
+                       }
 
+                       $this->fileoperation = 
CreateObject("phpgwapi.vfs_fileoperation_{$file_store_contents}");
+
                        $this->acl_default = $conf->config_data['acl_default'];
 
                        // test if the files-dir is inside the document-root, 
and refuse working if so
@@ -109,9 +122,6 @@
                        {
                                $this->linked_dirs[] = $this->Record();
                        }
-
-                       $this->fileoperation = 
CreateObject('phpgwapi.vfs_fileoperation_braArkiv');
-
                }
 
                /**
@@ -735,57 +745,8 @@
                                return true;
                        }
 
-                       /* Check if they're in the group */
-                       $memberships = 
$GLOBALS['phpgw']->accounts->membership($user_id);
-
-                       if(is_array($memberships))
-                       {
-                               reset($memberships);
-                               while(list($num, $group_array) = 
each($memberships))
-                               {
-                                       if($owner_id == $group_array->id)
-                                       {
-                                               $group_ok = 1;
-                                               break;
-                                       }
-                               }
-                       }
-
-throw new Exception('vfs::acl_check() - not implemented correctly');
-                       $acl = CreateObject('phpgwapi.acl', $owner_id);
-                       $acl->set_account_id($owner_id, true);
-
-                       $rights = $acl->get_rights($user_id);
-
-                       /* Add privileges from the groups this user belongs to 
*/
-                       if(is_array($memberships))
-                       {
-                               reset($memberships);
-                               while(list($num, $group_array) = 
each($memberships))
-                               {
-                                       $rights |= 
$acl->get_rights($group_array->id);
-                               }
-                       }
-
-                       if($rights & $data['operation'])
-                       {
-                               return true;
-                       }
-                       elseif(!$rights && $group_ok)
-                       {
-                               if($this->acl_default == 'grant')
-                               {
-                                       return true;
-                               }
-                               else
-                               {
-                                       return false;
-                               }
-                       }
-                       else
-                       {
-                               return false;
-                       }
+                       $currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       return $GLOBALS['phpgw']->acl->check('run', 
PHPGW_ACL_READ, $currentapp);
                }
 
                /*
@@ -823,7 +784,19 @@
 
                        if($this->file_actions || $p->outside)
                        {
-                               $contents = $this->fileoperation->read($p);
+                               if($p->outside)
+                               {
+                                       $contents = null;
+                                       if( $filesize = 
filesize($p->real_full_path) > 0 && $fp = fopen($p->real_full_path, 'rb'))
+                                       {
+                                               $contents = fread($fp, 
$filesize);
+                                               fclose ($fp);
+                                       }
+                               }
+                               else
+                               {
+                                       $contents = 
$this->fileoperation->read($p);
+                               }
                        }
                        else
                        {
@@ -909,7 +882,6 @@
                                if($this->file_actions)
                                {
                                        $set_attributes_array = array(
-                                       //      'size'  => 
$this->fileoperation->filesize($p)
                                                'size'  => 
strlen($data['content']),
                                        );
                                }
@@ -982,12 +954,15 @@
                                   create the file or set the modification time
                                */
 
-                               $rr = $this->fileoperation->touch($p);
-
+                               /* In case of $p->outside: touch on local disk 
*/
                                if($p->outside)
                                {
-                                       return $rr;
+                                       return @touch($p->real_full_path);
                                }
+                               else
+                               {
+                                       $rr = $this->fileoperation->touch($p);
+                               }
                        }
 
                        /* We, however, have to decide this ourselves */
@@ -1301,7 +1276,8 @@
 
                                while(list($num, $entry) = each($ls))
                                {
-                                       $newdir = 
preg_replace("/^{$f->fake_full_path}/", $t->fake_full_path, 
$entry['directory']);
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+
                                        if($this->mkdir(array(
                                                        'string'        => 
"{$newdir}/{$entry['name']}",
                                                        'relatives'     => 
array($t->mask)
@@ -1326,7 +1302,7 @@
                                                continue;
                                        }
 
-                                       $newdir = 
preg_replace("/^{$f->fake_full_path}/", $t->fake_full_path, 
$entry['directory']);
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
                                        $this->cp(array(
                                                        'from'  => 
"{$entry[directory]}/{$entry[name]}",
                                                        'to'    => 
"{$newdir}/{$entry[name]}",
@@ -1569,7 +1545,7 @@
 
                                while(list($num, $entry) = each($ls))
                                {
-                                       $newdir = 
preg_replace("/^{$f->fake_full_path}/", $t->fake_full_path, 
$entry['directory']);
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
                                        if($this->mkdir(array(
                                                        'string'        => 
"{$newdir}/{$entry['name']}",
                                                        'relatives'     => 
array($t->mask)
@@ -1594,7 +1570,8 @@
                                                continue;
                                        }
 
-                                       $newdir = 
preg_replace("/^{$f->fake_full_path}/", $t->fake_full_path, 
$entry['directory']);
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+
                                        $this->cp(array(
                                                        'from'          => 
"{$entry[directory]}/{$entry[name]}",
                                                        'to'            => 
"{$newdir}/{$entry[name]}",
@@ -1696,7 +1673,8 @@
                                        'string'        => $f->fake_full_path,
                                        'relatives'     => array($f->mask)
                                ) == 'Directory'))
-                               && preg_match("/^{$f->fake_full_path}/", 
$t->fake_full_path)
+//                             && preg_match("/^{$f->fake_full_path}/", 
$t->fake_full_path)
+                               && preg_match("/^" . str_replace('/', '\/', 
$f->fake_full_path). "/", $t->fake_full_path)
                        )
                        {
                                if(($t->fake_full_path == $f->fake_full_path) 
|| substr($t->fake_full_path, strlen($f->fake_full_path), 1) == '/')
@@ -1752,7 +1730,7 @@
                                */
                                if($f->outside)
                                {
-                                       $size = 
$this->fileoperation->filesize($f);
+                                       $size = filesize($f->real_full_path);
                                        if( $size === false )
                                        {
                                                _debug_array($f);
@@ -1822,7 +1800,7 @@
                                /* We got $ls from above, before we renamed the 
directory */
                                while(list($num, $entry) = each($ls))
                                {
-                                       $newdir = 
preg_replace("/^{$f->fake_full_path}/", $t->fake_full_path, 
$entry['directory']);
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
                                        $newdir_clean = 
$this->clean_string(array('string' => $newdir));
 
                                        $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET directory='{$newdir_clean}'"
@@ -2160,15 +2138,18 @@
                 */
                function make_link($data)
                {
+                       /* Does not seem to be used */
+                       return false;
+
                        if(!is_array($data))
                        {
                                $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => 
array(RELATIVE_CURRENT, RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT, 
RELATIVE_CURRENT)
+                       );
 
                        $data = array_merge($this->default_values($data, 
$default_values), $data);
 
@@ -2222,7 +2203,7 @@
                                return false;
                        }
 
-                       //FIXME
+                       //FIXME real_full_path...
                        $size = $this->get_size(array(
                                        'string'        => $rp->real_full_path,
                                        'relatives'     => array($rp->mask)
@@ -2317,7 +2298,7 @@
 
                        reset($this->attributes);
                        $value_set = array();
-//                     while(list($num, $attribute) = each($this->attributes))
+
                        foreach($this->attributes as $num => $attribute)
                        {
                                if(isset($data['attributes'][$attribute]))
@@ -2340,14 +2321,6 @@
 
                                        $$attribute = 
$this->clean_string(array('string' => $$attribute));
 
-/*
-                                       if($change_attributes > 0)
-                                       {
-                                               $sql .= ', ';
-                                       }
-
-                                       $sql .= "$attribute='" . $$attribute . 
"'";
-*/
                                        $value_set[$attribute] = $$attribute;
 
                                        $change_attributes++;
@@ -2403,9 +2376,9 @@
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => 
array(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
                        $data = array_merge($this->default_values($data, 
$default_values), $data);
 
@@ -2426,6 +2399,9 @@
                                return false;
                        }
 
+                       /*
+                       * The file is outside the virtual root
+                       */
                        if($p->outside)
                        {
                                if(is_dir($p->real_full_path))
@@ -2444,14 +2420,20 @@
                           passed a directory
                        */
                        $db2 = clone($GLOBALS['phpgw']->db);
-                       $db2->query("SELECT mime_type FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                       $db2->query("SELECT mime_type FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}'"
+                       . " AND name='{$p->fake_name_clean}'"
+                       . $this->extra_sql(array('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
+
                        $db2->next_record();
                        $mime_type = $db2->f('mime_type');
+
                        if(!$mime_type)
                        {
                                $mime_type = 
$this->get_ext_mime_type(array('string' => $data['string']));
                                {
-                                       $db2->query("UPDATE phpgw_vfs SET 
mime_type='{$mime_type}' WHERE directory='{$p->fake_leading_dirs_clean}' AND 
name='{$p->fake_name_clean}'" . $this->extra_sql(array('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
+                                       $db2->query("UPDATE phpgw_vfs SET 
mime_type='{$mime_type}'"
+                                       . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                       . $this->extra_sql(array('query_type' 
=> VFS_SQL_SELECT)), __LINE__, __FILE__);
                                }
                        }
 
@@ -2469,9 +2451,9 @@
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => 
array(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
                        $data = array_merge($this->default_values($data, 
$default_values), $data);
 
@@ -2489,7 +2471,9 @@
                        }
 
                        $db2 = clone($GLOBALS['phpgw']->db);
-                       $db2->query("SELECT name FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                       $db2->query("SELECT name FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}'"
+                       . " AND name='{$p->fake_name_clean}'"
+                       . $this->extra_sql(array('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
 
                        if($db2->next_record())
                        {
@@ -2581,11 +2565,11 @@
                                /* We return an array of one array to maintain 
the standard */
                                $rarray = array();
                                reset($this->attributes);
+                                               $db2 = 
clone($GLOBALS['phpgw']->db);
                                while(list($num, $attribute) = 
each($this->attributes))
                                {
                                        if($attribute == 'mime_type' && 
!$record[$attribute])
                                        {
-                                               $db2 = 
clone($GLOBALS['phpgw']->db);
                                                $record[$attribute] = 
$this->get_ext_mime_type(array(
                                                                'string' => 
$p->fake_name_clean
                                                        )
@@ -2593,7 +2577,9 @@
 
                                                if($record[$attribute])
                                                {
-                                                       $db2->query("UPDATE 
phpgw_vfs SET mime_type='{$record[$attribute]}' WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                                                       $db2->query("UPDATE 
phpgw_vfs SET mime_type='{$record[$attribute]}'"
+                                                       . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                                       . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
                                                }
                                        }
 
@@ -2645,15 +2631,15 @@
                        $sql = 'SELECT ' . implode(',', $this->attributes);
 
                        $dir_clean = $this->clean_string(array('string' => 
$p->fake_full_path));
-                       $sql .= " FROM phpgw_vfs WHERE directory LIKE 
'$dir_clean%'";
+                       $sql .= " FROM phpgw_vfs WHERE directory LIKE 
'{$dir_clean}%'";
                        $sql .= $this->extra_sql(array('query_type' => 
VFS_SQL_SELECT));
 
                        if($data['mime_type'])
                        {
-                               $sql .= " AND 
mime_type='".$data['mime_type']."'";
+                               $sql .= " AND mime_type='{$data['mime_type']}'";
                        }
 
-                       $sql .= ' ORDER BY '.$data['orderby'];
+                       $sql .= " ORDER BY {$data['orderby']}";
 
                        $query = $GLOBALS['phpgw']->db->query($sql, __LINE__, 
__FILE__);
 
@@ -2664,13 +2650,15 @@
 
                                //_debug_array($record);
                                /* Further checking on the directory.  This 
makes sure /home/user/test won't match /home/user/test22 */
-                               if(address@hidden("^{$p->fake_full_path}(/|$)", 
$record['directory']))
+                       //      if(address@hidden("^{$p->fake_full_path}(/|$)", 
$record['directory']))
+                               if(!preg_match("/^" . str_replace('/', '\/', 
$p->fake_full_path). "(\/|$)/", $record['directory']))
                                {
                                        continue;
                                }
 
                                /* If they want only this directory, then $dir 
should end without a trailing / */
-                               if(!$data['checksubdirs'] && 
ereg("^{$p->fake_full_path}/", $record['directory']))
+//                             if(!$data['checksubdirs'] && 
preg_match("/^{$p->fake_full_path}\//", $record['directory']))
+                               if(!$data['checksubdirs'] && preg_match("/^" . 
str_replace('/', '\/', $p->fake_full_path). "\//", $record['directory']))
                                {
                                        continue;
                                }
@@ -2682,7 +2670,9 @@
 
                                        if( $record['mime_type'] )
                                        {
-                                               $db2->query("UPDATE phpgw_vfs 
SET mime_type='{$record[$attribute]}' WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                                               $db2->query("UPDATE phpgw_vfs 
SET mime_type='{$record[$attribute]}'"
+                                               . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                               . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
 
                                        }
                                }
@@ -2702,9 +2692,9 @@
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => 
array(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
                        $data = array_merge($this->default_values($data, 
$default_values), $data);
 
@@ -2756,7 +2746,7 @@
                                        );
 
                                        /* Note the mime_type.  This can be 
"Directory", which is how we create directories */
-                                       $set_attributes_array = Array(
+                                       $set_attributes_array = array(
                                                'size' => $file_array['size'],
                                                'mime_type' => 
$file_array['mime_type']
                                        );
@@ -2804,9 +2794,9 @@
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => 
array(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
                        $data = array_merge($this->default_values($data, 
$default_values), $data);
 
@@ -2829,7 +2819,9 @@
 
                                if($mime_type)
                                {
-                                       $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_vfs SET mime_type='".$mime_type."' WHERE 
directory='".$p->fake_leading_dirs_clean."' AND name='".$p->fake_name_clean."'" 
. $this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                                       $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_vfs SET mime_type='{$mime_type}'"
+                                       . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                       . $this->extra_sql(array('query_type' 
=> VFS_SQL_SELECT)), __LINE__, __FILE__);
                                }
                        }
 

Modified: 
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
===================================================================
--- 
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
   2014-01-26 16:17:29 UTC (rev 11630)
+++ 
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
   2014-01-26 16:46:43 UTC (rev 11631)
@@ -40,8 +40,9 @@
                public function read($path_parts)
                {
                        $path = $path_parts->real_full_path;
-                       $contents = null;
-                       if( $filesize = $this->filesize($path) > 0 && $fp = 
fopen($path, 'rb'))
+                       $filesize = filesize($path);
+                       $contents = false;
+                       if( $filesize  > 0 && $fp = fopen($path, 'rb'))
                        {
                                $contents = fread($fp, $filesize);
                                fclose ($fp);

Copied: 
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php
 (from rev 11630, trunk/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php
                         (rev 0)
+++ 
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php
 2014-01-26 16:46:43 UTC (rev 11631)
@@ -0,0 +1,129 @@
+<?php
+       /**
+       * Fileoperation
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2014 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License v2 or later
+       * @package phpgwapi
+       * @subpackage vfs
+       * @version $Id: class.acl.inc.php 11567 2013-12-23 12:49:00Z sigurdne $
+       */
+
+       /*
+               This program is free software: you can redistribute it and/or 
modify
+               it under the terms of the GNU Lesser General Public License as 
published by
+               the Free Software Foundation, either version 2 of the License, 
or
+               (at your option) any later version.
+
+               This program is distributed in the hope that it will be useful,
+               but WITHOUT ANY WARRANTY; without even the implied warranty of
+               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+               GNU Lesser General Public License for more details.
+
+               You should have received a copy of the GNU Lesser General 
Public License
+               along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
+        */
+
+       class phpgwapi_vfs_fileoperation_filesystem
+       {
+               public function __construct()
+               {
+
+               }
+
+               public function filesize($path_parts)
+               {
+                       $path = $path_parts->real_full_path;
+                       return filesize($path);
+               }
+
+               public function read($path_parts)
+               {
+                       $path = $path_parts->real_full_path;
+                       $filesize = filesize($path);
+                       $contents = false;
+                       if( $filesize  > 0 && $fp = fopen($path, 'rb'))
+                       {
+                               $contents = fread($fp, $filesize);
+                               fclose ($fp);
+                       }
+                       return $contents;
+               }
+
+               //not relevant to braArkiv
+               public function copy($from, $to)
+               {
+                       return copy($from->real_full_path, $to->real_full_path);
+               }
+
+
+               public function write($path_parts, $content)
+               {
+                       $write_ok = false;
+                       if($fp = fopen($path_parts->real_full_path, 'wb'))
+                       {
+                               fwrite($fp, $content, strlen($content));
+                               fclose($fp);
+                               $write_ok = true;
+                       }
+                       return $write_ok;
+               }
+
+
+               public function touch($path_parts)
+               {
+                       return @touch($path_parts->real_full_path);
+               }
+
+               public function rename($from, $to)
+               {
+                       return rename($from->real_full_path, 
$to->real_full_path);
+               }
+
+               /*
+               *Deletes a file
+               */
+               public function unlink($path_parts)
+               {
+                       return unlink($path_parts->real_full_path);
+               }
+
+               /*
+               *Removes directory
+               */
+               public function rmdir($path_parts)
+               {
+                       return rmdir($path_parts->real_full_path);
+               }
+
+               public function check_target_directory($path_parts)
+               {
+                       return file_exists($path_parts->real_leading_dirs);
+               }
+
+               public function auto_create_home($basedir)
+               {
+                       if(!file_exists($basedir.'/home'))
+                       {
+                               @mkdir($basedir.'/home', 0770);
+                       }
+               }
+
+               public function file_exists($path_parts)
+               {
+                       return file_exists($path_parts->real_full_path);
+               }
+
+               public function is_dir($path_parts)
+               {
+                       return is_dir($path_parts->real_full_path);
+               }
+
+               public function mkdir($path_parts)
+               {
+                       return mkdir($path_parts->real_full_path, 0770);
+               }
+
+
+
+       }

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.vfs_shared.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.vfs_shared.inc.php   
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.vfs_shared.inc.php   
2014-01-26 16:46:43 UTC (rev 11631)
@@ -1250,36 +1250,6 @@
                        $file = $path_parts['basename'];
 
                        return $this->mime_magic->filename2mime($file);
-/*
-                       $file = basename($data['string']);
-                       $mimefile=PHPGW_API_INC.'/phpgw_mime.types';
-                       $fp=fopen($mimefile,'r');
-                       $contents = 
explode("\n",fread($fp,filesize($mimefile)));
-                       fclose($fp);
-
-                       $parts=explode('.',strtolower($file));
-                       $ext=$parts[(sizeof($parts)-1)];
-
-                       for($i=0;$i<sizeof($contents);$i++)
-                       {
-                               if (!ereg("^#",$contents[$i]))
-                               {
-                                       $line=split("[[:space:]]+", 
$contents[$i]);
-                                       if (sizeof($line) >= 2)
-                                       {
-                                               for($j=1;$j<sizeof($line);$j++)
-                                               {
-                                                       if($line[$j] == $ext)
-                                                       {
-                                                               return $line[0];
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       return '';
-*/
                }
 
                /* PUBLIC functions (mandatory) they don't need to be 
implemented
@@ -1432,7 +1402,8 @@
                        else
                        {
                                $base_sep = $sep;
-                               if (ereg ("^$this->basedir" . $sep, $string))
+//                             if (ereg ("^$this->basedir" . $sep, $string))
+                               if (preg_match ("/^" . str_replace('/', '\/', 
"{$this->basedir}{$sep}"). "/", $string))
                                {
                                        $base = $this->basedir . $sep;
                                }
@@ -1510,7 +1481,9 @@
                                reset ($this->linked_dirs);
                                while (list ($num, $link_info) = each 
($this->linked_dirs))
                                {
-                                       if (ereg 
("^$link_info[directory]/$link_info[name](/|$)", $rarray['fake_full_path']))
+//                                     if (ereg 
("^$link_info[directory]/$link_info[name](/|$)", $rarray['fake_full_path']))
+                                       if(preg_match("/^" . str_replace('/', 
'\/', "{$link_info['directory']}/{$link_info['name']}"). "(\/|$)/", 
$rarray['fake_full_path']))
+
                                        {
                                                $rarray['real_full_path'] = 
ereg_replace ("^$this->basedir", '', $rarray['real_full_path']);
                                                $rarray['real_full_path'] = 
ereg_replace ("^{$link_info['directory']}/{$link_info['name']}", 
"{$link_info['link_directory']}/{$link_info['link_name']}", 
$rarray['real_full_path']);

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.vfs_sql.inc.php      
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.vfs_sql.inc.php      
2014-01-26 16:46:43 UTC (rev 11631)
@@ -3,8 +3,9 @@
        * Virtual File System with SQL backend
        * @author Jason Wies <address@hidden>
        * @author Giancarlo Susin
-       * @copyright Copyright (C) 2001 Jason Wies
-       * @copyright Copyright (C) 2004 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright(C) 2001 Jason Wies
+       * @copyright Copyright(C) 2004,2014 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage vfs
@@ -15,22 +16,22 @@
        * VFS SQL select
        * @see extra_sql()
        */
-       define ('VFS_SQL_SELECT', 1);
+       define('VFS_SQL_SELECT', 1);
        /**
        * VFS SQL delete
        * @see extra_sql()
        */
-       define ('VFS_SQL_DELETE', 2);
+       define('VFS_SQL_DELETE', 2);
        /**
        * VFS SQL update
        * @see extra_sql()
        */
-       define ('VFS_SQL_UPDATE', 4);
+       define('VFS_SQL_UPDATE', 4);
 
 
        /**
        * Virtual File System with SQL backend
-       * 
+       *
        * @package phpgwapi
        * @subpackage vfs
        * @ignore
@@ -38,6 +39,7 @@
        class phpgwapi_vfs extends phpgwapi_vfs_shared
        {
                var $file_actions;
+               var $acl_default;
 
                /**
                 * constructor, sets up variables
@@ -49,7 +51,7 @@
                        /*
                           File/dir attributes, each corresponding to a 
database field.  Useful for use in loops
                           If an attribute was added to the table, add it here 
and possibly add it to
-                          set_attributes ()
+                          set_attributes()
 
                           set_attributes now uses this array().   07-Dec-01 
skeeter
                        */
@@ -58,27 +60,42 @@
                        $this->attributes[] = 'content';
 
                        /*
-                          Decide whether to use any actual filesystem calls 
(fopen(), fread(),
+                          Decide whether to use any actual filesystem 
calls(fopen(), fread(),
                           unlink(), rmdir(), touch(), etc.).  If not, then 
we're working completely
                           in the database.
                        */
                        $conf = CreateObject('phpgwapi.config', 'phpgwapi');
                        $conf->read();
-                       if ($conf->config_data['file_store_contents'] == 
'filesystem' || !$conf->config_data['file_store_contents'])
+
+                       if(isset($conf->config_data['file_store_contents']) && 
$conf->config_data['file_store_contents'])
                        {
-                               $this->file_actions = 1;
+                               $file_store_contents = 
$conf->config_data['file_store_contents'];
                        }
                        else
                        {
-                               $this->file_actions = 0;
+                               $file_store_contents = 'filesystem';
                        }
-       
+                       
+                       switch ($file_store_contents)
+                       {
+                               case 'filesystem':
+                                       $this->file_actions = 1;
+                                       break;
+                               default:
+                                       $this->file_actions = 0;
+                                       break;
+                       }
+
+                       $this->fileoperation = 
CreateObject("phpgwapi.vfs_fileoperation_{$file_store_contents}");
+
+                       $this->acl_default = $conf->config_data['acl_default'];
+
                        // test if the files-dir is inside the document-root, 
and refuse working if so
                        //
-                       if ($this->file_actions && 
$this->in_docroot($this->basedir))
+                       if($this->file_actions && 
$this->in_docroot($this->basedir))
                        {
                                $GLOBALS['phpgw']->common->phpgw_header();
-                               if 
($GLOBALS['phpgw_info']['flags']['noheader']) 
+                               if($GLOBALS['phpgw_info']['flags']['noheader'])
                                {
                                        echo parse_navbar();
                                }
@@ -87,18 +104,22 @@
                        }
 
                        /* We store the linked directories in an array now, so 
we don't have to make the SQL call again */
-                       if ($GLOBALS['phpgw_info']['server']['db_type']=='mssql'
+                       if($GLOBALS['phpgw_info']['server']['db_type']=='mssql'
                                || 
$GLOBALS['phpgw_info']['server']['db_type']=='sybase')
                        {
-                               $query = $GLOBALS['phpgw']->db->query ("SELECT 
directory, name, link_directory, link_name FROM phpgw_vfs WHERE 
CONVERT(varchar,link_directory) != '' AND CONVERT(varchar,link_name) != ''" . 
$this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__,__FILE__);
+                               $query = $GLOBALS['phpgw']->db->query("SELECT 
directory, name, link_directory, link_name"
+                               . " FROM phpgw_vfs WHERE 
CONVERT(varchar,link_directory) != ''"
+                               . " AND CONVERT(varchar,link_name) != ''" . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__,__FILE__);
                        }
                        else
                        {
-                               $query = $GLOBALS['phpgw']->db->query ("SELECT 
directory, name, link_directory, link_name FROM phpgw_vfs WHERE (link_directory 
IS NOT NULL or link_directory != '') AND (link_name IS NOT NULL or link_name != 
'')" . $this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), 
__LINE__,__FILE__);
+                               $query = $GLOBALS['phpgw']->db->query("SELECT 
directory, name, link_directory, link_name"
+                               . " FROM phpgw_vfs WHERE(link_directory IS NOT 
NULL or link_directory != '')"
+                               . " AND(link_name IS NOT NULL or link_name != 
'')" . $this->extra_sql(array('query_type' => VFS_SQL_SELECT)), 
__LINE__,__FILE__);
                        }
 
-                       $this->linked_dirs = array ();
-                       while ($GLOBALS['phpgw']->db->next_record ())
+                       $this->linked_dirs = array();
+                       while($GLOBALS['phpgw']->db->next_record())
                        {
                                $this->linked_dirs[] = $this->Record();
                        }
@@ -112,28 +133,28 @@
                {
                        //$docroots = array(PHPGW_SERVER_ROOT, 
$_SERVER['DOCUMENT_ROOT']);
                        $docroots = array(PHPGW_SERVER_ROOT);
-                       //in case vfs is called from cli (cron-job)
+                       //in case vfs is called from cli(cron-job)
 
                        if($_SERVER['DOCUMENT_ROOT'])
                        {
                                $docroots[] = $_SERVER['DOCUMENT_ROOT'];
                        }
 
-                       foreach ($docroots as $docroot)
+                       foreach($docroots as $docroot)
                        {
                                $len = strlen($docroot);
 
-                               if ($docroot == substr($path,0,$len))
+                               if($docroot == substr($path,0,$len))
                                {
                                        $rest = substr($path,$len);
 
-                                       if (!strlen($rest) || $rest[0] == 
DIRECTORY_SEPARATOR)
+                                       if(!strlen($rest) || $rest[0] == 
DIRECTORY_SEPARATOR)
                                        {
-                                               return True;
+                                               return true;
                                        }
                                }
                        }
-                       return False;
+                       return false;
                }
 
                /**
@@ -142,33 +163,35 @@
                 * @param query_type The type of query to get extra SQL code 
for, in the form of a VFS_SQL define
                 * @return Extra SQL code
                 */
-               function extra_sql ($data)
+               function extra_sql($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ('query_type' => VFS_SQL_SELECT);
+                               $data = array('query_type' => VFS_SQL_SELECT);
                        }
 
-                       if ($data['query_type'] == VFS_SQL_SELECT || 
$data['query_type'] == VFS_SQL_DELETE || $data['query_type'] = VFS_SQL_UPDATE)
+                       if($data['query_type'] == VFS_SQL_SELECT || 
$data['query_type'] == VFS_SQL_DELETE || $data['query_type'] = VFS_SQL_UPDATE)
                        {
-                               $sql = ' AND ((';
+                               $sql = ' AND((';
 
-                               reset ($this->meta_types);
-                               while (list ($num, $type) = each 
($this->meta_types))
+                               reset($this->meta_types);
+                               while(list($num, $type) = 
each($this->meta_types))
                                {
-                                       if ($num)
+                                       if($num)
+                                       {
                                                $sql .= ' AND ';
+                                       }
 
-                                       $sql .= "mime_type != '$type'";
+                                       $sql .= "mime_type != '{$type}'";
                                }
                                $sql .= ') OR mime_type IS NULL)';
                        }
 
-                       return ($sql);
+                       return($sql);
                }
 
                /**
-                * Add a journal entry after (or before) completing an 
operation,
+                * Add a journal entry after(or before) completing an operation,
                *
                 *        and increment the version number.  This function 
should be used internally only
                 * Note that state_one and state_two are ignored for some 
VFS_OPERATION's, for others
@@ -178,7 +201,7 @@
                 *               * VFS_OPERATION_COPIED fake_full_path of 
copied to
                 *               * VFS_OPERATION_MOVED           * 
fake_full_path of moved to
 
-                *               * If deleting, you must call add_journal () 
before you delete the entry from the database
+                *               * If deleting, you must call add_journal() 
before you delete the entry from the database
                 * @param string File or directory to add entry for
                 * @param relatives Relativity array
                 * @param operation The operation that was performed.  Either a 
VFS_OPERATION define or
@@ -192,125 +215,125 @@
                 *               *    would not
                 * @return Boolean True/False
                 */
-               function add_journal ($data)
+               function add_journal($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT),
-                                       'state_one'     => False,
-                                       'state_two'     => False,
-                                       'incversion'    => True
-                               );
+                       (
+                               'relatives'             => 
array(RELATIVE_CURRENT),
+                               'state_one'             => false,
+                               'state_two'             => false,
+                               'incversion'    => true
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
-                       $p = $this->path_parts (array ('string' => 
$data['string'], 'relatives' => array ($data['relatives'][0])));
+                       $p = $this->path_parts(array('string' => 
$data['string'], 'relatives' => array($data['relatives'][0])));
 
                        /* We check that they have some sort of access to the 
file other than read */
-                       if (!$this->acl_check (array ('string' => 
$p->fake_full_path, 'relatives' => array ($p->mask), 'operation' => 
PHPGW_ACL_ADD)) &&
-                               !$this->acl_check (array ('string' => 
$p->fake_full_path, 'relatives' => array ($p->mask), 'operation' => 
PHPGW_ACL_EDIT)) &&
-                               !$this->acl_check (array ('string' => 
$p->fake_full_path, 'relatives' => array ($p->mask), 'operation' => 
PHPGW_ACL_DELETE)))
+                       if(!$this->acl_check(array('string' => 
$p->fake_full_path, 'relatives' => array($p->mask), 'operation' => 
PHPGW_ACL_ADD)) &&
+                               !$this->acl_check(array('string' => 
$p->fake_full_path, 'relatives' => array($p->mask), 'operation' => 
PHPGW_ACL_EDIT)) &&
+                               !$this->acl_check(array('string' => 
$p->fake_full_path, 'relatives' => array($p->mask), 'operation' => 
PHPGW_ACL_DELETE)))
                        {
-                               return False;
+                               return false;
                        }
 
-                       if (!$this->file_exists (array ('string' => 
$p->fake_full_path, 'relatives' => array ($p->mask))))
+                       if(!$this->file_exists(array('string' => 
$p->fake_full_path, 'relatives' => array($p->mask))))
                        {
-                               return False;
+                               return false;
                        }
 
-                       $ls_array = $this->ls (array (
-                                       'string' => $p->fake_full_path,
-                                       'relatives' => array ($p->mask),
-                                       'checksubdirs' => False,
-                                       'mime_type'     => False,
-                                       'nofiles'       => True
+                       $ls_array = $this->ls(array(
+                                       'string'                => 
$p->fake_full_path,
+                                       'relatives'             => 
array($p->mask),
+                                       'checksubdirs'  => false,
+                                       'mime_type'             => false,
+                                       'nofiles'               => true
                                )
                        );
                        $file_array = $ls_array[0];
 
-                       $sql = 'INSERT INTO phpgw_vfs (';
-                       $sql2 = ' VALUES (';
-                       $morethanone = False;
-                       $modified = False;
+                       $sql = 'INSERT INTO phpgw_vfs(';
+                       $sql2 = ' VALUES(';
+                       $morethanone = false;
+                       $modified = false;
 
-                       for ($i = 0; list ($attribute, $value) = each 
($file_array); $i++)
+                       for($i = 0; list($attribute, $value) = 
each($file_array); $i++)
                        {
-                               if ($attribute == 'file_id' || $attribute == 
'content')
+                               if($attribute == 'file_id' || $attribute == 
'content')
                                {
                                        continue;
                                }
 
-                               if ($attribute == 'owner_id')
+                               if($attribute == 'owner_id')
                                {
                                        $value = $account_id;
                                }
 
-                               if ($attribute == 'created')
+                               if($attribute == 'created')
                                {
                                        $value = $this->now;
                                }
 
-                               if ($attribute == 'modified' && !$modified)
+                               if($attribute == 'modified' && !$modified)
                                {
-                                       unset ($value);
+                                       unset($value);
                                }
 
-                               if ($attribute == 'mime_type')
+                               if($attribute == 'mime_type')
                                {
                                        $value = 'journal';
                                }
 
-                               if ($attribute == 'comment')
+                               if($attribute == 'comment')
                                {
-                                       switch ($data['operation'])
+                                       switch($data['operation'])
                                        {
                                                case VFS_OPERATION_CREATED:
                                                        $value = 'Created';
-                                                       $data['incversion'] = 
True;
+                                                       $data['incversion'] = 
true;
                                                        break;
                                                case VFS_OPERATION_EDITED:
                                                        $value = 'Edited';
-                                                       $data['incversion'] = 
True;
+                                                       $data['incversion'] = 
true;
                                                        break;
                                                case 
VFS_OPERATION_EDITED_COMMENT:
                                                        $value = 'Edited 
comment';
-                                                       $data['incversion'] = 
False;
+                                                       $data['incversion'] = 
false;
                                                        break;
                                                case VFS_OPERATION_COPIED:
-                                                       if (!$data['state_one'])
+                                                       if(!$data['state_one'])
                                                        {
                                                                
$data['state_one'] = $p->fake_full_path;
                                                        }
-                                                       if (!$data['state_two'])
+                                                       if(!$data['state_two'])
                                                        {
-                                                               return False;
+                                                               return false;
                                                        }
-                                                       $value = 'Copied 
'.$data['state_one'].' to '.$data['state_two'];
-                                                       $data['incversion'] = 
False;
+                                                       $value = "Copied 
{$data['state_one']} to {$data['state_two']}";
+                                                       $data['incversion'] = 
false;
                                                        break;
                                                case VFS_OPERATION_MOVED:
-                                                       if (!$data['state_one'])
+                                                       if(!$data['state_one'])
                                                        {
                                                                
$data['state_one'] = $p->fake_full_path;
                                                        }
-                                                       if (!$data['state_two'])
+                                                       if(!$data['state_two'])
                                                        {
-                                                               return False;
+                                                               return false;
                                                        }
-                                                       $value = 'Moved 
'.$data['state_one'].' to '.$data['state_two'];
-                                                       $data['incversion'] = 
False;
+                                                       $value = "Moved 
{$data['state_one']} to {$data['state_two']}";
+                                                       $data['incversion'] = 
false;
                                                        break;
                                                case VFS_OPERATION_DELETED:
                                                        $value = 'Deleted';
-                                                       $data['incversion'] = 
False;
+                                                       $data['incversion'] = 
false;
                                                        break;
                                                default:
                                                        $value = 
$data['operation'];
@@ -324,42 +347,42 @@
                                   was operated on.  The maximum numbers for 
each part in the version string:
                                   none.99.9.9
                                */
-                               if ($attribute == 'version' && 
$data['incversion'])
+                               if($attribute == 'version' && 
$data['incversion'])
                                {
-                                       $version_parts = split ("\.", $value);
-                                       $newnumofparts = $numofparts = count 
($version_parts);
+                                       $version_parts = explode(".", $value);
+                                       $newnumofparts = $numofparts = 
count($version_parts);
 
-                                       if ($version_parts[3] >= 9)
+                                       if($version_parts[3] >= 9)
                                        {
                                                $version_parts[3] = 0;
                                                $version_parts[2]++;
                                                $version_parts_3_update = 1;
                                        }
-                                       elseif (isset ($version_parts[3]))
+                                       else if(isset($version_parts[3]))
                                        {
                                                $version_parts[3]++;
                                        }
 
-                                       if ($version_parts[2] >= 9 && 
$version_parts[3] == 0 && $version_parts_3_update)
+                                       if($version_parts[2] >= 9 && 
$version_parts[3] == 0 && $version_parts_3_update)
                                        {
                                                $version_parts[2] = 0;
                                                $version_parts[1]++;
                                        }
 
-                                       if ($version_parts[1] > 99)
+                                       if($version_parts[1] > 99)
                                        {
                                                $version_parts[1] = 0;
                                                $version_parts[0]++;
                                        }
                                        $newversion = '';
-                                       for ($j = 0; $j < $newnumofparts; $j++)
+                                       for($j = 0; $j < $newnumofparts; $j++)
                                        {
-                                               if (!isset ($version_parts[$j]))
+                                               if(!isset($version_parts[$j]))
                                                {
                                                        break;
                                                }
 
-                                               if ($j)
+                                               if($j)
                                                {
                                                        $newversion .= '.';
                                                }
@@ -367,28 +390,28 @@
                                                $newversion .= 
$version_parts[$j];
                                        }
 
-                                       $this->set_attributes (array(
-                                                       'string'        => 
$p->fake_full_path,
-                                                       'relatives'     => 
array ($p->mask),
+                                       $this->set_attributes(array(
+                                                       'string'                
=> $p->fake_full_path,
+                                                       'relatives'             
=> array($p->mask),
                                                        'attributes'    => 
array(
                                                                                
'version' => $newversion
                                                                        )
                                                )
                                        );
                                }
-                               if (isset ($value) && !empty($value))
+                               if(isset($value) && !empty($value))
                                {
-                                       if ($morethanone)
+                                       if($morethanone)
                                        {
                                                $sql .= ', ';
                                                $sql2 .= ', ';
                                        }
                                        else
                                        {
-                                               $morethanone = True;
+                                               $morethanone = true;
                                        }
                                        $sql .= "$attribute";
-                                       $sql2 .= "'" . $this->clean_string 
(array ('string' => $value)) . "'";
+                                       $sql2 .= "'" . 
$this->clean_string(array('string' => $value)) . "'";
                                }
                        }
                        unset($morethanone);
@@ -403,200 +426,203 @@
                           provide a consistent feel to the system
                        */
                        $flush_path = '';
-                       if ($data['operation'] == VFS_OPERATION_CREATED)
+                       if($data['operation'] == VFS_OPERATION_CREATED)
                        {
                                $flush_path = $p->fake_full_path;
-                               $deleteall = True;
+                               $deleteall = true;
                        }
 
-                       if ($data['operation'] == VFS_OPERATION_COPIED || 
$data['operation'] == VFS_OPERATION_MOVED)
+                       if($data['operation'] == VFS_OPERATION_COPIED || 
$data['operation'] == VFS_OPERATION_MOVED)
                        {
                                $flush_path = $data['state_two'];
-                               $deleteall = False;
+                               $deleteall = false;
                        }
 
-                       if ($flush_path)
+                       if($flush_path)
                        {
-                               $flush_path_parts = $this->path_parts (array(
+                               $flush_path_parts = $this->path_parts(array(
                                                'string'        => $flush_path,
-                                               'relatives'     => array 
(RELATIVE_NONE)
+                                               'relatives'     => 
array(RELATIVE_NONE)
                                        )
                                );
 
-                               $this->flush_journal (array(
+                               $this->flush_journal(array(
                                                'string'        => 
$flush_path_parts->fake_full_path,
-                                               'relatives'     => array 
($flush_path_parts->mask),
+                                               'relatives'     => 
array($flush_path_parts->mask),
                                                'deleteall'     => $deleteall
                                        )
                                );
                        }
 
-                       if ($data['operation'] == VFS_OPERATION_COPIED)
+                       if($data['operation'] == VFS_OPERATION_COPIED)
                        {
                                /*
                                   We copy it going the other way as well, so 
both files show the operation.
                                   The code is a bad hack to prevent recursion. 
 Ideally it would use VFS_OPERATION_COPIED
                                */
-                               $this->add_journal (array(
+                               $this->add_journal(array(
                                                'string'        => 
$data['state_two'],
-                                               'relatives'     => array 
(RELATIVE_NONE),
-                                               'operation'     => 'Copied 
'.$data['state_one'].' to '.$data['state_two'],
-                                               'state_one'     => NULL,
-                                               'state_two'     => NULL,
-                                               'incversion'    => False
+                                               'relatives'     => 
array(RELATIVE_NONE),
+                                               'operation'     => "Copied 
{$data['state_one']} to {$data['state_two']}",
+                                               'state_one'     => null,
+                                               'state_two'     => null,
+                                               'incversion'    => false
                                        )
                                );
                        }
 
-                       if ($data['operation'] == VFS_OPERATION_MOVED)
+                       if($data['operation'] == VFS_OPERATION_MOVED)
                        {
-                               $state_one_path_parts = $this->path_parts 
(array(
+                               $state_one_path_parts = $this->path_parts(array(
                                                'string'        => 
$data['state_one'],
-                                               'relatives'     => array 
(RELATIVE_NONE)
+                                               'relatives'     => 
array(RELATIVE_NONE)
                                        )
                                );
 
-                               $query = $GLOBALS['phpgw']->db->query ("UPDATE 
phpgw_vfs SET mime_type='journal-deleted' WHERE 
directory='".$state_one_path_parts->fake_leading_dirs_clean."' AND 
name='".$state_one_path_parts->fake_name_clean."' AND mime_type='journal'");
+                               $query = $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_vfs SET mime_type='journal-deleted'"
+                                . " WHERE 
directory='{$state_one_path_parts->fake_leading_dirs_clean}'"
+                                . " AND 
name='{$state_one_path_parts->fake_name_clean}' AND mime_type='journal'");
 
                                /*
                                   We create the file in addition to logging 
the MOVED operation.  This is an
                                   advantage because we can now search for 
'Create' to see when a file was created
                                */
-                               $this->add_journal (array(
+                               $this->add_journal(array(
                                                'string'        => 
$data['state_two'],
-                                               'relatives'     => array 
(RELATIVE_NONE),
+                                               'relatives'     => 
array(RELATIVE_NONE),
                                                'operation'     => 
VFS_OPERATION_CREATED
                                        )
                                );
                        }
 
                        /* This is the SQL query we made for THIS request, 
remember that one? */
-                       $query = $GLOBALS['phpgw']->db->query ($sql, __LINE__, 
__FILE__);
+                       $query = $GLOBALS['phpgw']->db->query($sql, __LINE__, 
__FILE__);
 
                        /*
                           If we were to add an option of whether to keep 
journal entries for deleted files
                           or not, it would go in the if here
                        */
-                       if ($data['operation'] == VFS_OPERATION_DELETED)
+                       if($data['operation'] == VFS_OPERATION_DELETED)
                        {
-                               $query = $GLOBALS['phpgw']->db->query ("UPDATE 
phpgw_vfs SET mime_type='journal-deleted' WHERE 
directory='$p->fake_leading_dirs_clean' AND name='$p->fake_name_clean' AND 
mime_type='journal'");
+                               $query = $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_vfs SET mime_type='journal-deleted'"
+                               . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}' AND 
mime_type='journal'");
                        }
 
-                       return True;
+                       return true;
                }
 
                /**
                 * Flush journal entries for $string.  Used before adding 
$string
                *
-                * flush_journal () is an internal function and should be 
called from add_journal () only
+                * flush_journal() is an internal function and should be called 
from add_journal() only
                 * @param string File/directory to flush journal entries of
                 * @param relatives Realtivity array
                 * @param deleteall Delete all types of journal entries, 
including the active Create entry.
                 *               *   Normally you only want to delete the 
Create entry when replacing the file
                 *               *   Note that this option does not effect 
$deleteonly
-                * @param deletedonly Only flush 'journal-deleted' entries 
(created when $string was deleted)
+                * @param deletedonly Only flush 'journal-deleted' 
entries(created when $string was deleted)
                 * @return Boolean True/False
                 */
-               function flush_journal ($data)
+               function flush_journal($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT),
-                                       'deleteall'     => False,
-                                       'deletedonly'   => False
-                               );
+                       (
+                               'relatives'             => 
array(RELATIVE_CURRENT),
+                               'deleteall'             => false,
+                               'deletedonly'   => false
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       $sql = "DELETE FROM phpgw_vfs WHERE 
directory='".$p->fake_leading_dirs_clean."' AND name='".$p->fake_name_clean."'";
+                       $sql = "DELETE FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'";
 
-                       if (!$data['deleteall'])
+                       if(!$data['deleteall'])
                        {
-                               $sql .= " AND (mime_type != 'journal' AND 
comment != 'Created')";
+                               $sql .= " AND(mime_type != 'journal' AND 
comment != 'Created')";
                        }
 
-                       $sql .= "  AND (mime_type='journal-deleted'";
+                       $sql .= "  AND(mime_type='journal-deleted'";
 
-                       if (!$data['deletedonly'])
+                       if(!$data['deletedonly'])
                        {
                                $sql .= " OR mime_type='journal'";
                        }
 
                        $sql .= ")";
 
-                       $query = $GLOBALS['phpgw']->db->query ($sql, __LINE__, 
__FILE__);
+                       $query = $GLOBALS['phpgw']->db->query($sql, __LINE__, 
__FILE__);
 
-                       if ($query)
+                       if($query)
                        {
-                               return True;
+                               return true;
                        }
                        else
                        {
-                               return False;
+                               return false;
                        }
                }
 
                /*
                 * See vfs_shared
                 */
-               function get_journal ($data)
+               function get_journal($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
                                (
-                                       'relatives'     => array 
(RELATIVE_CURRENT),
-                                       'type'  => False
+                                       'relatives'     => 
array(RELATIVE_CURRENT),
+                                       'type'  => false
                                );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string' => $p->fake_full_path,
-                                       'relatives' => array ($p->mask)
+                                       'relatives' => array($p->mask)
                                )))
                        {
-                               return False;
+                               return false;
                        }
 
-                       $sql = "SELECT * FROM phpgw_vfs WHERE 
directory='".$p->fake_leading_dirs_clean."' AND name='".$p->fake_name_clean."'";
+                       $sql = "SELECT * FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'";
 
-                       if ($data['type'] == 1)
+                       if($data['type'] == 1)
                        {
                                $sql .= " AND mime_type='journal'";
                        }
-                       elseif ($data['type'] == 2)
+                       elseif($data['type'] == 2)
                        {
                                $sql .= " AND mime_type='journal-deleted'";
                        }
                        else
                        {
-                               $sql .= " AND (mime_type='journal' OR 
mime_type='journal-deleted')";
+                               $sql .= " AND(mime_type='journal' OR 
mime_type='journal-deleted')";
                        }
 
-                       $query = $GLOBALS['phpgw']->db->query ($sql, __LINE__, 
__FILE__);
+                       $query = $GLOBALS['phpgw']->db->query($sql, __LINE__, 
__FILE__);
 
-                       while ($GLOBALS['phpgw']->db->next_record ())
+                       while($GLOBALS['phpgw']->db->next_record())
                        {
                                $rarray[] = $this->Record();
                        }
@@ -607,82 +633,82 @@
                /*
                 * See vfs_shared
                 */
-               function acl_check ($data)
+               function acl_check($data)
                {
                        //echo 'checking vfs_sql::acl_check(' . print_r($data, 
true) . '</pre>';
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
                                (
-                                       'relatives'     => array 
(RELATIVE_CURRENT),
+                                       'relatives'     => 
array(RELATIVE_CURRENT),
                                        'operation'     => PHPGW_ACL_READ,
-                                       'must_exist'    => False
+                                       'must_exist'    => false
                                );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        /* Accommodate special situations */
-                       if ($this->override_acl || $data['relatives'][0] == 
RELATIVE_USER_APP)
+                       if($this->override_acl || $data['relatives'][0] == 
RELATIVE_USER_APP)
                        {
-                               return True;
+                               return true;
                        }
 
-                       if (!isset($data['owner_id']) || !$data['owner_id'])
+                       if(!isset($data['owner_id']) || !$data['owner_id'])
                        {
-                               $p = $this->path_parts (array(
+                               $p = $this->path_parts(array(
                                                'string'        => 
$data['string'],
-                                               'relatives'     => array 
($data['relatives'][0])
+                                               'relatives'     => 
array($data['relatives'][0])
                                        )
                                );
 
                                /* Temporary, until we get symlink type files 
set up */
-                               if ($p->outside)
+                               if($p->outside)
                                {
-                                       return True;
+                                       return true;
                                }
 
                                /* Read access is always allowed here, but 
nothing else is */
-                               if ($data['string'] == '/' || $data['string'] 
== $this->fakebase)
+                               if($data['string'] == '/' || $data['string'] == 
$this->fakebase)
                                {
-                                       if ($data['operation'] == 
PHPGW_ACL_READ)
+                                       if($data['operation'] == PHPGW_ACL_READ)
                                        {
-                                               return True;
+                                               return true;
                                        }
                                        else
                                        {
-                                               return False;
+                                               return false;
                                        }
                                }
 
                                /* If the file doesn't exist, we get ownership 
from the parent directory */
-                               if (!$this->file_exists (array(
+                               if(!$this->file_exists(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask)
+                                               'relatives'     => 
array($p->mask)
                                        ))
                                )
                                {
-                                       if ($data['must_exist'])
+                                       if($data['must_exist'])
                                        {
-                                               return False;
+                                               return false;
                                        }
 
                                        $data['string'] = $p->fake_leading_dirs;
-                                       $p2 = $this->path_parts (array(
+                                       $p2 = $this->path_parts(array(
                                                        'string'        => 
$data['string'],
-                                                       'relatives'     => 
array ($p->mask)
+                                                       'relatives'     => 
array($p->mask)
                                                )
                                        );
 
-                                       if (!$this->file_exists (array(
+                                       if(!$this->file_exists(array(
                                                        'string'        => 
$data['string'],
-                                                       'relatives'     => 
array ($p->mask)
+                                                       'relatives'     => 
array($p->mask)
                                                ))
                                        )
                                        {
-                                               return False;
+                                               return false;
                                        }
                                }
                                else
@@ -691,11 +717,12 @@
                                }
 
                                /*
-                                  We don't use ls () to get owner_id as we 
normally would,
-                                  because ls () calls acl_check (), which 
would create an infinite loop
+                                  We don't use ls() to get owner_id as we 
normally would,
+                                  because ls() calls acl_check(), which would 
create an infinite loop
                                */
-                               $query = $GLOBALS['phpgw']->db->query ("SELECT 
owner_id FROM phpgw_vfs WHERE directory='".$p2->fake_leading_dirs_clean."' AND 
name='".$p2->fake_name_clean."'" . $this->extra_sql (array ('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
-                               $GLOBALS['phpgw']->db->next_record ();
+                               $query = $GLOBALS['phpgw']->db->query("SELECT 
owner_id FROM phpgw_vfs WHERE directory='{$p2->fake_leading_dirs_clean}'"
+                               . " AND name='{$p2->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                               $GLOBALS['phpgw']->db->next_record();
 
                                $record         = $this->Record();
                                $owner_id       = $record['owner_id'];
@@ -706,7 +733,7 @@
                        }
 
                        /* This is correct.  The ACL currently doesn't handle 
undefined values correctly */
-                       if (!$owner_id)
+                       if(!$owner_id)
                        {
                                $owner_id = 0;
                        }
@@ -714,117 +741,69 @@
                        $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
 
                        /* They always have access to their own files */
-                       if ($owner_id == $user_id)
+                       if($owner_id == $user_id)
                        {
-                               return True;
+                               return true;
                        }
 
-                       /* Check if they're in the group */
-                       $memberships = $GLOBALS['phpgw']->accounts->membership 
($user_id);
-
-                       if (is_array ($memberships))
-                       {
-                               reset ($memberships);
-                               while (list ($num, $group_array) = each 
($memberships))
-                               {
-                                       if ($owner_id == $group_array->id)
-                                       {
-                                               $group_ok = 1;
-                                               break;
-                                       }
-                               }
-                       }
-
-                       $acl = CreateObject ('phpgwapi.acl', $owner_id);
-                       $acl->set_account_id($owner_id, true);
-
-                       $rights = $acl->get_rights ($user_id);
-
-                       /* Add privileges from the groups this user belongs to 
*/
-                       if (is_array ($memberships))
-                       {
-                               reset ($memberships);
-                               while (list ($num, $group_array) = each 
($memberships))
-                               {
-                                       $rights |= $acl->get_rights 
($group_array->id);
-                               }
-                       }
-
-                       if ($rights & $data['operation'])
-                       {
-                               return True;
-                       }
-                       elseif (!$rights && $group_ok)
-                       {
-                               $conf = CreateObject('phpgwapi.config', 
'phpgwapi');
-                               $conf->read();
-                               if ($conf->config_data['acl_default'] == 
'grant')
-                               {
-                                       return True;
-                               }
-                               else
-                               {
-                                       return False;
-                               }
-                       }
-                       else
-                       {
-                               return False;
-                       }
+                       $currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       return $GLOBALS['phpgw']->acl->check('run', 
PHPGW_ACL_READ, $currentapp);
                }
 
                /*
                 * See vfs_shared
                 */
-               function read ($data)
+               function read($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
+                                       'relatives'     => array($p->mask),
                                        'operation'     => PHPGW_ACL_READ
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       $conf = CreateObject('phpgwapi.config', 'phpgwapi');
-                       $conf->read();
-                       if ($this->file_actions || $p->outside)
+                       if($this->file_actions || $p->outside)
                        {
-                               if (filesize ($p->real_full_path) > 0 && $fp = 
fopen ($p->real_full_path, 'rb'))
+                               if($p->outside)
                                {
-                                       $contents = fread ($fp, filesize 
($p->real_full_path));
-                                       fclose ($fp);
+                                       $contents = null;
+                                       if( $filesize = 
filesize($p->real_full_path) > 0 && $fp = fopen($p->real_full_path, 'rb'))
+                                       {
+                                               $contents = fread($fp, 
$filesize);
+                                               fclose ($fp);
+                                       }
                                }
                                else
                                {
-                                       $contents = False;
+                                       $contents = 
$this->fileoperation->read($p);
                                }
                        }
                        else
                        {
-                               $ls_array = $this->ls (array(
+                               $ls_array = $this->ls(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask)
+                                               'relatives'     => 
array($p->mask)
                                        )
                                );
 
@@ -837,30 +816,30 @@
                /*
                 * See vfs_shared
                 */
-               function write ($data)
+               function write($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT),
-                                       'content'       => ''
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT),
+                               'content'       => ''
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if ($this->file_exists (array (
+                       if($this->file_exists(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask)
+                                       'relatives'     => array($p->mask)
                                ))
                        )
                        {
@@ -872,240 +851,235 @@
                                $acl_operation = PHPGW_ACL_ADD;
                        }
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
+                                       'relatives'     => array($p->mask),
                                        'operation'     => $acl_operation
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
                        umask(000);
 
                        /*
-                          If 'string' doesn't exist, touch () creates both the 
file and the database entry
-                          If 'string' does exist, touch () sets the 
modification time and modified by
+                          If 'string' doesn't exist, touch() creates both the 
file and the database entry
+                          If 'string' does exist, touch() sets the 
modification time and modified by
                        */
-                       $this->touch (array(
+                       $this->touch(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask)
+                                       'relatives'     => array($p->mask)
                                )
                        );
 
-                       $conf = CreateObject('phpgwapi.config', 'phpgwapi');
-                       $conf->read();
-                       if ($this->file_actions)
+                       if($this->file_actions)
                        {
-                               if ($fp = fopen ($p->real_full_path, 'wb'))
-                               {
-                                       fwrite ($fp, $data['content'], strlen 
($data['content']));
-                                       fclose ($fp);
-                                       $write_ok = 1;
-                               }
+                               $write_ok = $this->fileoperation->write($p, 
$data['content']);
                        }
 
-                       if ($write_ok || !$this->file_actions)
+                       if($write_ok || !$this->file_actions)
                        {
-                               if ($this->file_actions)
+                               if($this->file_actions)
                                {
                                        $set_attributes_array = array(
-                                               'size' => filesize 
($p->real_full_path)
+                                               'size'  => 
strlen($data['content']),
                                        );
                                }
                                else
                                {
-                                       $set_attributes_array = array (
-                                               'size'  => strlen 
($data['content']),
+                                       $set_attributes_array = array(
+                                               'size'  => 
strlen($data['content']),
                                                'content'       => 
$data['content']
                                        );
                                }
 
-
-                               $this->set_attributes (array
+                               $this->set_attributes(array
                                        (
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                                               'relatives'     => 
array($p->mask),
                                                'attributes'    => 
$set_attributes_array
                                        )
                                );
 
-                               if ($journal_operation)
+                               if($journal_operation)
                                {
-                                       $this->add_journal (array(
+                                       $this->add_journal(array(
                                                        'string'        => 
$p->fake_full_path,
-                                                       'relatives'     => 
array ($p->mask),
+                                                       'relatives'     => 
array($p->mask),
                                                        'operation'     => 
$journal_operation
                                                )
                                        );
                                }
 
-                               return True;
+                               return true;
                        }
                        else
                        {
-                               return False;
+                               return false;
                        }
                }
 
                /*
                 * See vfs_shared
                 */
-               function touch ($data)
+               function touch($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       umask (000);
+                       umask(000);
 
-                       if ($this->file_actions)
+                       if($this->file_actions)
                        {
                                /*
                                   PHP's touch function will automatically 
decide whether to
                                   create the file or set the modification time
                                */
-                               $rr = @touch ($p->real_full_path);
 
-                               if ($p->outside)
+                               /* In case of $p->outside: touch on local disk 
*/
+                               if($p->outside)
                                {
-                                       return $rr;
+                                       return @touch($p->real_full_path);
                                }
+                               else
+                               {
+                                       $rr = $this->fileoperation->touch($p);
+                               }
                        }
 
                        /* We, however, have to decide this ourselves */
-                       if ($this->file_exists (array(
+                       if($this->file_exists(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask)
+                                       'relatives'     => array($p->mask)
                                ))
                        )
                        {
-                               if (!$this->acl_check (array(
+                               if(!$this->acl_check(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                                               'relatives'     => 
array($p->mask),
                                                'operation'     => 
PHPGW_ACL_EDIT
                                        )))
                                {
-                                       return False;
+                                       return false;
                                }
 
-                               $vr = $this->set_attributes (array(
-                                               'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                               $vr = $this->set_attributes(array(
+                                               'string'                => 
$p->fake_full_path,
+                                               'relatives'             => 
array($p->mask),
                                                'attributes'    => array(
                                                                        
'modifiedby_id' => $account_id,
-                                                                       
'modified' => $this->now
+                                                                       
'modified'              => $this->now
                                                                )
                                                )
                                        );
                        }
                        else
                        {
-                               if (!$this->acl_check (array(
+                               if(!$this->acl_check(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                                               'relatives'     => 
array($p->mask),
                                                'operation'     => PHPGW_ACL_ADD
                                        ))
                                )
                                {
-                                       return False;
+                                       return false;
                                }
 
-                               $query = $GLOBALS['phpgw']->db->query ('INSERT 
INTO phpgw_vfs (owner_id, directory, name) VALUES (' . $this->working_id . ",'" 
. $p->fake_leading_dirs_clean . "','"
-                                                                               
                                . $p->fake_name_clean . "')", __LINE__, 
__FILE__);
+                               $query = $GLOBALS['phpgw']->db->query("INSERT 
INTO phpgw_vfs (owner_id, directory, name)"
+                                . " 
VALUES({$this->working_id},'{$p->fake_leading_dirs_clean}', 
'{$p->fake_name_clean}')", __LINE__, __FILE__);
 
                                $this->set_attributes(array(
-                                       'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
-                                       'attributes'    => array (
-                                                               'createdby_id' 
=> $account_id,
-                                                               'created' => 
$this->now,
-                                                               'size' => 0,
-                                                               'deleteable' => 
'Y',
-                                                               'app' => 
$currentapp
+                                       'string'                => 
$p->fake_full_path,
+                                       'relatives'             => 
array($p->mask),
+                                       'attributes'    => array(
+                                                               'createdby_id'  
=> $account_id,
+                                                               'created'       
        => $this->now,
+                                                               'size'          
        => 0,
+                                                               'deleteable'    
=> 'Y',
+                                                               'app'           
        => $currentapp
                                                        )
                                        )
                                );
-                               $this->correct_attributes (array(
+                               $this->correct_attributes(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask)
+                                               'relatives'     => 
array($p->mask)
                                        )
                                );
-       
-                               $this->add_journal (array(
+
+                               $this->add_journal(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                                               'relatives'     => 
array($p->mask),
                                                'operation'     => 
VFS_OPERATION_CREATED
                                        )
                                );
                        }
 
-                       if ($rr || $vr || $query)
+                       if($rr || $vr || $query)
                        {
-                               return True;
+                               return true;
                        }
                        else
                        {
-                               return False;
+                               return false;
                        }
                }
 
                /*
                 * See vfs_shared
                 */
-               function cp ($data)
+               function cp($data)
                {
                        if(!$data['from'])
                        {
                                throw new Exception('nothing to copy from');
                        }
 
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT, RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT, 
RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
-                       $f = $this->path_parts (array(
+                       $f = $this->path_parts(array(
                                        'string'        => $data['from'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       $t = $this->path_parts (array(
+                       $t = $this->path_parts(array(
                                        'string'        => $data['to'],
-                                       'relatives'     => array 
($data['relatives'][1])
+                                       'relatives'     => 
array($data['relatives'][1])
                                )
                        );
 
-
-                       if(!file_exists($t->real_leading_dirs))
+                       if(!$this->fileoperation->check_target_directory($t))
                        {
                                $GLOBALS['phpgw']->log->error(array(
                                        'text' => 'vfs::cp() : missing target 
directory %1',
@@ -1118,225 +1092,232 @@
                                return false;
                        }
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask),
+                                       'relatives'     => array($f->mask),
                                        'operation'     => PHPGW_ACL_READ
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       if ($this->file_exists (array(
+                       if($this->file_exists(array(
                                        'string'        => $t->fake_full_path,
-                                       'relatives'     => array ($t->mask)
+                                       'relatives'     => array($t->mask)
                                ))
                        )
                        {
-                               if (!$this->acl_check (array(
+                               if(!$this->acl_check(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
+                                               'relatives'     => 
array($t->mask),
                                                'operation'     => 
PHPGW_ACL_EDIT
                                        ))
                                )
                                {
-                                       return False;
+                                       return false;
                                }
                        }
                        else
                        {
-                               if (!$this->acl_check (array(
+                               if(!$this->acl_check(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
+                                               'relatives'     => 
array($t->mask),
                                                'operation'     => PHPGW_ACL_ADD
                                        ))
                                )
                                {
-                                       return False;
+                                       return false;
                                }
 
                        }
 
                        umask(000);
 
-                       if ($this->file_type (array(
+                       if($this->file_type(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask)
+                                       'relatives'     => array($f->mask)
                                )) != 'Directory'
                        )
                        {
-                               if ($this->file_actions)
+                               if($this->file_actions)
                                {
-                                       if (!copy ($f->real_full_path, 
$t->real_full_path))
+                                       if(!$this->fileoperation->copy($f, $t))
                                        {
-                                               return False;
+                                               return false;
                                        }
 
-                                       $size = filesize ($t->real_full_path);
+                                       $size = 
$this->fileoperation->filesize($t);
                                }
                                else
                                {
-                                       $content = $this->read (array(
+                                       $content = $this->read(array(
                                                        'string'        => 
$f->fake_full_path,
-                                                       'relatives'     => 
array ($f->mask)
+                                                       'relatives'     => 
array($f->mask)
                                                )
                                        );
 
-                                       $size = strlen ($content);
+                                       $size = strlen($content);
                                }
 
-                               if ($t->outside)
+                               if($t->outside)
                                {
-                                       return True;
+                                       return true;
                                }
 
-                               $ls_array = $this->ls (array(
+                               $ls_array = $this->ls(array(
                                                'string'        => 
$f->real_full_path, // Sigurd: seems to work better with real - old: 'string'   
     => $f->fake_full_path,
-                                               'relatives'     => array 
($f->mask),
-                                               'checksubdirs'  => False,
-                                               'mime_type'     => False,
-                                               'nofiles'       => True
+                                               'relatives'     => 
array($f->mask),
+                                               'checksubdirs'  => false,
+                                               'mime_type'     => false,
+                                               'nofiles'       => true
                                        )
                                );
                                $record = $ls_array[0];
 
-                               if ($this->file_exists (array(
+                               if($this->file_exists(array(
                                                'string'        => $data['to'],
-                                               'relatives'     => array 
($data['relatives'][1])
+                                               'relatives'     => 
array($data['relatives'][1])
                                        ))
                                )
                                {
-                                       $query = $GLOBALS['phpgw']->db->query 
("UPDATE phpgw_vfs SET owner_id='$this->working_id', 
directory='$t->fake_leading_dirs_clean', name='$t->fake_name_clean' WHERE 
owner_id='$this->working_id' AND directory='$t->fake_leading_dirs_clean' AND 
name='$t->fake_name_clean'" . $this->extra_sql (VFS_SQL_UPDATE), __LINE__, 
__FILE__);
+                                       $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET 
owner_id='{$this->working_id}',"
+                                       . " 
directory='{$t->fake_leading_dirs_clean}',"
+                                       . " name='{$t->fake_name_clean}'"
+                                       . " WHERE 
owner_id='{$this->working_id}' AND directory='{$t->fake_leading_dirs_clean}'"
+                                       . " AND name='{$t->fake_name_clean}'" . 
$this->extra_sql(VFS_SQL_UPDATE), __LINE__, __FILE__);
 
-                                       $set_attributes_array = array (
-                                               'createdby_id' => $account_id,
-                                               'created' => $this->now,
-                                               'size' => $size,
-                                               'mime_type' => 
$record['mime_type'],
-                                               'deleteable' => 
$record['deleteable'],
-                                               'comment' => $record['comment'],
-                                               'app' => $record['app']
+                                       $set_attributes_array = array
+                                       (
+                                               'createdby_id'  => $account_id,
+                                               'created'               => 
$this->now,
+                                               'size'                  => 
$size,
+                                               'mime_type'             => 
$record['mime_type'],
+                                               'deleteable'    => 
$record['deleteable'],
+                                               'comment'               => 
$record['comment'],
+                                               'app'                   => 
$record['app']
                                        );
 
-                                       if (!$this->file_actions)
+                                       if(!$this->file_actions)
                                        {
                                                
$set_attributes_array['content'] = $content;
                                        }
 
                                        $this->set_attributes(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
+                                               'relatives'     => 
array($t->mask),
                                                'attributes'    => 
$set_attributes_array
                                                )
                                        );
 
-                                       $this->add_journal (array(
+                                       $this->add_journal(array(
                                                        'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask),
+                                                       'relatives'     => 
array($t->mask),
                                                        'operation'     => 
VFS_OPERATION_EDITED
                                                )
                                        );
                                }
                                else
                                {
-                                       $this->touch (array(
+                                       $this->touch(array(
                                                        'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask)
+                                                       'relatives'     => 
array($t->mask)
                                                )
                                        );
 
-                                       $set_attributes_array = array (
-                                               'createdby_id' => $account_id,
-                                               'created' => $this->now,
-                                               'size' => $size,
-                                               'mime_type' => 
$record['mime_type'],
-                                               'deleteable' => 
$record['deleteable'],
-                                               'comment' => $record['comment'],
-                                               'app' => $record['app']
+                                       $set_attributes_array = array
+                                       (
+                                               'createdby_id'  => $account_id,
+                                               'created'               => 
$this->now,
+                                               'size'                  => 
$size,
+                                               'mime_type'             => 
$record['mime_type'],
+                                               'deleteable'    => 
$record['deleteable'],
+                                               'comment'               => 
$record['comment'],
+                                               'app'                   => 
$record['app']
                                        );
 
-                                       if (!$this->file_actions)
+                                       if(!$this->file_actions)
                                        {
                                                
$set_attributes_array['content'] = $content;
                                        }
 
                                        $this->set_attributes(array(
                                                        'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask),
+                                                       'relatives'     => 
array($t->mask),
                                                        'attributes'    => 
$set_attributes_array
                                                )
                                        );
                                }
-                               $this->correct_attributes (array(
+                               $this->correct_attributes(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask)
+                                               'relatives'     => 
array($t->mask)
                                        )
                                );
                        }
                        else    /* It's a directory */
                        {
                                /* First, make the initial directory */
-                               if ($this->mkdir (array(
+                               if($this->mkdir(array(
                                                'string'        => $data['to'],
-                                               'relatives'     => array 
($data['relatives'][1])
-                                       )) === False
+                                               'relatives'     => 
array($data['relatives'][1])
+                                       )) === false
                                )
                                {
-                                       return False;
+                                       return false;
                                }
 
                                /* Next, we create all the directories below 
the initial directory */
-                               $ls = $this->ls (array(
+                               $ls = $this->ls(array(
                                                'string'        => 
$f->fake_full_path,
-                                               'relatives'     => array 
($f->mask),
-                                               'checksubdirs'  => True,
+                                               'relatives'     => 
array($f->mask),
+                                               'checksubdirs'  => true,
                                                'mime_type'     => 'Directory'
                                        )
                                );
 
-                               while (list ($num, $entry) = each ($ls))
+                               while(list($num, $entry) = each($ls))
                                {
-                                       $newdir = ereg_replace 
("^$f->fake_full_path", "$t->fake_full_path", $entry['directory']);
-                                       if ($this->mkdir (array(
-                                                       'string'        => 
$newdir.'/'.$entry['name'],
-                                                       'relatives'     => 
array ($t->mask)
-                                               )) === False
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+
+                                       if($this->mkdir(array(
+                                                       'string'        => 
"{$newdir}/{$entry['name']}",
+                                                       'relatives'     => 
array($t->mask)
+                                               )) === false
                                        )
                                        {
-                                               return False;
+                                               return false;
                                        }
                                }
 
                                /* Lastly, we copy the files over */
-                               $ls = $this->ls (array(
+                               $ls = $this->ls(array(
                                                'string'        => 
$f->fake_full_path,
-                                               'relatives'     => array 
($f->mask)
+                                               'relatives'     => 
array($f->mask)
                                        )
                                );
 
-                               while (list ($num, $entry) = each ($ls))
+                               while(list($num, $entry) = each($ls))
                                {
-                                       if ($entry['mime_type'] == 'Directory')
+                                       if($entry['mime_type'] == 'Directory')
                                        {
                                                continue;
                                        }
 
-                                       $newdir = ereg_replace 
("^$f->fake_full_path", "$t->fake_full_path", $entry['directory']);
-                                       $this->cp (array(
-                                                       'from'  => 
"$entry[directory]/$entry[name]",
-                                                       'to'    => 
"$newdir/$entry[name]",
-                                                       'relatives'     => 
array ($f->mask, $t->mask)
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+                                       $this->cp(array(
+                                                       'from'  => 
"{$entry[directory]}/{$entry[name]}",
+                                                       'to'    => 
"{$newdir}/{$entry[name]}",
+                                                       'relatives'     => 
array($f->mask, $t->mask)
                                                )
                                        );
                                }
                        }
 
-                       if (!$f->outside)
+                       if(!$f->outside)
                        {
-                               $this->add_journal (array(
+                               $this->add_journal(array(
                                                'string'        => 
$f->fake_full_path,
-                                               'relatives'     => array 
($f->mask),
+                                               'relatives'     => 
array($f->mask),
                                                'operation'     => 
VFS_OPERATION_COPIED,
                                                'state_one'     => NULL,
                                                'state_two'     => 
$t->fake_full_path
@@ -1344,227 +1325,232 @@
                                );
                        }
 
-                       return True;
+                       return true;
                }
                /*
                 * Same as cp function, except an exception is thrown if there 
is a failure
                 * errors have also been expanded
                 */
-               function cp2 ($data)
+               function cp2($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT, RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT, 
RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
-                       $f = $this->path_parts (array(
+                       $f = $this->path_parts(array(
                                        'string'        => $data['from'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       $t = $this->path_parts (array(
+                       $t = $this->path_parts(array(
                                        'string'        => $data['to'],
-                                       'relatives'     => array 
($data['relatives'][1])
+                                       'relatives'     => 
array($data['relatives'][1])
                                )
                        );
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask),
+                                       'relatives'     => array($f->mask),
                                        'operation'     => PHPGW_ACL_READ
                                ))
                        )
                        {
-                               throw new Exception('ACL (READ) check failed!');
+                               throw new Exception('ACL(READ) check failed!');
                        }
 
-                       if ($this->file_exists (array(
+                       if($this->file_exists(array(
                                        'string'        => $t->fake_full_path,
-                                       'relatives'     => array ($t->mask)
+                                       'relatives'     => array($t->mask)
                                ))
                        )
                        {
-                               if (!$this->acl_check (array(
+                               if(!$this->acl_check(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
+                                               'relatives'     => 
array($t->mask),
                                                'operation'     => 
PHPGW_ACL_EDIT
                                        ))
                                )
                                {
-                                       throw new Exception('ACL (EDII) check 
failed!');
+                                       throw new Exception('ACL(EDIT) check 
failed!');
                                }
                        }
                        else
                        {
-                               if (!$this->acl_check (array(
+                               if(!$this->acl_check(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
+                                               'relatives'     => 
array($t->mask),
                                                'operation'     => PHPGW_ACL_ADD
                                        ))
                                )
                                {
-                                       throw new Exception('ACL (ADD) check 
failed!');
+                                       throw new Exception('ACL(ADD) check 
failed!');
                                }
 
                        }
 
                        umask(000);
 
-                       if ($this->file_type (array(
+                       if($this->file_type(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask)
+                                       'relatives'     => array($f->mask)
                                )) != 'Directory'
                        )
                        {
-                               if ($this->file_actions)
+                               if($this->file_actions)
                                {
-                                       if (!copy ($f->real_full_path, 
$t->real_full_path))
+                                       if(!$this->fileoperation->copy($f, $t))
                                        {
                                                $error = "Copy failed!\n";
                                                $error = $error. 
"f->real_full_path: $f->real_full_path \n";
                                                $error = $error. 
"t->real_full_path: $t->real_full_path \n";
                                                throw new Exception($error);
                                        }
-
-                                       $size = filesize ($t->real_full_path);
+                                       $size = 
$this->fileoperation->filesize($t);
                                }
                                else
                                {
-                                       $content = $this->read (array(
+                                       $content = $this->read(array(
                                                        'string'        => 
$f->fake_full_path,
-                                                       'relatives'     => 
array ($f->mask)
+                                                       'relatives'     => 
array($f->mask)
                                                )
                                        );
 
-                                       $size = strlen ($content);
+                                       $size = strlen($content);
                                }
 
-                               if ($t->outside)
+                               if($t->outside)
                                {
-                                       return True;
+                                       return true;
                                }
 
-                               $ls_array = $this->ls (array(
-                                               'string'        => 
$f->real_full_path, // Sigurd: seems to work better with real - old: 'string'   
     => $f->fake_full_path,
-                                               'relatives'     => array 
($f->mask),
-                                               'checksubdirs'  => False,
-                                               'mime_type'     => False,
-                                               'nofiles'       => True
+                               $ls_array = $this->ls(array(
+                                               'string'                => 
$f->real_full_path, // Sigurd: seems to work better with real - old: 'string'   
     => $f->fake_full_path,
+                                               'relatives'             => 
array($f->mask),
+                                               'checksubdirs'  => false,
+                                               'mime_type'             => 
false,
+                                               'nofiles'               => true
                                        )
                                );
                                $record = $ls_array[0];
 
-                               if ($this->file_exists (array(
+                               if($this->file_exists(array(
                                                'string'        => $data['to'],
-                                               'relatives'     => array 
($data['relatives'][1])
+                                               'relatives'     => 
array($data['relatives'][1])
                                        ))
                                )
                                {
-                                       $query = $GLOBALS['phpgw']->db->query 
("UPDATE phpgw_vfs SET owner_id='$this->working_id', 
directory='$t->fake_leading_dirs_clean', name='$t->fake_name_clean' WHERE 
owner_id='$this->working_id' AND directory='$t->fake_leading_dirs_clean' AND 
name='$t->fake_name_clean'" . $this->extra_sql (VFS_SQL_UPDATE), __LINE__, 
__FILE__);
+                                       $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET 
owner_id='{$this->working_id}',"
+                                       . " 
directory='{$t->fake_leading_dirs_clean}',"
+                                       . " name='{$t->fake_name_clean}'"
+                                       . " WHERE 
owner_id='{$this->working_id}' AND directory='{$t->fake_leading_dirs_clean}'"
+                                       . " AND name='$t->fake_name_clean'" . 
$this->extra_sql(VFS_SQL_UPDATE), __LINE__, __FILE__);
 
-                                       $set_attributes_array = array (
-                                               'createdby_id' => $account_id,
-                                               'created' => $this->now,
-                                               'size' => $size,
-                                               'mime_type' => 
$record['mime_type'],
-                                               'deleteable' => 
$record['deleteable'],
-                                               'comment' => $record['comment'],
-                                               'app' => $record['app']
+                                       $set_attributes_array = array
+                                       (
+                                               'createdby_id'          => 
$account_id,
+                                               'created'                       
=> $this->now,
+                                               'size'                          
=> $size,
+                                               'mime_type'                     
=> $record['mime_type'],
+                                               'deleteable'            => 
$record['deleteable'],
+                                               'comment'                       
=> $record['comment'],
+                                               'app'                           
=> $record['app']
                                        );
 
-                                       if (!$this->file_actions)
+                                       if(!$this->file_actions)
                                        {
                                                
$set_attributes_array['content'] = $content;
                                        }
 
                                        $this->set_attributes(array(
-                                               'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
+                                               'string'                => 
$t->fake_full_path,
+                                               'relatives'             => 
array($t->mask),
                                                'attributes'    => 
$set_attributes_array
                                                )
                                        );
 
-                                       $this->add_journal (array(
+                                       $this->add_journal(array(
                                                        'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask),
+                                                       'relatives'     => 
array($t->mask),
                                                        'operation'     => 
VFS_OPERATION_EDITED
                                                )
                                        );
                                }
                                else
                                {
-                                       $this->touch (array(
+                                       $this->touch(array(
                                                        'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask)
+                                                       'relatives'     => 
array($t->mask)
                                                )
                                        );
 
-                                       $set_attributes_array = array (
-                                               'createdby_id' => $account_id,
-                                               'created' => $this->now,
-                                               'size' => $size,
-                                               'mime_type' => 
$record['mime_type'],
-                                               'deleteable' => 
$record['deleteable'],
-                                               'comment' => $record['comment'],
-                                               'app' => $record['app']
+                                       $set_attributes_array = array
+                                       (
+                                               'createdby_id'          => 
$account_id,
+                                               'created'                       
=> $this->now,
+                                               'size'                          
=> $size,
+                                               'mime_type'                     
=> $record['mime_type'],
+                                               'deleteable'            => 
$record['deleteable'],
+                                               'comment'                       
=> $record['comment'],
+                                               'app'                           
=> $record['app']
                                        );
 
-                                       if (!$this->file_actions)
+                                       if(!$this->file_actions)
                                        {
                                                
$set_attributes_array['content'] = $content;
                                        }
 
                                        $this->set_attributes(array(
-                                                       'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask),
+                                                       'string'                
=> $t->fake_full_path,
+                                                       'relatives'             
=> array($t->mask),
                                                        'attributes'    => 
$set_attributes_array
                                                )
                                        );
                                }
-                               $this->correct_attributes (array(
+                               $this->correct_attributes(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask)
+                                               'relatives'     => 
array($t->mask)
                                        )
                                );
                        }
                        else    /* It's a directory */
                        {
                                /* First, make the initial directory */
-                               if ($this->mkdir (array(
+                               if($this->mkdir(array(
                                                'string'        => $data['to'],
-                                               'relatives'     => array 
($data['relatives'][1])
-                                       )) === False
+                                               'relatives'     => 
array($data['relatives'][1])
+                                       )) === false
                                )
                                {
                                        throw new Exception('Error, it is a 
directory');
                                }
 
                                /* Next, we create all the directories below 
the initial directory */
-                               $ls = $this->ls (array(
-                                               'string'        => 
$f->fake_full_path,
-                                               'relatives'     => array 
($f->mask),
-                                               'checksubdirs'  => True,
-                                               'mime_type'     => 'Directory'
+                               $ls = $this->ls(array(
+                                               'string'                => 
$f->fake_full_path,
+                                               'relatives'             => 
array($f->mask),
+                                               'checksubdirs'  => true,
+                                               'mime_type'             => 
'Directory'
                                        )
                                );
 
-                               while (list ($num, $entry) = each ($ls))
+                               while(list($num, $entry) = each($ls))
                                {
-                                       $newdir = ereg_replace 
("^$f->fake_full_path", "$t->fake_full_path", $entry['directory']);
-                                       if ($this->mkdir (array(
-                                                       'string'        => 
$newdir.'/'.$entry['name'],
-                                                       'relatives'     => 
array ($t->mask)
-                                               )) === False
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+                                       if($this->mkdir(array(
+                                                       'string'        => 
"{$newdir}/{$entry['name']}",
+                                                       'relatives'     => 
array($t->mask)
+                                               )) === false
                                        )
                                        {
                                                throw new Exception('While loop 
error!');
@@ -1572,34 +1558,35 @@
                                }
 
                                /* Lastly, we copy the files over */
-                               $ls = $this->ls (array(
+                               $ls = $this->ls(array(
                                                'string'        => 
$f->fake_full_path,
-                                               'relatives'     => array 
($f->mask)
+                                               'relatives'     => 
array($f->mask)
                                        )
                                );
 
-                               while (list ($num, $entry) = each ($ls))
+                               while(list($num, $entry) = each($ls))
                                {
-                                       if ($entry['mime_type'] == 'Directory')
+                                       if($entry['mime_type'] == 'Directory')
                                        {
                                                continue;
                                        }
 
-                                       $newdir = ereg_replace 
("^$f->fake_full_path", "$t->fake_full_path", $entry['directory']);
-                                       $this->cp (array(
-                                                       'from'  => 
"$entry[directory]/$entry[name]",
-                                                       'to'    => 
"$newdir/$entry[name]",
-                                                       'relatives'     => 
array ($f->mask, $t->mask)
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+
+                                       $this->cp(array(
+                                                       'from'          => 
"{$entry[directory]}/{$entry[name]}",
+                                                       'to'            => 
"{$newdir}/{$entry[name]}",
+                                                       'relatives'     => 
array($f->mask, $t->mask)
                                                )
                                        );
                                }
                        }
 
-                       if (!$f->outside)
+                       if(!$f->outside)
                        {
-                               $this->add_journal (array(
+                               $this->add_journal(array(
                                                'string'        => 
$f->fake_full_path,
-                                               'relatives'     => array 
($f->mask),
+                                               'relatives'     => 
array($f->mask),
                                                'operation'     => 
VFS_OPERATION_COPIED,
                                                'state_one'     => NULL,
                                                'state_two'     => 
$t->fake_full_path
@@ -1607,116 +1594,117 @@
                                );
                        }
 
-                       return True;
+                       return true;
                }
                /*
                 * See vfs_shared
                 */
-               function mv ($data)
+               function mv($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT, RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT, 
RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $f = $this->path_parts (array(
+                       $f = $this->path_parts(array(
                                        'string'        => $data['from'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       $t = $this->path_parts (array(
+                       $t = $this->path_parts(array(
                                        'string'        => $data['to'],
-                                       'relatives'     => array 
($data['relatives'][1])
+                                       'relatives'     => 
array($data['relatives'][1])
                                )
                        );
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask),
+                                       'relatives'     => array($f->mask),
                                        'operation'     => PHPGW_ACL_READ
                                ))
-                               || !$this->acl_check (array(
+                               || !$this->acl_check(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask),
+                                       'relatives'     => array($f->mask),
                                        'operation'     => PHPGW_ACL_DELETE
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $t->fake_full_path,
-                                       'relatives'     => array ($t->mask),
+                                       'relatives'     => array($t->mask),
                                        'operation'     => PHPGW_ACL_ADD
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       if ($this->file_exists (array(
+                       if($this->file_exists(array(
                                        'string'        => $t->fake_full_path,
-                                       'relatives'     => array ($t->mask)
+                                       'relatives'     => array($t->mask)
                                ))
                        )
                        {
-                               if (!$this->acl_check (array(
+                               if(!$this->acl_check(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
+                                               'relatives'     => 
array($t->mask),
                                                'operation'     => 
PHPGW_ACL_EDIT
                                        ))
                                )
                                {
-                                       return False;
+                                       return false;
                                }
                        }
 
-                       umask (000);
+                       umask(000);
 
                        /* We can't move directories into themselves */
-                       if (($this->file_type (array(
+                       if(($this->file_type(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask)
+                                       'relatives'     => array($f->mask)
                                ) == 'Directory'))
-                               && ereg ("^$f->fake_full_path", 
$t->fake_full_path)
+//                             && preg_match("/^{$f->fake_full_path}/", 
$t->fake_full_path)
+                               && preg_match("/^" . str_replace('/', '\/', 
$f->fake_full_path). "/", $t->fake_full_path)
                        )
                        {
-                               if (($t->fake_full_path == $f->fake_full_path) 
|| substr ($t->fake_full_path, strlen ($f->fake_full_path), 1) == '/')
+                               if(($t->fake_full_path == $f->fake_full_path) 
|| substr($t->fake_full_path, strlen($f->fake_full_path), 1) == '/')
                                {
-                                       return False;
+                                       return false;
                                }
                        }
-                       if ($this->file_exists (array(
+                       if($this->file_exists(array(
                                        'string'        => $f->fake_full_path,
-                                       'relatives'     => array ($f->mask)
+                                       'relatives'     => array($f->mask)
                                ))
                        )
                        {
                                /* We get the listing now, because it will 
change after we update the database */
-                               $ls = $this->ls (array(
+                               $ls = $this->ls(array(
                                                'string'        => 
$f->fake_full_path,
-                                               'relatives'     => array 
($f->mask)
+                                               'relatives'     => 
array($f->mask)
                                        )
                                );
 
-                               if ($this->file_exists (array(
+                               if($this->file_exists(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask)
+                                               'relatives'     => 
array($t->mask)
                                        ))
                                )
                                {
-                                       $this->rm (array(
+                                       $this->rm(array(
                                                        'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask)
+                                                       'relatives'     => 
array($t->mask)
                                                )
                                        );
                                }
@@ -1725,11 +1713,11 @@
                                   We add the journal entry now, before we 
delete.  This way the mime_type
                                   field will be updated to 'journal-deleted' 
when the file is actually deleted
                                */
-                               if (!$f->outside)
+                               if(!$f->outside)
                                {
-                                       $this->add_journal (array(
+                                       $this->add_journal(array(
                                                        'string'        => 
$f->fake_full_path,
-                                                       'relatives'     => 
array ($f->mask),
+                                                       'relatives'     => 
array($f->mask),
                                                        'operation'     => 
VFS_OPERATION_MOVED,
                                                        'state_one'     => 
$f->fake_full_path,
                                                        'state_two'     => 
$t->fake_full_path
@@ -1741,54 +1729,58 @@
                                   If the from file is outside, it won't have a 
database entry,
                                   so we have to touch it and find the size
                                */
-                               if ($f->outside)
+                               if($f->outside)
                                {
-                                       $size = filesize ($f->real_full_path);
-                                       if ( $size === False )
+                                       $size = filesize($f->real_full_path);
+                                       if( $size === false )
                                        {
                                                _debug_array($f);
                                                $size = 1;
                                        }
-                                       $this->touch (array(
+                                       $this->touch(array(
                                                        'string'        => 
$t->fake_full_path,
-                                                       'relatives'     => 
array ($t->mask)
+                                                       'relatives'     => 
array($t->mask)
                                                )
                                        );
-                                       $query = $GLOBALS['phpgw']->db->query 
("UPDATE phpgw_vfs SET size=$size WHERE directory='$t->fake_leading_dirs_clean' 
AND name='$t->fake_name_clean'" . $this->extra_sql (array ('query_type' => 
VFS_SQL_UPDATE)), __LINE__, __FILE__);
+                                       $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET size={$size}"
+                                       . " WHERE 
directory='{$t->fake_leading_dirs_clean}'"
+                                       . " AND name='{$t->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_UPDATE)), __LINE__, __FILE__);
                                }
-                               elseif (!$t->outside)
+                               elseif(!$t->outside)
                                {
-                                       $query = $GLOBALS['phpgw']->db->query 
("UPDATE phpgw_vfs SET name='$t->fake_name_clean', 
directory='$t->fake_leading_dirs_clean' WHERE 
directory='$f->fake_leading_dirs_clean' AND name='$f->fake_name_clean'" . 
$this->extra_sql (array ('query_type' => VFS_SQL_UPDATE)), __LINE__, __FILE__);
+                                       $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET 
name='{$t->fake_name_clean}', directory='{$t->fake_leading_dirs_clean}'"
+                                       . " WHERE 
directory='{$f->fake_leading_dirs_clean}'"
+                                       . " AND name='{$f->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_UPDATE)), __LINE__, __FILE__);
                                }
 
                                $this->set_attributes(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask),
-                                               'attributes'    => array (
+                                               'relatives'     => 
array($t->mask),
+                                               'attributes'    => array(
                                                                        
'modifiedby_id' => $account_id,
                                                                        
'modified' => $this->now
                                                                )
                                        )
                                );
 
-                               $this->correct_attributes (array(
+                               $this->correct_attributes(array(
                                                'string'        => 
$t->fake_full_path,
-                                               'relatives'     => array 
($t->mask)
+                                               'relatives'     => 
array($t->mask)
                                        )
                                );
 
-                               if ($this->file_actions)
+                               if($this->file_actions)
                                {
-                                       $rr = rename ($f->real_full_path, 
$t->real_full_path);
+                                       $rr = $this->fileoperation->rename($f, 
$t);
                                }
 
                                /*
                                   This removes the original entry from the 
database
-                                  The actual file is already deleted because 
of the rename () above
+                                  The actual file is already deleted because 
of the rename() above
                                */
-                               if ($t->outside)
+                               if($t->outside)
                                {
-                                       $this->rm (array(
+                                       $this->rm(array(
                                                        'string'        => 
$f->fake_full_path,
                                                        'relatives'     => 
$f->mask
                                                )
@@ -1797,265 +1789,270 @@
                        }
                        else
                        {
-                               return False;
+                               return false;
                        }
 
-                       if ($this->file_type (array(
+                       if($this->file_type(array(
                                        'string'        => $t->fake_full_path,
-                                       'relatives'     => array ($t->mask)
+                                       'relatives'     => array($t->mask)
                                )) == 'Directory'
                        )
                        {
                                /* We got $ls from above, before we renamed the 
directory */
-                               while (list ($num, $entry) = each ($ls))
+                               while(list($num, $entry) = each($ls))
                                {
-                                       $newdir = ereg_replace 
("^$f->fake_full_path", $t->fake_full_path, $entry['directory']);
-                                       $newdir_clean = $this->clean_string 
(array ('string' => $newdir));
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+                                       $newdir_clean = 
$this->clean_string(array('string' => $newdir));
 
-                                       $query = $GLOBALS['phpgw']->db->query 
("UPDATE phpgw_vfs SET directory='$newdir_clean' WHERE 
file_id='$entry[file_id]'" . $this->extra_sql (array ('query_type' => 
VFS_SQL_UPDATE)), __LINE__, __FILE__);
-                                       $this->correct_attributes (array(
-                                                       'string'        => 
"$newdir/$entry[name]",
-                                                       'relatives'     => 
array ($t->mask)
+                                       $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET directory='{$newdir_clean}'"
+                                       . " WHERE file_id='{$entry[file_id]}'" 
. $this->extra_sql(array('query_type' => VFS_SQL_UPDATE)), __LINE__, __FILE__);
+
+                                       $this->correct_attributes(array(
+                                                       'string'        => 
"{$newdir}/{$entry[name]}",
+                                                       'relatives'     => 
array($t->mask)
                                                )
                                        );
                                }
                        }
 
-                       $this->add_journal (array(
+                       $this->add_journal(array(
                                        'string'        => $t->fake_full_path,
-                                       'relatives'     => array ($t->mask),
+                                       'relatives'     => array($t->mask),
                                        'operation'     => VFS_OPERATION_MOVED,
                                        'state_one'     => $f->fake_full_path,
                                        'state_two'     => $t->fake_full_path
                                )
                        );
 
-                       return True;
+                       return true;
                }
 
                /*
                 * See vfs_shared
                 */
-               function rm ($data)
+               function rm($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
+                                       'relatives'     => array($p->mask),
                                        'operation'     => PHPGW_ACL_DELETE
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       if (!$this->file_exists (array(
+                       if(!$this->file_exists(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                ))
                        )
                        {
-                               if ($this->file_actions)
+                               if($this->file_actions)
                                {
-                                       $rr = unlink ($p->real_full_path);
+                                       $rr = $this->fileoperation->unlink($p);
                                }
                                else
                                {
-                                       $rr = True;
+                                       $rr = true;
                                }
 
-                               if ($rr)
+                               if($rr)
                                {
-                                       return True;
+                                       return true;
                                }
                                else
                                {
-                                       return False;
+                                       return false;
                                }
                        }
 
-                       if ($this->file_type (array(
+                       if($this->file_type(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )) != 'Directory'
                        )
                        {
-                               $this->add_journal (array(
+                               $this->add_journal(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                                               'relatives'     => 
array($p->mask),
                                                'operation'     => 
VFS_OPERATION_DELETED
                                        )
                                );
 
-                               $query = $GLOBALS['phpgw']->db->query ("DELETE 
FROM phpgw_vfs WHERE directory='".$p->fake_leading_dirs_clean."' AND 
name='".$p->fake_name_clean."'".$this->extra_sql (array ('query_type' => 
VFS_SQL_DELETE)), __LINE__, __FILE__);
+                               $query = $GLOBALS['phpgw']->db->query("DELETE 
FROM phpgw_vfs"
+                               . " WHERE 
directory='{$p->fake_leading_dirs_clean}'"
+                               . " AND name='{$p->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_DELETE)), __LINE__, __FILE__);
 
-                               if ($this->file_actions)
+                               if($this->file_actions)
                                {
-                                       $rr = unlink ($p->real_full_path);
+                                       $rr = $this->fileoperation->unlink($p);
                                }
                                else
                                {
-                                       $rr = True;
+                                       $rr = true;
                                }
 
-                               if ($query || $rr)
+                               if($query || $rr)
                                {
-                                       return True;
+                                       return true;
                                }
                                else
                                {
-                                       return False;
+                                       return false;
                                }
                        }
                        else
                        {
-                               $ls = $this->ls (array(
+                               $ls = $this->ls(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask)
+                                               'relatives'     => 
array($p->mask)
                                        )
                                );
 
                                /* First, we cycle through the entries and 
delete the files */
-                               while (list ($num, $entry) = each ($ls))
+                               while(list($num, $entry) = each($ls))
                                {
-                                       if ($entry['mime_type'] == 'Directory')
+                                       if($entry['mime_type'] == 'Directory')
                                        {
                                                continue;
                                        }
 
-                                       $this->rm (array(
-                                                       'string'        => 
"$entry[directory]/$entry[name]",
-                                                       'relatives'     => 
array ($p->mask)
+                                       $this->rm(array(
+                                                       'string'        => 
"{$entry['directory']}/{$entry['name']}",
+                                                       'relatives'     => 
array($p->mask)
                                                )
                                        );
                                }
 
                                /* Now we cycle through again and delete the 
directories */
-                               reset ($ls);
-                               while (list ($num, $entry) = each ($ls))
+                               reset($ls);
+                               while(list($num, $entry) = each($ls))
                                {
-                                       if ($entry['mime_type'] != 'Directory')
+                                       if($entry['mime_type'] != 'Directory')
                                        {
                                                continue;
                                        }
 
                                        /* Only the best in confusing recursion 
*/
-                                       $this->rm (array(
-                                                       'string'        => 
"$entry[directory]/$entry[name]",
-                                                       'relatives'     => 
array ($p->mask)
+                                       $this->rm(array(
+                                                       'string'        => 
"{$entry['directory']}/{$entry['name']}",
+                                                       'relatives'     => 
array($p->mask)
                                                )
                                        );
                                }
 
                                /* If the directory is linked, we delete the 
placeholder directory */
-                               $ls_array = $this->ls (array(
-                                               'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
-                                               'checksubdirs'  => False,
-                                               'mime_type'     => False,
-                                               'nofiles'       => True
+                               $ls_array = $this->ls(array(
+                                               'string'                => 
$p->fake_full_path,
+                                               'relatives'             => 
array($p->mask),
+                                               'checksubdirs'  => false,
+                                               'mime_type'             => 
false,
+                                               'nofiles'               => true
                                        )
                                );
                                $link_info = $ls_array[0];
 
-                               if ($link_info['link_directory'] && 
$link_info['link_name'])
+                               if($link_info['link_directory'] && 
$link_info['link_name'])
                                {
-                                       $path = $this->path_parts (array(
-                                                       'string'        => 
$link_info['directory'] . '/' . $link_info['name'],
-                                                       'relatives'     => 
array ($p->mask),
-                                                       'nolinks'       => True
+                                       $path = $this->path_parts(array(
+                                                       'string'        => 
"{$link_info['directory']}/{$link_info['name']}",
+                                                       'relatives'     => 
array($p->mask),
+                                                       'nolinks'       => true
                                                )
                                        );
 
-                                       if ($this->file_actions)
+                                       if($this->file_actions)
                                        {
-                                               rmdir ($path->real_full_path);
+                                               
$this->fileoperation->rmdir($path);
                                        }
                                }
 
                                /* Last, we delete the directory itself */
-                               $this->add_journal (array(
+                               $this->add_journal(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                                               'relatives'     => 
array($p->mask),
                                                'operaton'      => 
VFS_OPERATION_DELETED
                                        )
                                );
 
-                               $query = $GLOBALS['phpgw']->db->query ("DELETE 
FROM phpgw_vfs WHERE directory='$p->fake_leading_dirs_clean' AND 
name='$p->fake_name_clean'" . $this->extra_sql (array ('query_type' => 
VFS_SQL_DELETE)), __LINE__, __FILE__);
+                               $query = $GLOBALS['phpgw']->db->query("DELETE 
FROM phpgw_vfs"
+                               . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql(array('query_type' => VFS_SQL_DELETE)), __LINE__, __FILE__);
 
-                               if ($this->file_actions)
+                               if($this->file_actions)
                                {
-                                       rmdir ($p->real_full_path);
+                                       $this->fileoperation->rmdir($p);
                                }
 
-                               return True;
+                               return true;
                        }
                }
 
                /*
                 * See vfs_shared
                 */
-               function mkdir ($data)
+               function mkdir($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
+                                       'relatives'     => array($p->mask),
                                        'operation'     => PHPGW_ACL_ADD)
                                )
                        )
                        {
-                               return False;
+                               return false;
                        }
 
                        /* We don't allow /'s in dir names, of course */
-                       if (ereg ("/", $p->fake_name))
+                       if(preg_match('/\//', $p->fake_name))
                        {
-                               return False;
+                               return false;
                        }
 
-                       umask (000);
+                       umask(000);
 
-                       if ($this->file_actions)
+                       if($this->file_actions)
                        {
-                               if(!file_exists($p->real_leading_dirs))
+                               
if(!$this->fileoperation->check_target_directory($p))
                                {
                                        $GLOBALS['phpgw']->log->error(array(
                                                'text' => 'vfs::mkdir() : 
missing leading directory %1 when attempting to create %2',
@@ -2068,20 +2065,18 @@
                                        return false;
                                }
 
-                               //if block from patch #1989 - auto create home 
- from lpiepho
-                               if (!file_exists($this->basedir.'/home'))
-                               {
-                                       @mkdir ($this->basedir.'/home', 0770);
-                               }
+                               /* Auto create home */
 
-                               if (file_exists($p->real_full_path))
+                               
$this->fileoperation->auto_create_home($this->basedir);
+
+                               if($this->fileoperation->file_exists($p))
                                {
-                                       if (!is_dir($p->real_full_path))
+                                       if(!$this->fileoperation->is_dir($p))
                                        {
-                                               return False;
+                                               return false;
                                        }
                                }
-                               elseif (!mkdir ($p->real_full_path, 0770))
+                               else if(!$this->fileoperation->mkdir($p))
                                {
                                        $GLOBALS['phpgw']->log->error(array(
                                                'text' => 'vfs::mkdir() : 
failed to create directory %1',
@@ -2091,130 +2086,135 @@
                                                'file' => __FILE__
                                        ));
 
-                                       return False;
+                                       return false;
                                }
+
                        }
 
-                       if (!$this->file_exists (array(
+                       if(!$this->file_exists(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask)
+                                       'relatives'     => array($p->mask)
                                ))
                        )
                        {
-                               $query = $GLOBALS['phpgw']->db->query ('INSERT 
INTO phpgw_vfs (owner_id, name, directory) VALUES (' . $this->working_id . ", 
'" 
-                                                                               
                                . $p->fake_name_clean . "', '" . 
$p->fake_leading_dirs_clean . "')", __LINE__, __FILE__);
+                               $query = $GLOBALS['phpgw']->db->query("INSERT 
INTO phpgw_vfs(owner_id, name, directory)"
+                               . " VALUES({$this->working_id}, 
'{$p->fake_name_clean}', '{$p->fake_leading_dirs_clean}')", __LINE__, __FILE__);
                                $this->set_attributes(array(
-                                       'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
-                                       'attributes'    => array (
-                                                               'createdby_id' 
=> $account_id,
-                                                               'size' => 4096,
-                                                               'mime_type' => 
'Directory',
-                                                               'created' => 
$this->now,
-                                                               'deleteable' => 
'Y',
-                                                               'app' => 
$currentapp
+                                       'string'                => 
$p->fake_full_path,
+                                       'relatives'             => 
array($p->mask),
+                                       'attributes'    => array(
+                                                               'createdby_id'  
=> $account_id,
+                                                               'size'          
        => 4096,
+                                                               'mime_type'     
        => 'Directory',
+                                                               'created'       
        => $this->now,
+                                                               'deleteable'    
=> 'Y',
+                                                               'app'           
        => $currentapp
                                                        )
                                        )
                                );
 
-                               $this->correct_attributes (array(
+                               $this->correct_attributes(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask)
+                                               'relatives'     => 
array($p->mask)
                                        )
                                );
 
-                               $this->add_journal (array(
+                               $this->add_journal(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask),
+                                               'relatives'     => 
array($p->mask),
                                                'operation'     => 
VFS_OPERATION_CREATED
                                        )
                                );
                        }
                        else
                        {
-                               return False;
+                               return false;
                        }
 
-                       return True;
+                       return true;
                }
 
                /*
                 * See vfs_shared
                 */
-               function make_link ($data)
+               function make_link($data)
                {
-                       if (!is_array ($data))
+                       /* Does not seem to be used */
+                       return false;
+
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT, RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT, 
RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
                        $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
 
-                       $vp = $this->path_parts (array(
+                       $vp = $this->path_parts(array(
                                        'string'        => $data['vdir'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       $rp = $this->path_parts (array(
+                       $rp = $this->path_parts(array(
                                        'string'        => $data['rdir'],
-                                       'relatives'     => array 
($data['relatives'][1])
+                                       'relatives'     => 
array($data['relatives'][1])
                                )
                        );
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $vp->fake_full_path,
-                                       'relatives'     => array ($vp->mask),
+                                       'relatives'     => array($vp->mask),
                                        'operation'     => PHPGW_ACL_ADD
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       if ($this->file_exists (array(
+                       if($this->file_exists(array(
                                        'string'        => $rp->real_full_path,
-                                       'relatives'     => array ($rp->mask)
+                                       'relatives'     => array($rp->mask)
                                ))
                        )
                        {
-                               if (!is_dir ($rp->real_full_path))
+                               if(!$this->fileoperation->is_dir($rp))
                                {
-                                       return False;
+                                       return false;
                                }
                        }
-                       elseif (!mkdir ($rp->real_full_path, 0770))
+                       elseif(!$this->fileoperation->mkdir($rp))
                        {
-                               return False;
+                               return false;
                        }
 
-                       if (!$this->mkdir (array(
+                       if(!$this->mkdir(array(
                                        'string'        => $vp->fake_full_path,
-                                       'relatives'     => array ($vp->mask)
+                                       'relatives'     => array($vp->mask)
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       $size = $this->get_size (array(
+                       //FIXME real_full_path...
+                       $size = $this->get_size(array(
                                        'string'        => $rp->real_full_path,
-                                       'relatives'     => array ($rp->mask)
+                                       'relatives'     => array($rp->mask)
                                )
                        );
 
                        $this->set_attributes(array(
                                        'string'        => $vp->fake_full_path,
-                                       'relatives'     => array ($vp->mask),
-                                       'attributes'    => array (
+                                       'relatives'     => array($vp->mask),
+                                       'attributes'    => array(
                                                                
'link_directory' => $rp->real_leading_dirs,
                                                                'link_name' => 
$rp->real_name,
                                                                'size' => $size
@@ -2222,60 +2222,60 @@
                                )
                        );
 
-                       $this->correct_attributes (array(
+                       $this->correct_attributes(array(
                                        'string'        => $vp->fake_full_path,
-                                       'relatives'     => array ($vp->mask)
+                                       'relatives'     => array($vp->mask)
                                )
                        );
 
-                       return True;
+                       return true;
                }
 
                /*
                 * See vfs_shared
                 */
-               function set_attributes ($data)
+               function set_attributes($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
                                (
-                                       'relatives'     => array 
(RELATIVE_CURRENT),
-                                       'attributes'    => array ()
+                                       'relatives'     => 
array(RELATIVE_CURRENT),
+                                       'attributes'    => array()
                                );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
                        /*
-                          This is kind of trivial, given that set_attributes 
() can change owner_id,
+                          This is kind of trivial, given that set_attributes() 
can change owner_id,
                           size, etc.
                        */
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
+                                       'relatives'     => array($p->mask),
                                        'operation'     => PHPGW_ACL_EDIT
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       if (!$this->file_exists (array(
+                       if(!$this->file_exists(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
                        /*
@@ -2283,11 +2283,11 @@
                           depending on if the attribute was supplied in the 
'attributes' array
                        */
 
-                       $ls_array = $this->ls (array(
+                       $ls_array = $this->ls(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
-                                       'checksubdirs'  => False,
-                                       'nofiles'       => True
+                                       'relatives'     => array($p->mask),
+                                       'checksubdirs'  => false,
+                                       'nofiles'       => true
                                )
                        );
                        $record = $ls_array[0];
@@ -2295,14 +2295,14 @@
                        $sql = 'UPDATE phpgw_vfs SET ';
 
                        $change_attributes = 0;
-                       $edited_comment = False;
+                       $edited_comment = false;
 
-                       reset ($this->attributes);
+                       reset($this->attributes);
                        $value_set = array();
-//                     while (list ($num, $attribute) = each 
($this->attributes))
-                       foreach ($this->attributes as $num => $attribute)
+
+                       foreach($this->attributes as $num => $attribute)
                        {
-                               if (isset ($data['attributes'][$attribute]))
+                               if(isset($data['attributes'][$attribute]))
                                {
                                        $$attribute = 
$data['attributes'][$attribute];
 
@@ -2310,58 +2310,50 @@
                                           Indicate that the EDITED_COMMENT 
operation needs to be journaled,
                                           but only if the comment changed
                                        */
-                                       if ($attribute == 'comment' && 
$data['attributes'][$attribute] != $record[$attribute])
+                                       if($attribute == 'comment' && 
$data['attributes'][$attribute] != $record[$attribute])
                                        {
-                                               $edited_comment = True;
+                                               $edited_comment = true;
                                        }
 
-                                       if ($attribute == 'owner_id' && 
!$$attribute)
+                                       if($attribute == 'owner_id' && 
!$$attribute)
                                        {
                                                $$attribute = 
$GLOBALS['phpgw_info']['user']['account_id'];
                                        }
 
-                                       $$attribute = $this->clean_string 
(array ('string' => $$attribute));
+                                       $$attribute = 
$this->clean_string(array('string' => $$attribute));
 
-/*
-                                       if ($change_attributes > 0)
-                                       {
-                                               $sql .= ', ';
-                                       }
-
-                                       $sql .= "$attribute='" . $$attribute . 
"'";
-*/
                                        $value_set[$attribute] = $$attribute;
 
                                        $change_attributes++;
                                }
                        }
 
-                       if ( $change_attributes )
+                       if( $change_attributes )
                        {
                                $value_set      = 
$GLOBALS['phpgw']->db->validate_update($value_set);
-                               $sql .= " {$value_set} WHERE file_id=" . 
(int)$record['file_id'];
-                               $sql .= $this->extra_sql (array ('query_type' 
=> VFS_SQL_UPDATE));
+                               $sql .= " {$value_set} WHERE file_id=" 
.(int)$record['file_id'];
+                               $sql .= $this->extra_sql(array('query_type' => 
VFS_SQL_UPDATE));
 
                                //echo 'sql: ' . $sql;
 
-                               $query = $GLOBALS['phpgw']->db->query ($sql, 
__LINE__, __FILE__);
-                               if ($query) 
+                               $query = $GLOBALS['phpgw']->db->query($sql, 
__LINE__, __FILE__);
+                               if($query)
                                {
-                                       if ($edited_comment)
+                                       if($edited_comment)
                                        {
-                                               $this->add_journal (array(
+                                               $this->add_journal(array(
                                                                'string'        
=> $p->fake_full_path,
-                                                               'relatives'     
=> array ($p->mask),
+                                                               'relatives'     
=> array($p->mask),
                                                                'operation'     
=> VFS_OPERATION_EDITED_COMMENT
                                                        )
                                                );
                                        }
 
-                                       return True;
+                                       return true;
                                }
                                else
                                {
-                                       return False;
+                                       return false;
                                }
                        }
                        else
@@ -2370,49 +2362,52 @@
                                //This is a kind of bug isn't it ?
                                //So I let people choose to debug here :/
                                //FIXME : decide what we are doing here !
-                               return True;
+                               return true;
                        }
                }
 
                /*
                 * See vfs_shared
                 */
-               function file_type ($data)
+               function file_type($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if (!$this->acl_check (array(
+                       if(!$this->acl_check(array(
                                        'string'        => $p->fake_full_path,
-                                       'relatives'     => array ($p->mask),
+                                       'relatives'     => array($p->mask),
                                        'operation'     => PHPGW_ACL_READ,
-                                       'must_exist'    => True
+                                       'must_exist'    => true
                                ))
                        )
                        {
-                               return False;
+                               return false;
                        }
 
-                       if ($p->outside)
+                       /*
+                       * The file is outside the virtual root
+                       */
+                       if($p->outside)
                        {
-                               if (is_dir ($p->real_full_path))
+                               if(is_dir($p->real_full_path))
                                {
-                                       return ('Directory');
+                                       return('Directory');
                                }
 
                                /*
@@ -2422,18 +2417,24 @@
                        }
 
                        /*
-                          We don't use ls () because it calls file_type () to 
determine if it has been
+                          We don't use ls() because it calls file_type() to 
determine if it has been
                           passed a directory
                        */
                        $db2 = clone($GLOBALS['phpgw']->db);
-                       $db2->query ("SELECT mime_type FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                       $db2->query("SELECT mime_type FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}'"
+                       . " AND name='{$p->fake_name_clean}'"
+                       . $this->extra_sql(array('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
+
                        $db2->next_record();
                        $mime_type = $db2->f('mime_type');
+
                        if(!$mime_type)
                        {
-                               $mime_type = $this->get_ext_mime_type (array 
('string' => $data['string']));
+                               $mime_type = 
$this->get_ext_mime_type(array('string' => $data['string']));
                                {
-                                       $db2->query ("UPDATE phpgw_vfs SET 
mime_type='{$mime_type}' WHERE directory='{$p->fake_leading_dirs_clean}' AND 
name='{$p->fake_name_clean}'" . $this->extra_sql (array ('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
+                                       $db2->query("UPDATE phpgw_vfs SET 
mime_type='{$mime_type}'"
+                                       . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                       . $this->extra_sql(array('query_type' 
=> VFS_SQL_SELECT)), __LINE__, __FILE__);
                                }
                        }
 
@@ -2443,65 +2444,67 @@
                /*
                 * See vfs_shared
                 */
-               function file_exists ($data)
+               function file_exists($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if ($p->outside)
+                       if($p->outside)
                        {
-                               $rr = file_exists ($p->real_full_path);
+                               $rr = file_exists($p->real_full_path);
 
                                return $rr;
                        }
 
                        $db2 = clone($GLOBALS['phpgw']->db);
-                       $db2->query ("SELECT name FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                       $db2->query("SELECT name FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}'"
+                       . " AND name='{$p->fake_name_clean}'"
+                       . $this->extra_sql(array('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
 
-                       if ($db2->next_record ())
+                       if($db2->next_record())
                        {
-                               return True;
+                               return true;
                        }
                        else
                        {
-                               return False;
+                               return false;
                        }
                }
 
                /*
                 * See vfs_shared
                 */
-               function get_size ($data)
+               function get_size($data)
                {
                        $size = parent::get_size($data);
                        /*XXX Caeies : Not sure about this, but ... */
                        /* If the virtual size is always 4096, we don't need 
this ... */
-/*                     if ($data['checksubdirs'])
+/*                     if($data['checksubdirs'])
                        {
-                               $query = $GLOBALS['phpgw']->db->query ("SELECT 
size FROM phpgw_vfs WHERE directory='".$p->fake_leading_dirs_clean."' AND 
name='".$p->fake_name_clean."'" . $this->extra_sql (array ('query_text' => 
VFS_SQL_SELECT)));
-                               $GLOBALS['phpgw']->db->next_record ();
+                               $query = $GLOBALS['phpgw']->db->query("SELECT 
size FROM phpgw_vfs WHERE directory='".$p->fake_leading_dirs_clean."' AND 
name='".$p->fake_name_clean."'" . $this->extra_sql(array('query_text' => 
VFS_SQL_SELECT)));
+                               $GLOBALS['phpgw']->db->next_record();
                                $size += $GLOBALS['phpgw']->db->Record[0];
                        }
 */
                        return $size;
                }
 
-               /* temporary wrapper function for not working Record function 
in adodb layer (ceb)*/
+               /* temporary wrapper function for not working Record function 
in adodb layer(ceb)*/
                function Record()
                {
                        $values = array();
@@ -2515,43 +2518,43 @@
                /*
                 * See vfs_shared
                 */
-               function ls ($data)
+               function ls($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
                        (
-                               'relatives'     => array (RELATIVE_CURRENT),
-                               'checksubdirs'  => True,
-                               'mime_type'     => False,
-                               'nofiles'       => False,
+                               'relatives'     => array(RELATIVE_CURRENT),
+                               'checksubdirs'  => true,
+                               'mime_type'     => false,
+                               'nofiles'       => false,
                                'orderby'       => 'directory'
                        );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
                        //_debug_array($data);
 
                        $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
                        //_debug_array($p);
 
-                       $ftype = $this->file_type( array('string' => 
$p->fake_full_path, 'relatives' => array ($p->mask) ) );
+                       $ftype = $this->file_type( array('string' => 
$p->fake_full_path, 'relatives' => array($p->mask) ) );
                        /* If they pass us a file or 'nofiles' is set, return 
the info for $dir only */
-                       if ( ($ftype != 'Directory' || $data['nofiles'] ) && 
!$p->outside)
+                       if(($ftype != 'Directory' || $data['nofiles'] ) && 
!$p->outside)
                        {
                                /* SELECT all, the, attributes */
                                $sql = 'SELECT ' . implode(', ', 
$this->attributes)
-                                               . " FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}' " 
-                                               . $this->extra_sql (array 
('query_type' => VFS_SQL_SELECT));
+                                               . " FROM phpgw_vfs WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}' "
+                                               . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT));
 
-                               $query = $GLOBALS['phpgw']->db->query ($sql, 
__LINE__, __FILE__);
+                               $query = $GLOBALS['phpgw']->db->query($sql, 
__LINE__, __FILE__);
                                if($GLOBALS['phpgw']->db->num_rows() == 0)
                                {
                                        return array();
@@ -2561,21 +2564,23 @@
                                //echo 'record: ' . _debug_array($record);
 
                                /* We return an array of one array to maintain 
the standard */
-                               $rarray = array ();
-                               reset ($this->attributes);
-                               while (list ($num, $attribute) = each 
($this->attributes))
+                               $rarray = array();
+                               reset($this->attributes);
+                                               $db2 = 
clone($GLOBALS['phpgw']->db);
+                               while(list($num, $attribute) = 
each($this->attributes))
                                {
-                                       if ($attribute == 'mime_type' && 
!$record[$attribute])
+                                       if($attribute == 'mime_type' && 
!$record[$attribute])
                                        {
-                                               $db2 = 
clone($GLOBALS['phpgw']->db);
-                                               $record[$attribute] = 
$this->get_ext_mime_type (array(
+                                               $record[$attribute] = 
$this->get_ext_mime_type(array(
                                                                'string' => 
$p->fake_name_clean
                                                        )
                                                );
 
                                                if($record[$attribute])
                                                {
-                                                       $db2->query ("UPDATE 
phpgw_vfs SET mime_type='{$record[$attribute]}' WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+                                                       $db2->query("UPDATE 
phpgw_vfs SET mime_type='{$record[$attribute]}'"
+                                                       . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                                       . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
                                                }
                                        }
 
@@ -2585,36 +2590,36 @@
                                return $rarray;
                        }
 
-                       //WIP - this should recurse using the same options the 
virtual part of ls () does
+                       //WIP - this should recurse using the same options the 
virtual part of ls() does
                        /* If $dir is outside the virutal root, we have to 
check the file system manually */
-                       if ($p->outside)
+                       if($p->outside)
                        {
-                               if ($this->file_type (array(
+                               if($this->file_type(array(
                                                'string'        => 
$p->fake_full_path,
-                                               'relatives'     => array 
($p->mask)
+                                               'relatives'     => 
array($p->mask)
                                        )) == 'Directory'
                                        && !$data['nofiles']
                                )
                                {
-                                       $dir_handle = opendir 
($p->real_full_path);
-                                       while ($filename = readdir 
($dir_handle))
+                                       $dir_handle = 
opendir($p->real_full_path);
+                                       while($filename = readdir($dir_handle))
                                        {
-                                               if ($filename == '.' || 
$filename == '..')
+                                               if($filename == '.' || 
$filename == '..')
                                                {
                                                        continue;
                                                }
-                                               $rarray[] = 
$this->get_real_info (array(
+                                               $rarray[] = 
$this->get_real_info(array(
                                                                'string'        
=> "{$p->real_full_path}/{$filename}",
-                                                               'relatives'     
=> array ($p->mask)
+                                                               'relatives'     
=> array($p->mask)
                                                        )
                                                );
                                        }
                                }
                                else
                                {
-                                       $rarray[] = $this->get_real_info (array(
+                                       $rarray[] = $this->get_real_info(array(
                                                        'string'        => 
$p->real_full_path,
-                                                       'relatives'     => 
array ($p->mask)
+                                                       'relatives'     => 
array($p->mask)
                                                )
                                        );
                                }
@@ -2626,46 +2631,50 @@
                        /* SELECT all, the, attributes FROM phpgw_vfs WHERE 
file=$dir */
                        $sql = 'SELECT ' . implode(',', $this->attributes);
 
-                       $dir_clean = $this->clean_string (array ('string' => 
$p->fake_full_path));
-                       $sql .= " FROM phpgw_vfs WHERE directory LIKE 
'$dir_clean%'";
-                       $sql .= $this->extra_sql (array ('query_type' => 
VFS_SQL_SELECT));
+                       $dir_clean = $this->clean_string(array('string' => 
$p->fake_full_path));
+                       $sql .= " FROM phpgw_vfs WHERE directory LIKE 
'{$dir_clean}%'";
+                       $sql .= $this->extra_sql(array('query_type' => 
VFS_SQL_SELECT));
 
-                       if ($data['mime_type'])
+                       if($data['mime_type'])
                        {
-                               $sql .= " AND 
mime_type='".$data['mime_type']."'";
+                               $sql .= " AND mime_type='{$data['mime_type']}'";
                        }
 
-                       $sql .= ' ORDER BY '.$data['orderby'];
+                       $sql .= " ORDER BY {$data['orderby']}";
 
-                       $query = $GLOBALS['phpgw']->db->query ($sql, __LINE__, 
__FILE__);
+                       $query = $GLOBALS['phpgw']->db->query($sql, __LINE__, 
__FILE__);
 
-                       $rarray = array ();
-                       while ( $GLOBALS['phpgw']->db->next_record() )
+                       $rarray = array();
+                       while( $GLOBALS['phpgw']->db->next_record() )
                        {
                                $record = $this->Record();
 
                                //_debug_array($record);
                                /* Further checking on the directory.  This 
makes sure /home/user/test won't match /home/user/test22 */
-                               if (address@hidden 
("^{$p->fake_full_path}(/|$)", $record['directory']))
+                       //      if(address@hidden("^{$p->fake_full_path}(/|$)", 
$record['directory']))
+                               if(!preg_match("/^" . str_replace('/', '\/', 
$p->fake_full_path). "(\/|$)/", $record['directory']))
                                {
                                        continue;
                                }
 
                                /* If they want only this directory, then $dir 
should end without a trailing / */
-                               if (!$data['checksubdirs'] && ereg 
("^{$p->fake_full_path}/", $record['directory']))
+//                             if(!$data['checksubdirs'] && 
preg_match("/^{$p->fake_full_path}\//", $record['directory']))
+                               if(!$data['checksubdirs'] && preg_match("/^" . 
str_replace('/', '\/', $p->fake_full_path). "\//", $record['directory']))
                                {
                                        continue;
                                }
 
                                $db2 = clone($GLOBALS['phpgw']->db);
-                               if ( isset($this->attributes['mime_type']) && 
!isset($record['mime_type']) )
+                               if( isset($this->attributes['mime_type']) && 
!isset($record['mime_type']) )
                                {
                                        $record['mime_type'] == 
$this->get_ext_mime_type(array('string' => $p->fake_name_clean));
 
-                                       if ( $record['mime_type'] )
+                                       if( $record['mime_type'] )
                                        {
-                                               $db2->query ("UPDATE phpgw_vfs 
SET mime_type='{$record[$attribute]}' WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" . 
$this->extra_sql(array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
-                                               
+                                               $db2->query("UPDATE phpgw_vfs 
SET mime_type='{$record[$attribute]}'"
+                                               . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                               . 
$this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
+
                                        }
                                }
                                $rarray[] = $record;
@@ -2676,97 +2685,97 @@
                /*
                 * See vfs_shared
                 */
-               function update_real ($data)
+               function update_real($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if (file_exists ($p->real_full_path))
+                       if(file_exists($p->real_full_path))
                        {
-                               if (is_dir ($p->real_full_path))
+                               if(is_dir($p->real_full_path))
                                {
-                                       $dir_handle = opendir 
($p->real_full_path);
-                                       while ($filename = readdir 
($dir_handle))
+                                       $dir_handle = 
opendir($p->real_full_path);
+                                       while($filename = readdir($dir_handle))
                                        {
-                                               if ($filename == '.' || 
$filename == '..')
+                                               if($filename == '.' || 
$filename == '..')
                                                {
                                                        continue;
                                                }
 
-                                               $rarray[] = 
$this->get_real_info (array(
+                                               $rarray[] = 
$this->get_real_info(array(
                                                                'string'        
=> $p->fake_full_path . '/' . $filename,
-                                                               'relatives'     
=> array (RELATIVE_NONE)
+                                                               'relatives'     
=> array(RELATIVE_NONE)
                                                        )
                                                );
                                        }
                                }
                                else
                                {
-                                       $rarray[] = $this->get_real_info (array(
+                                       $rarray[] = $this->get_real_info(array(
                                                        'string'        => 
$p->fake_full_path,
-                                                       'relatives'     => 
array (RELATIVE_NONE)
+                                                       'relatives'     => 
array(RELATIVE_NONE)
                                                )
                                        );
                                }
 
-                               if (!is_array ($rarray))
+                               if(!is_array($rarray))
                                {
-                                       $rarray = array ();
+                                       $rarray = array();
                                }
 
-                               while (list ($num, $file_array) = each 
($rarray))
+                               while(list($num, $file_array) = each($rarray))
                                {
-                                       $p2 = $this->path_parts (array(
+                                       $p2 = $this->path_parts(array(
                                                        'string'        => 
$file_array['directory'] . '/' . $file_array['name'],
-                                                       'relatives'     => 
array (RELATIVE_NONE)
+                                                       'relatives'     => 
array(RELATIVE_NONE)
                                                )
                                        );
 
                                        /* Note the mime_type.  This can be 
"Directory", which is how we create directories */
-                                       $set_attributes_array = Array(
+                                       $set_attributes_array = array(
                                                'size' => $file_array['size'],
                                                'mime_type' => 
$file_array['mime_type']
                                        );
 
-                                       if (!$this->file_exists (array(
+                                       if(!$this->file_exists(array(
                                                        'string'        => 
$p2->fake_full_path,
-                                                       'relatives'     => 
array (RELATIVE_NONE)
+                                                       'relatives'     => 
array(RELATIVE_NONE)
                                                ))
                                        )
                                        {
-                                               $this->touch (array(
+                                               $this->touch(array(
                                                                'string'        
=> $p2->fake_full_path,
-                                                               'relatives'     
=> array (RELATIVE_NONE)
+                                                               'relatives'     
=> array(RELATIVE_NONE)
                                                        )
                                                );
 
-                                               $this->set_attributes (array(
+                                               $this->set_attributes(array(
                                                                'string'        
=> $p2->fake_full_path,
-                                                               'relatives'     
=> array (RELATIVE_NONE),
+                                                               'relatives'     
=> array(RELATIVE_NONE),
                                                                'attributes'    
=> $set_attributes_array
                                                        )
                                                );
                                        }
                                        else
                                        {
-                                               $this->set_attributes (array(
+                                               $this->set_attributes(array(
                                                                'string'        
=> $p2->fake_full_path,
-                                                               'relatives'     
=> array (RELATIVE_NONE),
+                                                               'relatives'     
=> array(RELATIVE_NONE),
                                                                'attributes'    
=> $set_attributes_array
                                                        )
                                                );
@@ -2777,45 +2786,47 @@
 
                /* Helper functions */
 
-               /* This fetchs all available file system information for string 
(not using the database) */
-               function get_real_info ($data)
+               /* This fetchs all available file system information for 
string(not using the database) */
+               function get_real_info($data)
                {
-                       if (!is_array ($data))
+                       if(!is_array($data))
                        {
-                               $data = array ();
+                               $data = array();
                        }
 
                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT)
-                               );
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
 
-                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
 
-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
-                                       'relatives'     => array 
($data['relatives'][0])
+                                       'relatives'     => 
array($data['relatives'][0])
                                )
                        );
 
-                       if (is_dir ($p->real_full_path))
+                       if(is_dir($p->real_full_path))
                        {
                                $mime_type = 'Directory';
                        }
                        else
                        {
-                               $mime_type = $this->get_ext_mime_type (array(
+                               $mime_type = $this->get_ext_mime_type(array(
                                                'string'        => $p->fake_name
                                        )
                                );
 
                                if($mime_type)
                                {
-                                       $GLOBALS['phpgw']->db->query ("UPDATE 
phpgw_vfs SET mime_type='".$mime_type."' WHERE 
directory='".$p->fake_leading_dirs_clean."' AND name='".$p->fake_name_clean."'" 
. $this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, 
__FILE__);
+                                       $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_vfs SET mime_type='{$mime_type}'"
+                                       . " WHERE 
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'"
+                                       . $this->extra_sql(array('query_type' 
=> VFS_SQL_SELECT)), __LINE__, __FILE__);
                                }
                        }
 
-                       $size = filesize ($p->real_full_path);
+                       $size = filesize($p->real_full_path);
                        $rarray = array(
                                'directory' => $p->fake_leading_dirs,
                                'name' => $p->fake_name,
@@ -2823,6 +2834,6 @@
                                'mime_type' => $mime_type
                        );
 
-                       return ($rarray);
+                       return($rarray);
                }
        }

Modified: branches/Version-1_0-branch/property/inc/class.boproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boproject.inc.php    
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/property/inc/class.boproject.inc.php    
2014-01-26 16:46:43 UTC (rev 11631)
@@ -885,9 +885,9 @@
                        $this->so->delete($project_id);
                }
 
-               function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget,$new_budget)
+               function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget,$new_budget,$b_account_id)
                {
-                       return $this->so->bulk_update_status($start_date, 
$end_date, $status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget,$new_budget);
+                       return $this->so->bulk_update_status($start_date, 
$end_date, $status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget,$new_budget,$b_account_id);
                }
 
                public function get_user_list($selected = 0)

Modified: branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2014-01-26 16:46:43 UTC (rev 11631)
@@ -714,7 +714,7 @@
                                        if($budget['year'] == $year)
                                        {
 
-                                               if($budget['period'] != 
"{$year}00" && $filter_period && ((int)$filter_period+1) > $budget['period'])
+                                               if($budget['period'] != 
"{$year}00" && $filter_period && ((int)$filter_period) < (int)$budget['period'])
                                                {
                                                        continue;
                                                }

Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2014-01-26 16:46:43 UTC (rev 11631)
@@ -717,11 +717,11 @@
                        $start_periode = date('Ym',$start_date);
                        $end_periode = date('Ym',$end_date);
 
-                       $sql = "SELECT district_id,periode,sum(godkjentbelop) 
as consume $select_account_class "
-                               . " FROM  fm_ecobilagoverf $this->join 
fm_location1 ON (fm_ecobilagoverf.loc1 = fm_location1.loc1) "
-                               . " $this->join fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id) "
-                               . " $this->join fm_b_account ON 
(fm_ecobilagoverf.spbudact_code = fm_b_account.id) "
-                               . " WHERE (periode >='$start_periode' AND 
periode <= '$end_periode' $filtermethod )"
+                       $sql = "SELECT district_id,periode,sum(godkjentbelop) 
as consume {$select_account_class}"
+                               . " FROM  fm_ecobilagoverf {$this->join} 
fm_location1 ON (fm_ecobilagoverf.loc1 = fm_location1.loc1) "
+                               . " {$this->join} fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id) "
+                               . " {$this->join} fm_b_account ON 
(fm_ecobilagoverf.spbudact_code = fm_b_account.id) "
+                               . " WHERE (periode >='{$start_periode}' AND 
periode <= '{$end_periode}' {$filtermethod})"
                                . " GROUP BY district_id,periode 
$group_account_class"
                                . " ORDER BY periode";
                        //echo $sql;
@@ -734,14 +734,40 @@
                        while ($this->db->next_record())
                        {
                                $consume[] = array
-                                       (
-                                               'consume'               => 
round($this->db->f('consume')),
-                                               'period'                => 
$this->db->f('periode'),
-                                               'district_id'   => 
$this->db->f('district_id'),
-                                               'account_class' => 
$b_account_class ? $b_account_class : $this->db->f('b_account_class')
-                                       );
+                               (
+                                       'consume'               => 
round($this->db->f('consume')),
+                                       'period'                => 
$this->db->f('periode'),
+                                       'district_id'   => 
$this->db->f('district_id'),
+                                       'account_class' => $b_account_class ? 
$b_account_class : $this->db->f('b_account_class'),
+                                       'paid'                  => 'x'
+                               );
                        }
 
+                       $filtermethod = ltrim($filtermethod, ' AND ');
+
+                       $sql = "SELECT district_id,periode,sum(godkjentbelop) 
as consume {$select_account_class}"
+                               . " FROM  fm_ecobilag {$this->join} 
fm_location1 ON (fm_ecobilag.loc1 = fm_location1.loc1) "
+                               . " {$this->join} fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id) "
+                               . " {$this->join} fm_b_account ON 
(fm_ecobilag.spbudact_code = fm_b_account.id) "
+                               . " WHERE ({$filtermethod})"
+                               . " GROUP BY district_id,periode 
$group_account_class"
+                               . " ORDER BY periode";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records += $this->db->num_rows();
+
+                       while ($this->db->next_record())
+                       {
+                               $consume[] = array
+                               (
+                                       'consume'               => 
round($this->db->f('consume')),
+                                       'period'                => 
$this->db->f('periode'),
+                                       'district_id'   => 
$this->db->f('district_id'),
+                                       'account_class' => $b_account_class ? 
$b_account_class : $this->db->f('b_account_class'),
+                                       'paid'                  => ''
+                               );
+                       }
+
                        return $consume;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2014-01-26 16:46:43 UTC (rev 11631)
@@ -2236,7 +2236,7 @@
                                }
 
                                $entry['deviation_acc'] = abs($deviation) > 0 ? 
$deviation_acc : 0;
-                               
+
                                $entry['deviation_percent_period'] = $corretion 
* $deviation/$entry['budget'] * 100;
                                $entry['deviation_percent_acc'] = $corretion * 
$entry['deviation_acc']/$total_sum * 100;
                                $entry['closed'] = 
$closed_period[$entry['period']];
@@ -2263,7 +2263,7 @@
                        $project_id = (int) $project_id;
                        $closed_orig_b_period = 
isset($data['closed_orig_b_period']) && $data['closed_orig_b_period'] ? 
$data['closed_orig_b_period'] : array();
                        $closed_b_period = isset($data['closed_b_period']) && 
$data['closed_b_period'] ? $data['closed_b_period'] : array();
-                       
+
                        $close_period = array();
                        $open_period = array();
 
@@ -2412,7 +2412,7 @@
 
                                        if($request_project_hookup_status)
                                        {
-                                               $this->db->query("UPDATE 
fm_request SET status='{$request_project_hookup_status}' WHERE id='". 
$add_request['request_id'][$i] . "'",__LINE__,__FILE__);                        
         
+                                               $this->db->query("UPDATE 
fm_request SET status='{$request_project_hookup_status}' WHERE id='". 
$add_request['request_id'][$i] . "'",__LINE__,__FILE__);
                                        }
 
                                        $receipt['message'][] = 
array('msg'=>lang('request %1 has been added',$add_request['request_id'][$i]));
@@ -2551,7 +2551,7 @@
                }
 
 
-               public function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, $user_id = 0,$ids,$paid = false, 
$closed_orders = false, $ecodimb = 0, $transfer_budget_year=0,$new_budget = 
array())
+               public function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, $user_id = 0,$ids,$paid = false, 
$closed_orders = false, $ecodimb = 0, $transfer_budget_year=0,$new_budget = 
array(),$b_account_id = 0)
                {
                        if($transfer_budget_year && $execute && $new_budget)
                        {
@@ -2660,6 +2660,11 @@
                                        $sql_budget = "SELECT DISTINCT year, 
month, active, sum(combined_cost) as amount FROM fm_workorder_budget WHERE ";
                                        $sql_budget .= 'order_id = %d GROUP BY 
year, month, active ORDER BY year';
 
+                                       if($b_account_id)
+                                       {
+                                               $filter .=  " AND 
fm_workorder.account_id = '{$b_account_id}'";
+                                       }
+
                                        $table = 'fm_workorder';
                                        $status_table = 'fm_workorder_status';
                                        $title_field = 'fm_workorder.title';
@@ -2680,11 +2685,11 @@
                                                $end_period = (date('Y')-1) . 
13;
                                                $join_method .=  " 
{$this->left_join} fm_ecobilagoverf ON ( fm_workorder.id = 
fm_ecobilagoverf.pmwrkord_code AND fm_ecobilagoverf.periode > $start_period AND 
fm_ecobilagoverf.periode < $end_period)";
                                                $actual_cost = 
',sum(fm_ecobilagoverf.godkjentbelop) AS actual_cost';
-                                               $group_method = "GROUP BY 
fm_workorder.id,fm_workorder_status.closed,fm_workorder_status.descr,fm_project.project_type_id";
+                                               $group_method = "GROUP BY 
fm_workorder.id, fm_workorder.account_id, 
fm_workorder_status.closed,fm_workorder_status.descr,fm_project.project_type_id";
                                        }
 
                                        
$this->_update_status_workorder($execute, $status_new, $ids);
-                                       $sql = "SELECT {$table}.id, 
{$table}.project_id,{$status_table}.closed, {$status_table}.descr as status 
,{$title_field},{$table}.start_date {$actual_cost},"
+                                       $sql = "SELECT {$table}.id, 
{$table}.project_id,{$status_table}.closed, {$table}.account_id, 
{$status_table}.descr as status ,{$title_field},{$table}.start_date 
{$actual_cost},"
                                        . " project_type_id, continuous"
                                        . " FROM {$table} {$join_method}"
                                        . " WHERE ({$table}.start_date > 
{$start_date} AND {$table}.start_date < {$end_date} {$filter}) OR 
{$table}.start_date is NULL"
@@ -2720,6 +2725,7 @@
                                        'project_type_id'       => 
$this->db->f('project_type_id'),
                                        'continuous'            => 
$this->db->f('continuous') ? X : '',
                                        'project_type'          => 
$project_types[$this->db->f('project_type_id')],
+                                       'b_account_id'          => 
$this->db->f('account_id')// only applies to workorders
                                );
                        }
 

Modified: branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uibudget.inc.php     
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/property/inc/class.uibudget.inc.php     
2014-01-26 16:46:43 UTC (rev 11631)
@@ -1070,10 +1070,16 @@
                                $default_value = array 
('id'=>'','name'=>lang('no district'));
                                array_unshift 
($values_combo_box[2],$default_value);
 
+//_debug_array($values_combo_box[2]);
+
+                               $values_combo_box[3] =  
$this->bo->get_b_group_list($this->grouping);
+                               $default_value = array 
('id'=>'','name'=>lang('no grouping'));
+                               array_unshift 
($values_combo_box[3],$default_value);
+
                                $cat_filter =  
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data));
                                foreach($cat_filter['cat_list'] as $_cat)
                                {
-                                       $values_combo_box[3][] = array
+                                       $values_combo_box[4][] = array
                                        (
                                                'id' => $_cat['cat_id'],
                                                'name' => $_cat['name'],
@@ -1081,14 +1087,9 @@
                                        );
                                }
 
-                               array_unshift ($values_combo_box[3],array 
('id'=>'', 'name'=>lang('no category')));
+                               array_unshift ($values_combo_box[4],array 
('id'=>'', 'name'=>lang('no category')));
 
-//_debug_array($values_combo_box[2]);
 
-                               $values_combo_box[4] =  
$this->bo->get_b_group_list($this->grouping);
-                               $default_value = array 
('id'=>'','name'=>lang('no grouping'));
-                               array_unshift 
($values_combo_box[4],$default_value);
-
                                $values_combo_box[5]  = 
$this->bocommon->select_category_list(array('type'=>'department'));
                                array_unshift ($values_combo_box[5], array 
('id'=>'','name'=>lang('department')));
 
@@ -1158,15 +1159,6 @@
                                                                        'style' 
        => 'filter',
                                                                        
'tab_index' => 3
                                                                ),
-/*                                                             array
-                                                               ( //boton       
CATEGORY
-                                                                       'id'    
        => 'btn_cat_id',
-                                                                       'name'  
        => 'cat_id',
-                                                                       'value' 
        => lang('Category'),
-                                                                       'type'  
        => 'button',
-                                                                       'style' 
        => 'filter',
-                                                                       
'tab_index' => 3
-                                                               ),*/
                                                                array
                                                                ( //boton       
GROUPING
                                                                        'id'    
        => 'btn_grouping',
@@ -1177,34 +1169,18 @@
                                                                        
'tab_index' => 4
                                                                ),
                                                                array
-                                                               ( //boton       
USER
-                                                                       //      
'id' => 'btn_user_id',
+                                                               (
                                                                        'id' => 
'sel_cat_id',
                                                                        'name' 
=> 'cat_id',
                                                                        'value' 
=> lang('Category'),
                                                                        'type' 
=> 'select',
                                                                        'style' 
=> 'filter',
-                                                                       
'values' => $values_combo_box[2],
+                                                                       
'values' => $values_combo_box[4],
                                                                        
'onchange'=> 'onChangeSelect("cat_id");',
                                                                        
'tab_index' => 5
                                                                ),
-/*
                                                                array
-                                                               ( //boton       
USER
-                                                                       //      
'id' => 'btn_user_id',
-                                                                       'id' => 
'sel_grouping',
-                                                                       'name' 
=> 'grouping',
-                                                                       'value' 
=> lang('grouping'),
-                                                                       'type' 
=> 'select',
-                                                                       'style' 
=> 'filter',
-                                                                       
'values' => $values_combo_box[3],
-                                                                       
'onchange'=> 'onChangeSelect("grouping");',
-                                                                       
'tab_index' => 4
-                                                               ),
-*/
-                                                               array
-                                                               ( //boton       
USER
-                                                                       //      
'id' => 'btn_user_id',
+                                                               ( 
                                                                        'id' => 
'sel_department',
                                                                        'name' 
=> 'department',
                                                                        'value' 
=> lang('department'),
@@ -1215,8 +1191,7 @@
                                                                        
'tab_index' => 6
                                                                ),
                                                                array
-                                                               ( //boton       
USER
-                                                                       //      
'id' => 'btn_user_id',
+                                                               ( 
                                                                        'id' => 
'sel_dimb_id',
                                                                        'name' 
=> 'dimb_id',
                                                                        'value' 
=> lang('dimb'),
@@ -1227,8 +1202,7 @@
                                                                        
'tab_index' => 7
                                                                ),
                                                                array
-                                                               ( //boton       
USER
-                                                                       //      
'id' => 'btn_user_id',
+                                                               (
                                                                        'id' => 
'sel_direction',
                                                                        'name' 
=> 'direction',
                                                                        'value' 
=> lang('direction'),
@@ -1289,6 +1263,7 @@
                                                )
                                        )
                                );
+
                                $dry_run = true;
                        }
 

Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2014-01-26 16:46:43 UTC (rev 11631)
@@ -2547,6 +2547,10 @@
                        $loc1                   = phpgw::get_var('loc1');
                        $district_id    = phpgw::get_var('district_id', 'int');
                        $b_account_class= phpgw::get_var('b_account_class', 
'int');
+                       $b_account= phpgw::get_var('b_account', 'int');
+
+                       $b_account_class = $b_account_class ? $b_account_class 
: substr($b_account,0,2);
+
                        $ecodimb                = phpgw::get_var('ecodimb');
 
                        //-- ubica focus del menu derecho
@@ -2909,13 +2913,13 @@
 
                        $uicols = array
                                (
-                                       'input_type'    =>      
array('varchar','varchar','varchar','link'),
-                                       'type'                  =>      
array('text'     ,'text'         ,'text'         ,'url' ),
-                                       'col_name'              =>      
array('district_id','period','account_class','consume'),
-                                       'name'                  =>      
array('district_id','period','account_class','consume'),
-                                       'formatter'             =>      
array('','','',''),
-                                       'descr'                 =>      
array(lang('District'),lang('Period'),lang('Budget account'),lang('Consume')),
-                                       'className'             =>      
array('centerClasss','centerClasss','centerClasss','rightClasss')
+                                       'input_type'    =>      
array('varchar','varchar','varchar','link', 'varchar'),
+                                       'type'                  =>      
array('text'     ,'text'         ,'text'         ,'url', 'text' ),
+                                       'col_name'              =>      
array('district_id','period','account_class','consume', 'paid'),
+                                       'name'                  =>      
array('district_id','period','account_class','consume', 'paid'),
+                                       'formatter'             =>      
array('','','','',''),
+                                       'descr'                 =>      
array(lang('District'),lang('Period'),lang('Budget 
account'),lang('Consume'),lang('paid')),
+                                       'className'             =>      
array('centerClasss','centerClasss','centerClasss','rightClasss','centerClasss')
                                );
 
                        $j=0;

Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2014-01-26 16:17:29 UTC (rev 11630)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2014-01-26 16:46:43 UTC (rev 11631)
@@ -2545,6 +2545,8 @@
                        $closed_orders  = phpgw::get_var('closed_orders', 
'bool', 'POST');
                        $transfer_budget= phpgw::get_var('transfer_budget', 
'integer');
                        $__new_budget   = phpgw::get_var('new_budget');
+                       $b_account_id   = phpgw::get_var('b_account_id', 
'integer');
+                       $b_account_name = phpgw::get_var('b_account_name');
 
                        $_new_budget = explode(',', trim($__new_budget, ','));
 
@@ -2587,7 +2589,7 @@
 
                        if(($execute || $get_list) && $type)
                        {
-                               $list = 
$this->bo->bulk_update_status($start_date, $end_date, $status_filter, 
$status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget,$new_budget);
+                               $list = 
$this->bo->bulk_update_status($start_date, $end_date, $status_filter, 
$status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget,$new_budget,$b_account_id);
                        }
 
                        foreach ($list as &$entry)
@@ -2673,6 +2675,8 @@

@@ Diff output truncated at 153600 characters. @@



reply via email to

[Prev in Thread] Current Thread [Next in Thread]