\plugins\ajxp.fs\class.fsDriver.php

1. Files compared

# Location File Last Modified
1 R:\AjaXplorer-2.3.9\plugins\ajxp.fs class.fsDriver.php Wed Dec 17 12:57:40 2008 UTC
2 Z:\web\ajaxplorer\plugins\ajxp.fs class.fsDriver.php Thu Jan 29 12:50:41 2009 UTC

2. Comparison detail

1   <?php   1   <?php
2     2  
3   class fsDr iver exten ds Abstrac tDriver    3   class fsDr iver exten ds Abstrac tDriver 
4   {   4   {
5           /* *   5           /* *
6           *  @var Repos itory   6           *  @var Repos itory
7           */   7           */
8           va r $reposit ory;   8           va r $reposit ory;
9              9           
10           fu nction  fs Driver($dr iverName,  $filePath,  $reposito ry){   10           fu nction  fs Driver($dr iverName,  $filePath,  $reposito ry){
11                    pare nt::Abstra ctDriver($ driverName , $filePat h, $reposi tory);   11                    pare nt::Abstra ctDriver($ driverName , $filePat h, $reposi tory);
12           }   12           }
13              13           
14           fu nction ini tRepositor y(){   14           fu nction ini tRepositor y(){
15                    $cre ate = $thi s->reposit ory->getOp tion("CREA TE");   15                    $cre ate = $thi s->reposit ory->getOp tion("CREA TE");
16                    $pat h = $this- >repositor y->getOpti on("PATH") ;   16                    $pat h = $this- >repositor y->getOpti on("PATH") ;
17                    $rec ycle = $th is->reposi tory->getO ption("REC YCLE_BIN") ;   17                    $rec ycle = $th is->reposi tory->getO ption("REC YCLE_BIN") ;
18                    if($ create ==  true){   18                    if($ create ==  true){
19                             if(!is _dir($path )) @mkdir( $path);   19                             if(!is _dir($path )) @mkdir( $path);
20                             if(!is _dir($path )){   20                             if(!is _dir($path )){
21                                      return n ew AJXP_Ex ception("C annot crea te root pa th for rep ository. P lease chec k reposito ry configu ration or  that your  folder is  writeable! ");   21                                      return n ew AJXP_Ex ception("C annot crea te root pa th for rep ository. P lease chec k reposito ry configu ration or  that your  folder is  writeable! ");
22                             }   22                             }
23                             if($re cycle!= ""  && !is_di r($path."/ ".$recycle )){   23                             if($re cycle!= ""  && !is_di r($path."/ ".$recycle )){
24                                      @mkdir($ path."/".$ recycle);   24                                      @mkdir($ path."/".$ recycle);
25                                      if(!is_d ir($path." /".$recycl e)){   25                                      if(!is_d ir($path." /".$recycl e)){
26                                               return new  AJXP_Exce ption("Can not create  recycle b in folder.  Please ch eck reposi tory confi guration o r that you r folder i s writeabl e!");   26                                               return new  AJXP_Exce ption("Can not create  recycle b in folder.  Please ch eck reposi tory confi guration o r that you r folder i s writeabl e!");
27                                      }   27                                      }
28                             }   28                             }
29                    }els e{   29                    }els e{
30                             if(!is _dir($path )){   30                             if(!is _dir($path )){
31                                      return n ew AJXP_Ex ception("C annot find  base path  for your  repository ! Please c heck the c onfigurati on!");   31                                      return n ew AJXP_Ex ception("C annot find  base path  for your  repository ! Please c heck the c onfigurati on!");
32                             }   32                             }
33                    }   33                    }
34           }   34           }
35              35           
36           fu nction swi tchAction( $action, $ httpVars,  $fileVars) {   36           fu nction swi tchAction( $action, $ httpVars,  $fileVars) {
37                    if(! isSet($thi s->actions [$action]) ) return;   37                    if(! isSet($thi s->actions [$action]) ) return;
38                    $xml Buffer = " ";   38                    $xml Buffer = " ";
39                    fore ach($httpV ars as $ge tName=>$ge tValue){   39                    fore ach($httpV ars as $ge tName=>$ge tValue){
40                             $$getN ame = Util s::secureP ath($getVa lue);   40                             $$getN ame = Util s::secureP ath($getVa lue);
41                    }   41                    }
42                    $sel ection = n ew UserSel ection();   42                    $sel ection = n ew UserSel ection();
43                    $sel ection->in itFromHttp Vars($http Vars);   43                    $sel ection->in itFromHttp Vars($http Vars);
44                    if(i sSet($dir)  && $actio n != "uplo ad") { $sa feDir = $d ir; $dir =  SystemTex tEncoding: :fromUTF8( $dir); }   44                    if(i sSet($dir)  && $actio n != "uplo ad") { $sa feDir = $d ir; $dir =  SystemTex tEncoding: :fromUTF8( $dir); }
45                    if(i sSet($dest )) $dest =  SystemTex tEncoding: :fromUTF8( $dest);   45                    if(i sSet($dest )) $dest =  SystemTex tEncoding: :fromUTF8( $dest);
46                    $mes s = ConfSe rvice::get Messages() ;   46                    $mes s = ConfSe rvice::get Messages() ;
47                    $rec ycleBinOpt ion = $thi s->reposit ory->getOp tion("RECY CLE_BIN");   47                    $rec ycleBinOpt ion = $thi s->reposit ory->getOp tion("RECY CLE_BIN");
48                    // F ILTER ACTI ON FOR DEL ETE   48                    // F ILTER ACTI ON FOR DEL ETE
49                    if($ recycleBin Option!=""  && $actio n == "dele te" && $di r != "/".$ recycleBin Option)   49                    if($ recycleBin Option!=""  && $actio n == "dele te" && $di r != "/".$ recycleBin Option)
50                    {   50                    {
51                             $actio n = "move" ;   51                             $actio n = "move" ;
52                             $dest  = "/".$rec ycleBinOpt ion;   52                             $dest  = "/".$rec ycleBinOpt ion;
53                             $dest_ node = "AJ AXPLORER_R ECYCLE_NOD E";   53                             $dest_ node = "AJ AXPLORER_R ECYCLE_NOD E";
54                    }   54                    }
55                    // F ILTER ACTI ON FOR RES TORE   55                    // F ILTER ACTI ON FOR RES TORE
56                    if($ recycleBin Option!=""  &&  $acti on == "res tore" && $ dir == "/" .$recycleB inOption)   56                    if($ recycleBin Option!=""  &&  $acti on == "res tore" && $ dir == "/" .$recycleB inOption)
57                    {   57                    {
58                             $origi nalRep = R ecycleBinM anager::ge tFileOrigi n($selecti on->getUni queFile()) ;   58                             $origi nalRep = R ecycleBinM anager::ge tFileOrigi n($selecti on->getUni queFile()) ;
59                             if($or iginalRep  != "")   59                             if($or iginalRep  != "")
60                             {   60                             {
61                                      $action  = "move";   61                                      $action  = "move";
62                                      $dest =  $originalR ep;   62                                      $dest =  $originalR ep;
63                             }   63                             }
64                    }   64                    }
65                       65                    
66                    swit ch($action )   66                    swit ch($action )
67                    {                            67                    {                         
68                             //---- ---------- ---------- ---------- --   68                             //---- ---------- ---------- ---------- --
69                             //       DOWNLOAD , IMAGE &  MP3 PROXYS   69                             //       DOWNLOAD , IMAGE &  MP3 PROXYS
70                             //---- ---------- ---------- ---------- --   70                             //---- ---------- ---------- ---------- --
71                             case " download";   71                             case " download";
72                                      AJXP_Log ger::logAc tion("Down load", arr ay("files" =>$selecti on));   72                                      AJXP_Log ger::logAc tion("Down load", arr ay("files" =>$selecti on));
73                                      if($sele ction->inZ ip()){   73                                      if($sele ction->inZ ip()){
74                                               $tmpDir =  dirname($s election-> getZipPath ())."/.tmp ExtractDow nload";   74                                               $tmpDir =  dirname($s election-> getZipPath ())."/.tmp ExtractDow nload";
75                                               @mkdir($th is->getPat h()."/".$t mpDir);   75                                               @mkdir($th is->getPat h()."/".$t mpDir);
76                                               $this->con vertSelect ionToTmpFi les($tmpDi r, $select ion);   76                                               $this->con vertSelect ionToTmpFi les($tmpDi r, $select ion);
77                                      }   77                                      }
78                                      $zip = f alse;   78                                      $zip = f alse;
79                                      if($sele ction->isU nique()){   79                                      if($sele ction->isU nique()){
80                                               if(is_dir( $this->get Path()."/" .$selectio n->getUniq ueFile()))  {   80                                               if(is_dir( $this->get Path()."/" .$selectio n->getUniq ueFile()))  {
81                                                       $z ip = true;   81                                                       $z ip = true;
82                                                       $d ir .= "/". basename($ selection- >getUnique File());   82                                                       $d ir .= "/". basename($ selection- >getUnique File());
83                                               }   83                                               }
84                                      }else{   84                                      }else{
85                                               $zip = tru e;   85                                               $zip = tru e;
86                                      }   86                                      }
87                                      if($zip) {   87                                      if($zip) {
88                                               // Make a  temp zip a nd send it  as downlo ad   88                                               // Make a  temp zip a nd send it  as downlo ad
89                                               $loggedUse r = AuthSe rvice::get LoggedUser ();   89                                               $loggedUse r = AuthSe rvice::get LoggedUser ();
90                                               $file = US ERS_DIR."/ ".($logged User?$logg edUser->ge tId():"sha red")."/". time()."tm pDownload. zip";   90                                               $file = US ERS_DIR."/ ".($logged User?$logg edUser->ge tId():"sha red")."/". time()."tm pDownload. zip";
91                                               $zipFile =  $this->ma keZip($sel ection->ge tFiles(),  $file, $di r);   91                                               $zipFile =  $this->ma keZip($sel ection->ge tFiles(),  $file, $di r);
92                                               if(!$zipFi le) AJXP_E xception:: errorToXml ("Error wh ile compre ssing");   92                                               if(!$zipFi le) AJXP_E xception:: errorToXml ("Error wh ile compre ssing");
93                                               $localName  = (basena me($dir)== ""?"Files" :basename( $dir)).".z ip";   93                                               $localName  = (basena me($dir)== ""?"Files" :basename( $dir)).".z ip";
94                                               $this->rea dFile($fil e, "force- download",  $localNam e, false,  false);   94                                               $this->rea dFile($fil e, "force- download",  $localNam e, false,  false);
95                                               register_s hutdown_fu nction("un link", $fi le);   95                                               register_s hutdown_fu nction("un link", $fi le);
96                                      }else{   96                                      }else{
97                                               $this->rea dFile($thi s->getPath ()."/".$se lection->g etUniqueFi le(), "for ce-downloa d");   97                                               $this->rea dFile($thi s->getPath ()."/".$se lection->g etUniqueFi le(), "for ce-downloa d");
98                                      }   98                                      }
99                                      if(isSet ($tmpDir)) {   99                                      if(isSet ($tmpDir)) {
100                                               //$this->d eldir($thi s->getPath ()."/".$tm pDir);   100                                               //$this->d eldir($thi s->getPath ()."/".$tm pDir);
101                                               $delDir =  $this->get Path()."/" .$tmpDir;   101                                               $delDir =  $this->get Path()."/" .$tmpDir;
102                                               register_s hutdown_fu nction(arr ay($this,  "deldir"),  $delDir);   102                                               register_s hutdown_fu nction(arr ay($this,  "deldir"),  $delDir);
103                                      }   103                                      }
104                                      exit(0);   104                                      exit(0);
105                             break;   105                             break;
106                       106                    
107                             case " image_prox y":   107                             case " image_prox y":
108                                      if($spli t = UserSe lection::d etectZip(S ystemTextE ncoding::f romUTF8($f ile))){   108                                      if($spli t = UserSe lection::d etectZip(S ystemTextE ncoding::f romUTF8($f ile))){
109                                               require_on ce("server /classes/p clzip.lib. php");   109                                               require_on ce("server /classes/p clzip.lib. php");
110                                               $zip = new  PclZip($t his->getPa th().$spli t[0]);   110                                               $zip = new  PclZip($t his->getPa th().$spli t[0]);
111                                               $data = $z ip->extrac t(PCLZIP_O PT_BY_NAME , substr($ split[1],  1), PCLZIP _OPT_EXTRA CT_AS_STRI NG);   111                                               $data = $z ip->extrac t(PCLZIP_O PT_BY_NAME , substr($ split[1],  1), PCLZIP _OPT_EXTRA CT_AS_STRI NG);
112                                               header("Co ntent-Type : ".Utils: :getImageM imeType(ba sename($sp lit[1]))." ; name=\"" .basename( $split[1]) ."\"");   112                                               header("Co ntent-Type : ".Utils: :getImageM imeType(ba sename($sp lit[1]))." ; name=\"" .basename( $split[1]) ."\"");
113                                               header("Co ntent-Leng th: ".strl en($data[0 ]["content "]));   113                                               header("Co ntent-Leng th: ".strl en($data[0 ]["content "]));
114                                               header('Ca che-Contro l: public' );   114                                               header('Ca che-Contro l: public' );
115                                               print($dat a[0]["cont ent"]);   115                                               print($dat a[0]["cont ent"]);
116                                      }else{   116                                      }else{
117                                               $this->rea dFile($thi s->getPath ()."/".Sys temTextEnc oding::fro mUTF8($fil e), "image ");   117                                               $this->rea dFile($thi s->getPath ()."/".Sys temTextEnc oding::fro mUTF8($fil e), "image ");
118                                      }   118                                      }
119                                      exit(0);   119                                      exit(0);
120                             break;   120                             break;
121                                121                             
122                             case " mp3_proxy" :   122                             case " mp3_proxy" :
123                                      if($spli t = UserSe lection::d etectZip(S ystemTextE ncoding::f romUTF8($f ile))){   123                                      if($spli t = UserSe lection::d etectZip(S ystemTextE ncoding::f romUTF8($f ile))){
124                                               require_on ce("server /classes/p clzip.lib. php");   124                                               require_on ce("server /classes/p clzip.lib. php");
125                                               $zip = new  PclZip($t his->getPa th().$spli t[0]);   125                                               $zip = new  PclZip($t his->getPa th().$spli t[0]);
126                                               $data = $z ip->extrac t(PCLZIP_O PT_BY_NAME , substr($ split[1],  1), PCLZIP _OPT_EXTRA CT_AS_STRI NG);                                        126                                               $data = $z ip->extrac t(PCLZIP_O PT_BY_NAME , substr($ split[1],  1), PCLZIP _OPT_EXTRA CT_AS_STRI NG);                                     
127                                               header("Co ntent-Type : audio/mp 3; name=\" ".basename ($split[1] )."\"");   127                                               header("Co ntent-Type : audio/mp 3; name=\" ".basename ($split[1] )."\"");
128                                               header("Co ntent-Leng th: ".strl en($data[0 ]["content "]));   128                                               header("Co ntent-Leng th: ".strl en($data[0 ]["content "]));
129                                               print($dat a[0]["cont ent"]);   129                                               print($dat a[0]["cont ent"]);
130                                      }else{   130                                      }else{
131                                               $this->rea dFile($thi s->getPath ()."/".Sys temTextEnc oding::fro mUTF8($fil e), "mp3") ;   131                                               $this->rea dFile($thi s->getPath ()."/".Sys temTextEnc oding::fro mUTF8($fil e), "mp3") ;
132                                      }   132                                      }
133                                      exit(0);   133                                      exit(0);
134                             break;   134                             break;
135                                135                             
136                             //---- ---------- ---------- ---------- --   136                             //---- ---------- ---------- ---------- --
137                             //       ONLINE E DIT   137                             //       ONLINE E DIT
138                             //---- ---------- ---------- ---------- --   138                             //---- ---------- ---------- ---------- --
139                             case " edit";       139                             case " edit";    
140                                      if(isset ($save) &&  $save==1  && isSet($ code))   140                                      if(isset ($save) &&  $save==1  && isSet($ code))
141                                      {   141                                      {
142                                               // Reload  "code" var iable dire ctly from  POST array , do not " securePath "...   142                                               // Reload  "code" var iable dire ctly from  POST array , do not " securePath "...
143                                               $code = $_ POST["code "];   143                                               $code = $_ POST["code "];
144                                               AJXP_Logge r::logActi on("Online  Edition",  array("fi le"=>Syste mTextEncod ing::fromU TF8($file) ));   144                                               AJXP_Logge r::logActi on("Online  Edition",  array("fi le"=>Syste mTextEncod ing::fromU TF8($file) ));
145                                               $code=stri pslashes($ code);   145                                               $code=stri pslashes($ code);
146                                               $code=str_ replace("& lt;","<",$ code);   146                                               $code=str_ replace("& lt;","<",$ code);
147                                               $fp=fopen( $this->get Path().Sys temTextEnc oding::fro mUTF8("/$f ile"),"w") ;   147                                               $fp=fopen( $this->get Path().Sys temTextEnc oding::fro mUTF8("/$f ile"),"w") ;
148                                               fputs ($fp ,$code);   148                                               fputs ($fp ,$code);
149                                               fclose($fp );   149                                               fclose($fp );
150                                               echo $mess [115];   150                                               echo $mess [115];
151                                      }   151                                      }
152                                      else    152                                      else 
153                                      {   153                                      {
154                                               $this->rea dFile($thi s->getPath ()."/".Sys temTextEnc oding::fro mUTF8($fil e), "plain ");   154                                               $this->rea dFile($thi s->getPath ()."/".Sys temTextEnc oding::fro mUTF8($fil e), "plain ");
155                                      }   155                                      }
156                                      exit(0);   156                                      exit(0);
157                             break;   157                             break;
158                       158                    
159                             //---- ---------- ---------- ---------- --   159                             //---- ---------- ---------- ---------- --
160                             //       COPY / M OVE   160                             //       COPY / M OVE
161                             //---- ---------- ---------- ---------- --   161                             //---- ---------- ---------- ---------- --
162                             case " copy";   162                             case " copy";
163                             case " move";   163                             case " move";
164                                         164                                      
165                                      if($sele ction->isE mpty())   165                                      if($sele ction->isE mpty())
166                                      {   166                                      {
167                                               $errorMess age = $mes s[113];   167                                               $errorMess age = $mes s[113];
168                                               break;   168                                               break;
169                                      }   169                                      }
170                                      if($sele ction->inZ ip()){   170                                      if($sele ction->inZ ip()){
171                                               $tmpDir =  dirname($s election-> getZipPath ())."/.tmp ExtractDow nload";   171                                               $tmpDir =  dirname($s election-> getZipPath ())."/.tmp ExtractDow nload";
172                                               @mkdir($th is->getPat h()."/".$t mpDir);                                          172                                               @mkdir($th is->getPat h()."/".$t mpDir);                                       
173                                               $this->con vertSelect ionToTmpFi les($tmpDi r, $select ion);   173                                               $this->con vertSelect ionToTmpFi les($tmpDi r, $select ion);
174                                               if(is_dir( $tmpDir))      $this- >deldir($t his->getPa th()."/".$ tmpDir);                                           174                                               if(is_dir( $tmpDir))      $this- >deldir($t his->getPa th()."/".$ tmpDir);                                        
175                                      }   175                                      }
176                                      $success  = $error  = array();   176                                      $success  = $error  = array();
177                                         177                                      
178                                      $this->c opyOrMove( $dest, $se lection->g etFiles(),  $error, $ success, ( $action==" move"?true :false));   178                                      $this->c opyOrMove( $dest, $se lection->g etFiles(),  $error, $ success, ( $action==" move"?true :false));
179                                         179                                      
180                                      if(count ($error)){   180                                      if(count ($error)){
181                                               $errorMess age = join ("\n", $er ror);   181                                               $errorMess age = join ("\n", $er ror);
182                                      }   182                                      }
183                                      else {   183                                      else {
184                                               $logMessag e = join(" \n", $succ ess);   184                                               $logMessag e = join(" \n", $succ ess);
185                                               AJXP_Logge r::logActi on(($actio n=="move"? "Move":"Co py"), arra y("files"= >$selectio n, "destin ation"=>$d est));   185                                               AJXP_Logge r::logActi on(($actio n=="move"? "Move":"Co py"), arra y("files"= >$selectio n, "destin ation"=>$d est));
186                                      }   186                                      }
187                                      $reload_ current_no de = true;   187                                      $reload_ current_no de = true;
188                                      if(isSet ($dest_nod e)) $reloa d_dest_nod e = $dest_ node;   188                                      if(isSet ($dest_nod e)) $reloa d_dest_nod e = $dest_ node;
189                                      $reload_ file_list  = true;   189                                      $reload_ file_list  = true;
190                                         190                                      
191                             break;   191                             break;
192                                192                             
193                             //---- ---------- ---------- ---------- --   193                             //---- ---------- ---------- ---------- --
194                             //       SUPPRIME R / DELETE   194                             //       SUPPRIME R / DELETE
195                             //---- ---------- ---------- ---------- --   195                             //---- ---------- ---------- ---------- --
196                             case " delete";   196                             case " delete";
197                                197                             
198                                      if($sele ction->isE mpty())   198                                      if($sele ction->isE mpty())
199                                      {   199                                      {
200                                               $errorMess age = $mes s[113];   200                                               $errorMess age = $mes s[113];
201                                               break;   201                                               break;
202                                      }   202                                      }
203                                      $logMess ages = arr ay();   203                                      $logMess ages = arr ay();
204                                      $errorMe ssage = $t his->delet e($selecti on->getFil es(), $log Messages);   204                                      $errorMe ssage = $t his->delet e($selecti on->getFil es(), $log Messages);
205                                      if(count ($logMessa ges))   205                                      if(count ($logMessa ges))
206                                      {   206                                      {
207                                               $logMessag e = join(" \n", $logM essages);   207                                               $logMessag e = join(" \n", $logM essages);
208                                      }   208                                      }
209                                      AJXP_Log ger::logAc tion("Dele te", array ("files"=> $selection ));   209                                      AJXP_Log ger::logAc tion("Dele te", array ("files"=> $selection ));
210                                      $reload_ current_no de = true;   210                                      $reload_ current_no de = true;
211                                      $reload_ file_list  = true;   211                                      $reload_ file_list  = true;
212                                         212                                      
213                             break;   213                             break;
214                       214                    
215                             //---- ---------- ---------- ---------- --   215                             //---- ---------- ---------- ---------- --
216                             //       RENOMMER  / RENAME   216                             //       RENOMMER  / RENAME
217                             //---- ---------- ---------- ---------- --   217                             //---- ---------- ---------- ---------- --
218                             case " rename";   218                             case " rename";
219                                219                             
220                                      $file =  SystemText Encoding:: fromUTF8($ file);   220                                      $file =  SystemText Encoding:: fromUTF8($ file);
221                                      $filenam e_new = Sy stemTextEn coding::fr omUTF8($fi lename_new );   221                                      $filenam e_new = Sy stemTextEn coding::fr omUTF8($fi lename_new );
222                                      $error =  $this->re name($file , $filenam e_new);   222                                      $error =  $this->re name($file , $filenam e_new);
223                                      if($erro r != null)  {   223                                      if($erro r != null)  {
224                                               $errorMess age  = $er ror;   224                                               $errorMess age  = $er ror;
225                                               break;   225                                               break;
226                                      }   226                                      }
227                                      $logMess age= Syste mTextEncod ing::toUTF 8($file)."  $mess[41]  ".SystemT extEncodin g::toUTF8( $filename_ new);   227                                      $logMess age= Syste mTextEncod ing::toUTF 8($file)."  $mess[41]  ".SystemT extEncodin g::toUTF8( $filename_ new);
228                                      $reload_ current_no de = true;   228                                      $reload_ current_no de = true;
229                                      $reload_ file_list  = basename ($filename _new);   229                                      $reload_ file_list  = basename ($filename _new);
230                                      AJXP_Log ger::logAc tion("Rena me", array ("original "=>$file,  "new"=>$fi lename_new ));   230                                      AJXP_Log ger::logAc tion("Rena me", array ("original "=>$file,  "new"=>$fi lename_new ));
231                                         231                                      
232                             break;   232                             break;
233                       233                    
234                             //---- ---------- ---------- ---------- --   234                             //---- ---------- ---------- ---------- --
235                             //       CREER UN  REPERTOIR E / CREATE  DIR   235                             //       CREER UN  REPERTOIR E / CREATE  DIR
236                             //---- ---------- ---------- ---------- --   236                             //---- ---------- ---------- ---------- --
237                             case " mkdir";   237                             case " mkdir";
238                                         238                                      
239                                      $messtmp ="";   239                                      $messtmp ="";
240                                      $dirname =Utils::pr ocessFileN ame(System TextEncodi ng::fromUT F8($dirnam e));   240                                      $dirname =Utils::pr ocessFileN ame(System TextEncodi ng::fromUT F8($dirnam e));
241                                      $error =  $this->mk Dir($dir,  $dirname);   241                                      $error =  $this->mk Dir($dir,  $dirname);
242                                      if(isSet ($error)){   242                                      if(isSet ($error)){
243                                               $errorMess age = $err or; break;   243                                               $errorMess age = $err or; break;
244                                      }   244                                      }
245                                      $reload_ file_list  = $dirname ;   245                                      $reload_ file_list  = $dirname ;
246                                      $messtmp .="$mess[3 8] ".Syste mTextEncod ing::toUTF 8($dirname )." $mess[ 39] ";   246                                      $messtmp .="$mess[3 8] ".Syste mTextEncod ing::toUTF 8($dirname )." $mess[ 39] ";
247                                      if($dir= ="") {$mes stmp.="/"; } else {$m esstmp.= S ystemTextE ncoding::t oUTF8($dir );}   247                                      if($dir= ="") {$mes stmp.="/"; } else {$m esstmp.= S ystemTextE ncoding::t oUTF8($dir );}
248                                      $logMess age = $mes stmp;   248                                      $logMess age = $mes stmp;
249                                      $reload_ current_no de = true;   249                                      $reload_ current_no de = true;
250                                      AJXP_Log ger::logAc tion("Crea te Dir", a rray("dir" =>$dir."/" .$dirname) );   250                                      AJXP_Log ger::logAc tion("Crea te Dir", a rray("dir" =>$dir."/" .$dirname) );
251                                         251                                      
252                             break;   252                             break;
253                       253                    
254                             //---- ---------- ---------- ---------- --   254                             //---- ---------- ---------- ---------- --
255                             //       CREER UN  FICHIER /  CREATE FI LE   255                             //       CREER UN  FICHIER /  CREATE FI LE
256                             //---- ---------- ---------- ---------- --   256                             //---- ---------- ---------- ---------- --
257                             case " mkfile";   257                             case " mkfile";
258                                258                             
259                                      $messtmp ="";   259                                      $messtmp ="";
260                                      $filenam e=Utils::p rocessFile Name(Syste mTextEncod ing::fromU TF8($filen ame));          260                                      $filenam e=Utils::p rocessFile Name(Syste mTextEncod ing::fromU TF8($filen ame));       
261                                      $error =  $this->cr eateEmptyF ile($dir,  $filename) ;   261                                      $error =  $this->cr eateEmptyF ile($dir,  $filename) ;
262                                      if(isSet ($error)){   262                                      if(isSet ($error)){
263                                               $errorMess age = $err or; break;   263                                               $errorMess age = $err or; break;
264                                      }   264                                      }
265                                      $messtmp .="$mess[3 4] ".Syste mTextEncod ing::toUTF 8($filenam e)." $mess [39] ";   265                                      $messtmp .="$mess[3 4] ".Syste mTextEncod ing::toUTF 8($filenam e)." $mess [39] ";
266                                      if($dir= ="") {$mes stmp.="/"; } else {$m esstmp.=Sy stemTextEn coding::to UTF8($dir) ;}   266                                      if($dir= ="") {$mes stmp.="/"; } else {$m esstmp.=Sy stemTextEn coding::to UTF8($dir) ;}
267                                      $logMess age = $mes stmp;   267                                      $logMess age = $mes stmp;
268                                      $reload_ file_list  = $filenam e;   268                                      $reload_ file_list  = $filenam e;
269                                      AJXP_Log ger::logAc tion("Crea te File",  array("fil e"=>$dir." /".$filena me));   269                                      AJXP_Log ger::logAc tion("Crea te File",  array("fil e"=>$dir." /".$filena me));
270                       270                    
271                             break;   271                             break;
272                                272                             
273                             //---- ---------- ---------- ---------- --   273                             //---- ---------- ---------- ---------- --
274                             //       UPLOAD   274                             //       UPLOAD
275                             //---- ---------- ---------- ---------- --     275                             //---- ---------- ---------- ---------- --  
276                             case " upload":   276                             case " upload":
277     277  
278                                      if($dir! =""){$rep_ source="/$ dir";}   278                                      if($dir! =""){$rep_ source="/$ dir";}
279                                      else $re p_source =  "";   279                                      else $re p_source =  "";
280                                      $destina tion=Syste mTextEncod ing::fromU TF8($this- >getPath() .$rep_sour ce);   280                                      $destina tion=Syste mTextEncod ing::fromU TF8($this- >getPath() .$rep_sour ce);
281                                      if(!$thi s->isWrite able($dest ination))   281                                      if(!$thi s->isWrite able($dest ination))
282                                      {   282                                      {
283                                               $errorMess age = "$me ss[38] ".S ystemTextE ncoding::t oUTF8($dir )." $mess[ 99].";   283                                               $errorMess age = "$me ss[38] ".S ystemTextE ncoding::t oUTF8($dir )." $mess[ 99].";
284                                               break;   284                                               break;
285                                      }          285                                      }       
286                                      $logMess age = "";   286                                      $logMess age = "";
287                                      $fancyLo ader = fal se;   287                                      $fancyLo ader = fal se;
288                                      foreach  ($fileVars  as $boxNa me => $box Data)   288                                      foreach  ($fileVars  as $boxNa me => $box Data)
289                                      {   289                                      {
290                                               if($boxNam e != "File data" && s ubstr($box Name, 0, 9 ) != "user file_")      continue ;   290                                               if($boxNam e != "File data" && s ubstr($box Name, 0, 9 ) != "user file_")      continue ;
291                                               if($boxNam e == "File data") $fa ncyLoader  = true;   291                                               if($boxNam e == "File data") $fa ncyLoader  = true;
292                                               $err = Uti ls::parseF ileDataErr ors($boxDa ta, $fancy Loader);   292                                               $err = Uti ls::parseF ileDataErr ors($boxDa ta, $fancy Loader);
293                                               if($err !=  null)   293                                               if($err !=  null)
294                                               {   294                                               {
295                                                       $e rrorMessag e = $err;   295                                                       $e rrorMessag e = $err;
296                                                       br eak;   296                                                       br eak;
297                                               }   297                                               }
298                                               $userfile_ name = $bo xData["nam e"];   298                                               $userfile_ name = $bo xData["nam e"];
299                                               if($fancyL oader) $us erfile_nam e = System TextEncodi ng::fromUT F8($userfi le_name);   299                                               if($fancyL oader) $us erfile_nam e = System TextEncodi ng::fromUT F8($userfi le_name);
300                                               $userfile_ name=Utils ::processF ileName($u serfile_na me);   300                                               $userfile_ name=Utils ::processF ileName($u serfile_na me);
301                                               if(isSet($ auto_renam e)){   301                                               if(isSet($ auto_renam e)){
302                                                       $u serfile_na me = fsDri ver::autoR enameForDe st($destin ation, $us erfile_nam e);   302                                                       $u serfile_na me = fsDri ver::autoR enameForDe st($destin ation, $us erfile_nam e);
303                                               }   303                                               }
304                                               if (!move_ uploaded_f ile($boxDa ta["tmp_na me"], "$de stination/ ".$userfil e_name))   304                                               if (!move_ uploaded_f ile($boxDa ta["tmp_na me"], "$de stination/ ".$userfil e_name))
305                                               {   305                                               {
306                                                       $e rrorMessag e=($fancyL oader?"411  ":"")."$m ess[33] ". $userfile_ name;   306                                                       $e rrorMessag e=($fancyL oader?"411  ":"")."$m ess[33] ". $userfile_ name;
307                                                       br eak;   307                                                       br eak;
308                                               }   308                                               }
309                                               chmod($des tination." /".$userfi le_name, 0 777);   309                                               chmod($des tination." /".$userfi le_name, 0 777);
310                                               $logMessag e.="$mess[ 34] ".Syst emTextEnco ding::toUT F8($userfi le_name)."  $mess[35]  $dir";   310                                               $logMessag e.="$mess[ 34] ".Syst emTextEnco ding::toUT F8($userfi le_name)."  $mess[35]  $dir";
311                                               AJXP_Logge r::logActi on("Upload  File", ar ray("file" =>SystemTe xtEncoding ::fromUTF8 ($dir)."/" .$userfile _name));   311                                               AJXP_Logge r::logActi on("Upload  File", ar ray("file" =>SystemTe xtEncoding ::fromUTF8 ($dir)."/" .$userfile _name));
312                                      }   312                                      }
313                                      if($fanc yLoader)   313                                      if($fanc yLoader)
314                                      {   314                                      {
315                                               if(isSet($ errorMessa ge)){   315                                               if(isSet($ errorMessa ge)){
316                                                       he ader('HTTP /1.0 '.$er rorMessage );   316                                                       he ader('HTTP /1.0 '.$er rorMessage );
317                                                       di e('Error ' .$errorMes sage);   317                                                       di e('Error ' .$errorMes sage);
318                                               }else{   318                                               }else{
319                                                       he ader('HTTP /1.0 200 O K');   319                                                       he ader('HTTP /1.0 200 O K');
320                                                       di e("200 OK" );   320                                                       di e("200 OK" );
321                                               }   321                                               }
322                                      }   322                                      }
323                                      else   323                                      else
324                                      {   324                                      {
325                                               print("<ht ml><script  language= \"javascri pt\">\n");   325                                               print("<ht ml><script  language= \"javascri pt\">\n");
326                                               if(isSet($ errorMessa ge)){   326                                               if(isSet($ errorMessa ge)){
327                                                       pr int("\n if (parent.aj axplorer.a ctionBar.m ulti_selec tor)parent .ajaxplore r.actionBa r.multi_se lector.sub mitNext('" .str_repla ce("'", "\ '", $error Message)." ');");              327                                                       pr int("\n if (parent.aj axplorer.a ctionBar.m ulti_selec tor)parent .ajaxplore r.actionBa r.multi_se lector.sub mitNext('" .str_repla ce("'", "\ '", $error Message)." ');");           
328                                               }else{              328                                               }else{           
329                                                       pr int("\n if (parent.aj axplorer.a ctionBar.m ulti_selec tor)parent .ajaxplore r.actionBa r.multi_se lector.sub mitNext(); ");   329                                                       pr int("\n if (parent.aj axplorer.a ctionBar.m ulti_selec tor)parent .ajaxplore r.actionBa r.multi_se lector.sub mitNext(); ");
330                                               }   330                                               }
331                                               print("</s cript></ht ml>");   331                                               print("</s cript></ht ml>");
332                                      }   332                                      }
333                                      exit;   333                                      exit;
334                                         334                                      
335                             break;   335                             break;
336                                336                             
337                             //---- ---------- ---------- ---------- --   337                             //---- ---------- ---------- ---------- --
338                             //       XML LIST ING   338                             //       XML LIST ING
339                             //---- ---------- ---------- ---------- --   339                             //---- ---------- ---------- ---------- --
340                             case " ls":   340                             case " ls":
341                                341                             
342                                      if(!isSe t($dir) ||  $dir == " /") $dir =  "";   342                                      if(!isSe t($dir) ||  $dir == " /") $dir =  "";
343                                      $searchM ode = $fil eListMode  = $complet eMode = fa lse;   343                                      $searchM ode = $fil eListMode  = $complet eMode = fa lse;
344                                      if(isSet ($mode)){   344                                      if(isSet ($mode)){
345                                               if($mode = = "search" ) $searchM ode = true ;   345                                               if($mode = = "search" ) $searchM ode = true ;
346                                               else if($m ode == "fi le_list")  $fileListM ode = true ;   346                                               else if($m ode == "fi le_list")  $fileListM ode = true ;
347                                               else if($m ode == "co mplete") $ completeMo de = true;   347                                               else if($m ode == "co mplete") $ completeMo de = true;
348                                      }                                     348                                      }                                  
349                                      if(isSet ($skipZip)  && $skipZ ip == "tru e"){   349                                      if(isSet ($skipZip)  && $skipZ ip == "tru e"){
350                                               $skipZip =  true;   350                                               $skipZip =  true;
351                                      }else{   351                                      }else{
352                                               $skipZip =  false;   352                                               $skipZip =  false;
353                                      }   353                                      }
354                                      if($test  = UserSel ection::de tectZip($d ir)){   354                                      if($test  = UserSel ection::de tectZip($d ir)){
355                                               $liste = a rray();   355                                               $liste = a rray();
356                                               $zip = $th is->zipLis ting($test [0], $test [1], $list e);   356                                               $zip = $th is->zipLis ting($test [0], $test [1], $list e);
357                                               AJXP_XMLWr iter::head er();   357                                               AJXP_XMLWr iter::head er();
358                                               $tmpDir =  $this->get Path().dir name($test [0]).".tmp ZipExtract ";                                        358                                               $tmpDir =  $this->get Path().dir name($test [0]).".tmp ZipExtract ";                                     
359                                               foreach ($ liste as $ zipEntry){   359                                               foreach ($ liste as $ zipEntry){
360                                                       $a tts = arra y();   360                                                       $a tts = arra y();
361                                                       if (!$fileLis tMode && ! $zipEntry[ "folder"])  continue;   361                                                       if (!$fileLis tMode && ! $zipEntry[ "folder"])  continue;
362                                                       $a tts[] = "i s_file=\"" .($zipEntr y["folder" ]?"false": "true")."\ "";   362                                                       $a tts[] = "i s_file=\"" .($zipEntr y["folder" ]?"false": "true")."\ "";
363                                                       $a tts[] = "t ext=\"".ba sename(Sys temTextEnc oding::toU TF8($zipEn try["store d_filename "]))."\"";   363                                                       $a tts[] = "t ext=\"".ba sename(Sys temTextEnc oding::toU TF8($zipEn try["store d_filename "]))."\"";
364                                                       $a tts[] = "f ilename=\" ".SystemTe xtEncoding ::toUTF8($ zipEntry[" filename"] )."\"";   364                                                       $a tts[] = "f ilename=\" ".SystemTe xtEncoding ::toUTF8($ zipEntry[" filename"] )."\"";
365                                                       if ($fileList Mode){   365                                                       if ($fileList Mode){
366                                                                $att s[] = "fil esize=\"". Utils::rou ndSize($zi pEntry["si ze"])."\"" ;   366                                                                $att s[] = "fil esize=\"". Utils::rou ndSize($zi pEntry["si ze"])."\"" ;
367                                                                $att s[] = "byt esize=\"". $zipEntry[ "size"]."\ "";   367                                                                $att s[] = "byt esize=\"". $zipEntry[ "size"]."\ "";
368                                                                $att s[] = "mod iftime=\"" .date("d/m /Y H:i",$z ipEntry["m time"])."\ "";   368                                                                $att s[] = "mod iftime=\"" .date("d/m /Y H:i",$z ipEntry["m time"])."\ "";
369                                                                $att s[] = "mim estring=\" ".Utils::m imetype($z ipEntry["s tored_file name"], "m ime", $zip Entry["fol der"])."\" ";   369                                                                $att s[] = "mim estring=\" ".Utils::m imetype($z ipEntry["s tored_file name"], "m ime", $zip Entry["fol der"])."\" ";
370                                                                $att s[] = "ico n=\"".Util s::mimetyp e($zipEntr y["stored_ filename"] , "image",  $zipEntry ["folder"] )."\"";   370                                                                $att s[] = "ico n=\"".Util s::mimetyp e($zipEntr y["stored_ filename"] , "image",  $zipEntry ["folder"] )."\"";
371                                                                $is_ image = Ut ils::is_im age(basena me($zipEnt ry["stored _filename" ]));   371                                                                $is_ image = Ut ils::is_im age(basena me($zipEnt ry["stored _filename" ]));
372                                                                $att s[] = "is_ image=\"". $is_image. "\"";   372                                                                $att s[] = "is_ image=\"". $is_image. "\"";
373                                                                if($ is_image){   373                                                                if($ is_image){
374                                                                         if(!is _dir($tmpD ir)) mkdir ($tmpDir);   374                                                                         if(!is _dir($tmpD ir)) mkdir ($tmpDir);
375                                                                         $curre ntFile = $ tmpDir."/" .basename( $zipEntry[ "stored_fi lename"]);                                                                        375                                                                         $curre ntFile = $ tmpDir."/" .basename( $zipEntry[ "stored_fi lename"]);                                                                     
376                                                                         $data  = $zip->ex tract(PCLZ IP_OPT_BY_ NAME, $zip Entry["sto red_filena me"], PCLZ IP_OPT_REM OVE_ALL_PA TH, PCLZIP _OPT_PATH,  $tmpDir);   376                                                                         $data  = $zip->ex tract(PCLZ IP_OPT_BY_ NAME, $zip Entry["sto red_filena me"], PCLZ IP_OPT_REM OVE_ALL_PA TH, PCLZIP _OPT_PATH,  $tmpDir);
377                                                                         list($ width, $he ight, $typ e, $attr)  = @getimag esize($cur rentFile);   377                                                                         list($ width, $he ight, $typ e, $attr)  = @getimag esize($cur rentFile);
378                                                                         $atts[ ] = "image _type=\"". image_type _to_mime_t ype($type) ."\"";   378                                                                         $atts[ ] = "image _type=\"". image_type _to_mime_t ype($type) ."\"";
379                                                                         $atts[ ] = "image _width=\"$ width\"";   379                                                                         $atts[ ] = "image _width=\"$ width\"";
380                                                                         $atts[ ] = "image _height=\" $height\"" ;   380                                                                         $atts[ ] = "image _height=\" $height\"" ;
381                                                                         unlink ($currentF ile);   381                                                                         unlink ($currentF ile);
382                                                                }   382                                                                }
383                                                       }e lse{                                                          383                                                       }e lse{                                                       
384                                                                $att s[] = "ico n=\"client /images/fo ldericon.p ng\"";   384                                                                $att s[] = "ico n=\"client /images/fo ldericon.p ng\"";
385                                                                $att s[] = "ope nicon=\"cl ient/image s/folderic on.png\"";   385                                                                $att s[] = "ope nicon=\"cl ient/image s/folderic on.png\"";
386                                                                $att s[] = "src =\"content .php?dir=" .urlencode (SystemTex tEncoding: :toUTF8($z ipEntry["f ilename"]) )."\"";   386                                                                $att s[] = "src =\"content .php?dir=" .urlencode (SystemTex tEncoding: :toUTF8($z ipEntry["f ilename"]) )."\"";
387                                                       }                                                       387                                                       }                                                    
388                                                       pr int("<tree  ".join("  ", $atts). "/>");   388                                                       pr int("<tree  ".join("  ", $atts). "/>");
389                                                       if (is_dir($t mpDir)){   389                                                       if (is_dir($t mpDir)){
390                                                                rmdi r($tmpDir) ;   390                                                                rmdi r($tmpDir) ;
391                                                       }   391                                                       }
392                                               }   392                                               }
393                                               AJXP_XMLWr iter::clos e();   393                                               AJXP_XMLWr iter::clos e();
394                                               exit(0);   394                                               exit(0);
395                                      }   395                                      }
396                                      $nom_rep  = $this-> initName($ dir);   396                                      $nom_rep  = $this-> initName($ dir);
397                                      AJXP_Exc eption::er rorToXml($ nom_rep);   397                                      AJXP_Exc eption::er rorToXml($ nom_rep);
398                                      $result  = $this->l isting($no m_rep, !($ searchMode  || $fileL istMode));   398                                      $result  = $this->l isting($no m_rep, !($ searchMode  || $fileL istMode));
399                                      $reps =  $result[0] ;   399                                      $reps =  $result[0] ;
400                                      AJXP_XML Writer::he ader();   400                                      AJXP_XML Writer::he ader();
401                                      foreach  ($reps as  $repIndex  => $repNam e)   401                                      foreach  ($reps as  $repIndex  => $repNam e)
402                                      {   402                                      {
403                                               if(eregi(" \.zip$",$r epName) &&  $skipZip)  continue;   403                                               if(eregi(" \.zip$",$r epName) &&  $skipZip)  continue;
404                                               $attribute s = "";   404                                               $attribute s = "";
405                                               if($search Mode)   405                                               if($search Mode)
406                                               {   406                                               {
407                                                       if (is_file($ nom_rep."/ ".$repInde x)) {$attr ibutes = " is_file=\" true\" ico n=\"$repNa me\""; $re pName = $r epIndex;}   407                                                       if (is_file($ nom_rep."/ ".$repInde x)) {$attr ibutes = " is_file=\" true\" ico n=\"$repNa me\""; $re pName = $r epIndex;}
408                                               }   408                                               }
409                                               else if($f ileListMod e)   409                                               else if($f ileListMod e)
410                                               {   410                                               {
411                                                       $c urrentFile  = $nom_re p."/".$rep Index;                       411                                                       $c urrentFile  = $nom_re p."/".$rep Index;                    
412                                                       $a tts = arra y();   412                                                       $a tts = arra y();
413                                                       $a tts[] = "i s_file=\"" .(is_file( $currentFi le)?"1":"0 ")."\"";   413                                                       $a tts[] = "i s_file=\"" .(is_file( $currentFi le)?"1":"0 ")."\"";
414                                                       $a tts[] = "i s_image=\" ".Utils::i s_image($c urrentFile )."\"";   414                                                       $a tts[] = "i s_image=\" ".Utils::i s_image($c urrentFile )."\"";
415                                                       if (Utils::is _image($cu rrentFile) )   415                                                       if (Utils::is _image($cu rrentFile) )
416                                                       {   416                                                       {
417                                                                list ($width, $ height, $t ype, $attr ) = @getim agesize($c urrentFile );   417                                                                list ($width, $ height, $t ype, $attr ) = @getim agesize($c urrentFile );
418                                                                $att s[] = "ima ge_type=\" ".image_ty pe_to_mime _type($typ e)."\"";   418                                                                $att s[] = "ima ge_type=\" ".image_ty pe_to_mime _type($typ e)."\"";
419                                                                $att s[] = "ima ge_width=\ "$width\"" ;   419                                                                $att s[] = "ima ge_width=\ "$width\"" ;
420                                                                $att s[] = "ima ge_height= \"$height\ "";   420                                                                $att s[] = "ima ge_height= \"$height\ "";
421                                                       }   421                                                       }
422                                                       $a tts[] = "m imestring= \"".Utils: :mimetype( $currentFi le, "type" , is_dir($ currentFil e))."\"";   422                                                       $a tts[] = "m imestring= \"".Utils: :mimetype( $currentFi le, "type" , is_dir($ currentFil e))."\"";
423                                                       $a tts[] = "m odiftime=\ "".$this-> date_modif ($currentF ile)."\"";   423                                                       $a tts[] = "m odiftime=\ "".$this-> date_modif ($currentF ile)."\"";
424                                                       $a tts[] = "f ilesize=\" ".Utils::r oundSize(f ilesize($c urrentFile ))."\"";   424                                                       $a tts[] = "f ilesize=\" ".Utils::r oundSize(f ilesize($c urrentFile ))."\"";
425                                                       $b ytesize =  filesize($ currentFil e);   425                                                       $b ytesize =  filesize($ currentFil e);
426                                                       if ($bytesize  < 0) $byt esize = sp rintf("%u" , $bytesiz e);   426                                                       if ($bytesize  < 0) $byt esize = sp rintf("%u" , $bytesiz e);
427                                                       $a tts[] = "b ytesize=\" ".$bytesiz e."\"";   427                                                       $a tts[] = "b ytesize=\" ".$bytesiz e."\"";
428                                                       $a tts[] = "f ilename=\" ".str_repl ace("&", " &amp;", Sy stemTextEn coding::to UTF8($dir. "/".$repIn dex))."\"" ;   428                                                       $a tts[] = "f ilename=\" ".str_repl ace("&", " &amp;", Sy stemTextEn coding::to UTF8($dir. "/".$repIn dex))."\"" ;
429                                                       $a tts[] = "i con=\"".(i s_file($cu rrentFile) ?SystemTex tEncoding: :toUTF8($r epName):"f older.png" )."\"";   429                                                       $a tts[] = "i con=\"".(i s_file($cu rrentFile) ?SystemTex tEncoding: :toUTF8($r epName):"f older.png" )."\"";
430                                                          430                                                       
431                                                       $a ttributes  = join(" " , $atts);   431                                                       $a ttributes  = join(" " , $atts);
432                                                       $r epName = $ repIndex;   432                                                       $r epName = $ repIndex;
433                                               }   433                                               }
434                                               else    434                                               else 
435                                               {   435                                               {
436                                                       $l ink = Syst emTextEnco ding::toUT F8(SERVER_ ACCESS."?d ir=".$dir. "/".$repNa me);   436                                                       $l ink = Syst emTextEnco ding::toUT F8(SERVER_ ACCESS."?d ir=".$dir. "/".$repNa me);
437                                                       $l ink = urle ncode($lin k);   437                                                       $l ink = urle ncode($lin k);
438                                                       $f olderBaseN ame = str_ replace("& ", "&amp;" , $repName );   438                                                       $f olderBaseN ame = str_ replace("& ", "&amp;" , $repName );
439                                                       $f olderFullN ame = "$di r/".$folde rBaseName;   439                                                       $f olderFullN ame = "$di r/".$folde rBaseName;
440                                                       $p arentFolde rName = $d ir;   440                                                       $p arentFolde rName = $d ir;
441                                                       if (!$complet eMode){   441                                                       if (!$complet eMode){
442                                                                $ico n = CLIENT _RESOURCES _FOLDER."/ images/fol dericon.pn g";   442                                                                $ico n = CLIENT _RESOURCES _FOLDER."/ images/fol dericon.pn g";
443                                                                $ope nicon = CL IENT_RESOU RCES_FOLDE R."/images /openfolde ricon.png" ;   443                                                                $ope nicon = CL IENT_RESOU RCES_FOLDE R."/images /openfolde ricon.png" ;
444                                                                if(e regi("\.zi p$",$repNa me)){   444                                                                if(e regi("\.zi p$",$repNa me)){
445                                                                         $icon  = $openico n = CLIENT _RESOURCES _FOLDER."/ images/cry stal/actio ns/16/acce ssories-ar chiver.png ";   445                                                                         $icon  = $openico n = CLIENT _RESOURCES _FOLDER."/ images/cry stal/actio ns/16/acce ssories-ar chiver.png ";
446                                                                }   446                                                                }
447                                                                $att ributes =  "icon=\"$i con\"  ope nicon=\"$o penicon\"  filename=\ "".SystemT extEncodin g::toUTF8( $folderFul lName)."\"  src=\"$li nk\"";   447                                                                $att ributes =  "icon=\"$i con\"  ope nicon=\"$o penicon\"  filename=\ "".SystemT extEncodin g::toUTF8( $folderFul lName)."\"  src=\"$li nk\"";
448                                                       }   448                                                       }
449                                               }   449                                               }
450                                               print("<tr ee text=\" ".str_repl ace("&", " &amp;", Sy stemTextEn coding::to UTF8($repN ame))."\"  $attribute s>");   450                                               print("<tr ee text=\" ".str_repl ace("&", " &amp;", Sy stemTextEn coding::to UTF8($repN ame))."\"  $attribute s>");
451                                               print("</t ree>");   451                                               print("</t ree>");
452                                      }   452                                      }
453                                      // ADD R ECYCLE BIN  TO THE LI ST   453                                      // ADD R ECYCLE BIN  TO THE LI ST
454                                      if($nom_ rep == $th is->reposi tory->getO ption("PAT H") && $re cycleBinOp tion!="" & & !$comple teMode &&  !$skipZip)   454                                      if($nom_ rep == $th is->reposi tory->getO ption("PAT H") && $re cycleBinOp tion!="" & & !$comple teMode &&  !$skipZip)
455                                      {   455                                      {
456                                               if($fileLi stMode)   456                                               if($fileLi stMode)
457                                               {   457                                               {
458                                                       pr int("<tree  text=\"". str_replac e("&", "&a mp;", $mes s[122])."\ " filesize =\"-\" is_ file=\"0\"  is_recycl e=\"1\" mi mestring=\ "Trashcan\ " modiftim e=\"".$thi s->date_mo dif($this- >repositor y->getOpti on("PATH") ."/".$recy cleBinOpti on)."\" fi lename=\"/ ".$recycle BinOption. "\" icon=\ "trashcan. png\"></tr ee>");   458                                                       pr int("<tree  text=\"". str_replac e("&", "&a mp;", $mes s[122])."\ " filesize =\"-\" is_ file=\"0\"  is_recycl e=\"1\" mi mestring=\ "Trashcan\ " modiftim e=\"".$thi s->date_mo dif($this- >repositor y->getOpti on("PATH") ."/".$recy cleBinOpti on)."\" fi lename=\"/ ".$recycle BinOption. "\" icon=\ "trashcan. png\"></tr ee>");
459                                               }   459                                               }
460                                               else    460                                               else 
461                                               {                                                      461                                               {                                                   
462                                                       pr int("<tree  text=\"$m ess[122]\"  is_recycl e=\"true\"  icon=\"". CLIENT_RES OURCES_FOL DER."/imag es/crystal /mimes/16/ trashcan.p ng\"  open Icon=\"".C LIENT_RESO URCES_FOLD ER."/image s/crystal/ mimes/16/t rashcan.pn g\" filena me=\"/".$r ecycleBinO ption."\"/ >");   462                                                       pr int("<tree  text=\"$m ess[122]\"  is_recycl e=\"true\"  icon=\"". CLIENT_RES OURCES_FOL DER."/imag es/crystal /mimes/16/ trashcan.p ng\"  open Icon=\"".C LIENT_RESO URCES_FOLD ER."/image s/crystal/ mimes/16/t rashcan.pn g\" filena me=\"/".$r ecycleBinO ption."\"/ >");
463                                               }   463                                               }
464                                      }   464                                      }
465                                      AJXP_XML Writer::cl ose();   465                                      AJXP_XML Writer::cl ose();
466                                      exit(1);   466                                      exit(1);
467                                         467                                      
468                             break;              468                             break;           
469                    }   469                    }
470     470  
471                    if(i sset($logM essage) ||  isset($er rorMessage ))   471                    if(i sset($logM essage) ||  isset($er rorMessage ))
472                    {   472                    {
473                             $xmlBu ffer .= AJ XP_XMLWrit er::sendMe ssage((isS et($logMes sage)?$log Message:nu ll), (isSe t($errorMe ssage)?$er rorMessage :null), fa lse);                          473                             $xmlBu ffer .= AJ XP_XMLWrit er::sendMe ssage((isS et($logMes sage)?$log Message:nu ll), (isSe t($errorMe ssage)?$er rorMessage :null), fa lse);                       
474                    }   474                    }
475                       475                    
476                    if(i sset($requ ireAuth))   476                    if(i sset($requ ireAuth))
477                    {   477                    {
478                             $xmlBu ffer .= AJ XP_XMLWrit er::requir eAuth(fals e);   478                             $xmlBu ffer .= AJ XP_XMLWrit er::requir eAuth(fals e);
479                    }   479                    }
480                       480                    
481                    if(i sset($relo ad_current _node) &&  $reload_cu rrent_node  == "true" )   481                    if(i sset($relo ad_current _node) &&  $reload_cu rrent_node  == "true" )
482                    {   482                    {
483                             $xmlBu ffer .= AJ XP_XMLWrit er::reload CurrentNod e(false);   483                             $xmlBu ffer .= AJ XP_XMLWrit er::reload CurrentNod e(false);
484                    }   484                    }
485                       485                    
486                    if(i sset($relo ad_dest_no de) && $re load_dest_ node != "" )   486                    if(i sset($relo ad_dest_no de) && $re load_dest_ node != "" )
487                    {   487                    {
488                             $xmlBu ffer .= AJ XP_XMLWrit er::reload Node($relo ad_dest_no de, false) ;   488                             $xmlBu ffer .= AJ XP_XMLWrit er::reload Node($relo ad_dest_no de, false) ;
489                    }   489                    }
490                       490                    
491                    if(i sset($relo ad_file_li st))   491                    if(i sset($relo ad_file_li st))
492                    {   492                    {
493                             $xmlBu ffer .= AJ XP_XMLWrit er::reload FileList($ reload_fil e_list, fa lse);   493                             $xmlBu ffer .= AJ XP_XMLWrit er::reload FileList($ reload_fil e_list, fa lse);
494                    }   494                    }
495                       495                    
496                    retu rn $xmlBuf fer;   496                    retu rn $xmlBuf fer;
497           }   497           }
498              498           
499           fu nction get Path(){   499           fu nction get Path(){
500                    retu rn $this-> repository ->getOptio n("PATH");   500                    retu rn $this-> repository ->getOptio n("PATH");
501           }   501           }
502              502           
503           fu nction zip Listing($z ipPath, $l ocalPath,  &$filtered List){   503           fu nction zip Listing($z ipPath, $l ocalPath,  &$filtered List){
504                    requ ire_once(" server/cla sses/pclzi p.lib.php" );   504                    requ ire_once(" server/cla sses/pclzi p.lib.php" );
505                    $crt Zip = new  PclZip($th is->getPat h()."/".$z ipPath);   505                    $crt Zip = new  PclZip($th is->getPat h()."/".$z ipPath);
506                    $lis te = $crtZ ip->listCo ntent();   506                    $lis te = $crtZ ip->listCo ntent();
507                    $fil es = array ();   507                    $fil es = array ();
508                    if($ localPath[ strlen($lo calPath)-1 ] != "/")  $localPath .="/";   508                    if($ localPath[ strlen($lo calPath)-1 ] != "/")  $localPath .="/";
509                    fore ach ($list e as $item ){   509                    fore ach ($list e as $item ){
510                             $store d = $item[ "stored_fi lename"];                          510                             $store d = $item[ "stored_fi lename"];                       
511                             if($st ored[0] !=  "/") $sto red = "/". $stored;                                                    511                             if($st ored[0] !=  "/") $sto red = "/". $stored;                                                 
512                             $pathP os = strpo s($stored,  $localPat h);   512                             $pathP os = strpo s($stored,  $localPat h);
513                             if($pa thPos !==  false){   513                             if($pa thPos !==  false){
514                                      $afterPa th = subst r($stored,  $pathPos+ strlen($lo calPath));   514                                      $afterPa th = subst r($stored,  $pathPos+ strlen($lo calPath));
515                                      if($afte rPath != " " && strpo s($afterPa th, "/")== = false ||  strpos($a fterPath,  "/") == st rlen($afte rPath)-1){   515                                      if($afte rPath != " " && strpo s($afterPa th, "/")== = false ||  strpos($a fterPath,  "/") == st rlen($afte rPath)-1){
516                                               $item["fil ename"] =  $zipPath.$ localPath. $afterPath ;   516                                               $item["fil ename"] =  $zipPath.$ localPath. $afterPath ;
517                                               if($item[" folder"]){   517                                               if($item[" folder"]){
518                                                       $f ilteredLis t[] = $ite m;   518                                                       $f ilteredLis t[] = $ite m;
519                                               }else{   519                                               }else{
520                                                       $f iles[] = $ item;   520                                                       $f iles[] = $ item;
521                                               }   521                                               }
522                                      }   522                                      }
523                                         523                                      
524                             }   524                             }
525                    }   525                    }
526                    $fil teredList  = array_me rge($filte redList, $ files);   526                    $fil teredList  = array_me rge($filte redList, $ files);
527                    retu rn $crtZip ;            527                    retu rn $crtZip ;         
528           }   528           }
529              529           
530           fu nction ini tName($dir )   530           fu nction ini tName($dir )
531           {   531           {
532                    $rac ine = $thi s->getPath ();                 532                    $rac ine = $thi s->getPath ();              
533                    $mes s = ConfSe rvice::get Messages() ;   533                    $mes s = ConfSe rvice::get Messages() ;
534                    if(! isset($dir ) || $dir= ="" || $di r == "/")   534                    if(! isset($dir ) || $dir= ="" || $di r == "/")
535                    {   535                    {
536                             $nom_r ep=$racine ;   536                             $nom_r ep=$racine ;
537                    }   537                    }
538                    else   538                    else
539                    {   539                    {
540                             $nom_r ep="$racin e/$dir";   540                             $nom_r ep="$racin e/$dir";
541                    }   541                    }
542                    if(! file_exist s($racine) )   542                    if(! file_exist s($racine) )
543                    {   543                    {
544                             return  new AJXP_ Exception( 72);   544                             return  new AJXP_ Exception( 72);
545                    }   545                    }
546                    if(! is_dir($no m_rep))   546                    if(! is_dir($no m_rep))
547                    {   547                    {
548                             return  new AJXP_ Exception( 100);   548                             return  new AJXP_ Exception( 100);
549                    }   549                    }
550                    retu rn $nom_re p;   550                    retu rn $nom_re p;
551           }   551           }
552              552           
553           fu nction rea dFile($fil ePathOrDat a, $header Type="plai n", $local Name="", $ data=false , $gzip=GZ IP_DOWNLOA D)   553           fu nction rea dFile($fil ePathOrDat a, $header Type="plai n", $local Name="", $ data=false , $gzip=GZ IP_DOWNLOA D)
554           {   554           {
555                    $siz e = ($data ?strlen($f ilePathOrD ata):files ize($fileP athOrData) );   555                    $siz e = ($data ?strlen($f ilePathOrD ata):files ize($fileP athOrData) );
556                    if(! $data && $ size < 0){   556                    if(! $data && $ size < 0){
557                             // fix  files abo ve 2Gb    557                             // fix  files abo ve 2Gb 
558                             $size  = sprintf( "%u", $siz e);   558                             $size  = sprintf( "%u", $siz e);
559                    }   559                    }
560                    if($ gzip && ($ size > GZI P_LIMIT ||  !function _exists("g zencode")  || @strpos ($_SERVER[ 'HTTP_ACCE PT_ENCODIN G'], 'gzip ') === FAL SE)){   560                    if($ gzip && ($ size > GZI P_LIMIT ||  !function _exists("g zencode")  || @strpos ($_SERVER[ 'HTTP_ACCE PT_ENCODIN G'], 'gzip ') === FAL SE)){
561                             $gzip  = false; / / disable  gzip   561                             $gzip  = false; / / disable  gzip
562                    }   562                    }
563                    $loc alName = ( $localName ==""?basen ame($fileP athOrData) :$localNam e);   563                    $loc alName = ( $localName ==""?basen ame($fileP athOrData) :$localNam e);
564                    if($ headerType  == "plain ")   564                    if($ headerType  == "plain ")
565                    {   565                    {
566                             header ("Content- type:text/ plain");                           566                             header ("Content- type:text/ plain");                        
567                    }   567                    }
568                    else  if($heade rType == " image")   568                    else  if($heade rType == " image")
569                    {   569                    {
570                             //$siz e=filesize ($filePath OrData);   570                             //$siz e=filesize ($filePath OrData);
571                             header ("Content- Type: ".Ut ils::getIm ageMimeTyp e(basename ($filePath OrData))." ; name=\"" .basename( $filePathO rData)."\" ");   571                             header ("Content- Type: ".Ut ils::getIm ageMimeTyp e(basename ($filePath OrData))." ; name=\"" .basename( $filePathO rData)."\" ");
572                             header ("Content- Length: ". $size);   572                             header ("Content- Length: ". $size);
573                             header ('Cache-Co ntrol: pub lic');                             573                             header ('Cache-Co ntrol: pub lic');                          
574                    }   574                    }
575                    else  if($heade rType == " mp3")   575                    else  if($heade rType == " mp3")
576                    {   576                    {
577                             //$siz e=filesize ($filePath OrData);   577                             //$siz e=filesize ($filePath OrData);
578                             header ("Content- Type: audi o/mp3; nam e=\"".base name($file PathOrData )."\"");   578                             header ("Content- Type: audi o/mp3; nam e=\"".base name($file PathOrData )."\"");
579                             header ("Content- Length: ". $size);   579                             header ("Content- Length: ". $size);
580                    }   580                    }
581                    else     581                    else  
582                    {   582                    {
583                             //$siz e=filesize ($filePath OrData);   583                             //$siz e=filesize ($filePath OrData);
584                             //if($ localName  == "") $lo calName =  basename($ filePathOr Data);   584                             //if($ localName  == "") $lo calName =  basename($ filePathOr Data);
585                             header ("Content- Type: appl ication/fo rce-downlo ad; name=\ "".$localN ame."\"");   585                             header ("Content- Type: appl ication/fo rce-downlo ad; name=\ "".$localN ame."\"");
586                             header ("Content- Transfer-E ncoding: b inary");   586                             header ("Content- Transfer-E ncoding: b inary");
587                             if($gz ip){   587                             if($gz ip){
588                                      header(" Content-En coding: gz ip");   588                                      header(" Content-En coding: gz ip");
589                                      // If gz ip, recomp ute data s ize!   589                                      // If gz ip, recomp ute data s ize!
590                                      $gzipped Data = ($d ata?gzenco de($filePa thOrData,9 ):gzencode (file_get_ contents($ filePathOr Data), 9)) ;   590                                      $gzipped Data = ($d ata?gzenco de($filePa thOrData,9 ):gzencode (file_get_ contents($ filePathOr Data), 9)) ;
591                                      $size =  strlen($gz ippedData) ;   591                                      $size =  strlen($gz ippedData) ;
592                             }   592                             }
593                             header ("Content- Length: ". $size);   593                             header ("Content- Length: ". $size);
594                             
header("Co ntent-Disp osition: a ttachment;  filename= \"".$local Name."\"") ;
  594                              // header("Co ntent-Disp osition: a ttachment;  filename= \"".$local Name."\"") ;
        595                             header ("Content- Dispositio n: attachm ent; filen ame=\"".(( preg_match ('/ MSIE / ',$_SERVER ['HTTP_USE R_AGENT']) )?rawurlen code($loca lName):$lo calName)." \"");
595                             header ("Expires:  0");   596                             header ("Expires:  0");
596                             header ("Cache-Co ntrol: no- cache, mus t-revalida te");   597                             header ("Cache-Co ntrol: no- cache, mus t-revalida te");
597                             header ("Pragma:  no-cache") ;   598                             header ("Pragma:  no-cache") ;
598                             // For  SSL websi tes there  is a bug w ith IE see  article K B 323308   599                             // For  SSL websi tes there  is a bug w ith IE see  article K B 323308
599                             // the refore we  must reset  the Cache -Control a nd Pragma  Header   600                             // the refore we  must reset  the Cache -Control a nd Pragma  Header
600                             if (Co nfService: :getConf(" USE_HTTPS" )==1 && pr eg_match(' / MSIE /', $_SERVER[' HTTP_USER_ AGENT']))   601                             if (Co nfService: :getConf(" USE_HTTPS" )==1 && pr eg_match(' / MSIE /', $_SERVER[' HTTP_USER_ AGENT']))
601                             {   602                             {
602                                      header(" Cache-Cont rol:");   603                                      header(" Cache-Cont rol:");
603                                      header(" Pragma:");   604                                      header(" Pragma:");
604                             }   605                             }
605                             if($gz ip){   606                             if($gz ip){
606                                      print $g zippedData ;   607                                      print $g zippedData ;
607                                      return ;   608                                      return ;
608                             }   609                             }
609                    }   610                    }
610                    if($ data){   611                    if($ data){
611                             print( $filePathO rData);   612                             print( $filePathO rData);
612                    }els e{   613                    }els e{
613                             readfi le($filePa thOrData);   614                             readfi le($filePa thOrData);
614                    }   615                    }
615           }   616           }
616              617           
617              618           
618           fu nction lis ting($nom_ rep, $dir_ only = fal se)   619           fu nction lis ting($nom_ rep, $dir_ only = fal se)
619           {   620           {
620                    $siz e_unit = C onfService ::getConf( "SIZE_UNIT ");   621                    $siz e_unit = C onfService ::getConf( "SIZE_UNIT ");
621                    $sen s = 0;   622                    $sen s = 0;
622                    $ord re = "nom" ;   623                    $ord re = "nom" ;
623                    $poi dstotal=0;   624                    $poi dstotal=0;
624                    $han dle=opendi r($nom_rep );   625                    $han dle=opendi r($nom_rep );
625                    $rec ycle = $th is->reposi tory->getO ption("REC YCLE_BIN") ;   626                    $rec ycle = $th is->reposi tory->getO ption("REC YCLE_BIN") ;
626                    whil e ($file =  readdir($ handle))   627                    whil e ($file =  readdir($ handle))
627                    {   628                    {
628                             if($fi le!="." &&  $file!=". ." && Util s::showHid denFiles($ file)==1)   629                             if($fi le!="." &&  $file!=". ." && Util s::showHid denFiles($ file)==1)
629                             {   630                             {
630                                      if($recy cle != ""    631                                      if($recy cle != "" 
631                                               && $nom_re p == $this ->reposito ry->getOpt ion("PATH" )."/".$rec ycle    632                                               && $nom_re p == $this ->reposito ry->getOpt ion("PATH" )."/".$rec ycle 
632                                               && $file = = RecycleB inManager: :getCacheF ileName()) {   633                                               && $file = = RecycleB inManager: :getCacheF ileName()) {
633                                               continue;   634                                               continue;
634                                      }   635                                      }
635                                      $poidsfi c=filesize ("$nom_rep /$file");   636                                      $poidsfi c=filesize ("$nom_rep /$file");
636                                      $poidsto tal+=$poid sfic;   637                                      $poidsto tal+=$poid sfic;
637                                      if(is_di r("$nom_re p/$file"))   638                                      if(is_di r("$nom_re p/$file"))
638                                      {                                              639                                      {                                           
639                                               if($recycl e != "" &&  $this->ge tPath()."/ ".$recycle  == "$nom_ rep/$file" )   640                                               if($recycl e != "" &&  $this->ge tPath()."/ ".$recycle  == "$nom_ rep/$file" )
640                                               {   641                                               {
641                                                       co ntinue;   642                                                       co ntinue;
642                                               }   643                                               }
643                                               if($ordre= ="mod") {$ liste_rep[ $file]=fil emtime("$n om_rep/$fi le");}   644                                               if($ordre= ="mod") {$ liste_rep[ $file]=fil emtime("$n om_rep/$fi le");}
644                                               else {$lis te_rep[$fi le]=$file; }   645                                               else {$lis te_rep[$fi le]=$file; }
645                                      }   646                                      }
646                                      else   647                                      else
647                                      {   648                                      {
648                                               if(!$dir_o nly)   649                                               if(!$dir_o nly)
649                                               {   650                                               {
650                                                       if ($ordre==" nom") {$li ste_fic[$f ile]=Utils ::mimetype ("$nom_rep /$file","i mage", is_ dir("$nom_ rep/$file" ));}   651                                                       if ($ordre==" nom") {$li ste_fic[$f ile]=Utils ::mimetype ("$nom_rep /$file","i mage", is_ dir("$nom_ rep/$file" ));}
651                                                       el se if($ord re=="taill e") {$list e_fic[$fil e]=$poidsf ic;}   652                                                       el se if($ord re=="taill e") {$list e_fic[$fil e]=$poidsf ic;}
652                                                       el se if($ord re=="mod")  {$liste_f ic[$file]= filemtime( "$nom_rep/ $file");}   653                                                       el se if($ord re=="mod")  {$liste_f ic[$file]= filemtime( "$nom_rep/ $file");}
653                                                       el se if($ord re=="type" ) {$liste_ fic[$file] =Utils::mi metype("$n om_rep/$fi le","type" ,is_dir("$ nom_rep/$f ile"));}   654                                                       el se if($ord re=="type" ) {$liste_ fic[$file] =Utils::mi metype("$n om_rep/$fi le","type" ,is_dir("$ nom_rep/$f ile"));}
654                                                       el se {$liste _fic[$file ]=Utils::m imetype("$ nom_rep/$f ile","imag e", is_dir ("$nom_rep /$file")); }   655                                                       el se {$liste _fic[$file ]=Utils::m imetype("$ nom_rep/$f ile","imag e", is_dir ("$nom_rep /$file")); }
655                                               }   656                                               }
656                                               else if(er egi("\.zip $",$file)  && ConfSer vice::zipE nabled()){   657                                               else if(er egi("\.zip $",$file)  && ConfSer vice::zipE nabled()){
657                                                       if (!isSet($l iste_zip))  $liste_zi p = array( );   658                                                       if (!isSet($l iste_zip))  $liste_zi p = array( );
658                                                       $l iste_zip[$ file] = $f ile;   659                                                       $l iste_zip[$ file] = $f ile;
659                                               }   660                                               }
660                                      }   661                                      }
661                             }   662                             }
662                    }   663                    }
663                    clos edir($hand le);   664                    clos edir($hand le);
664              665           
665                    if(i sset($list e_fic) &&  is_array($ liste_fic) )   666                    if(i sset($list e_fic) &&  is_array($ liste_fic) )
666                    {   667                    {
667                             if($or dre=="nom" ) {if($sen s==0){ksor t($liste_f ic);}else{ krsort($li ste_fic);} }   668                             if($or dre=="nom" ) {if($sen s==0){ksor t($liste_f ic);}else{ krsort($li ste_fic);} }
668                             else i f($ordre== "mod") {if ($sens==0) {arsort($l iste_fic); }else{asor t($liste_f ic);}}   669                             else i f($ordre== "mod") {if ($sens==0) {arsort($l iste_fic); }else{asor t($liste_f ic);}}
669                             else i f($ordre== "taille"|| $ordre=="t ype") {if( $sens==0){ asort($lis te_fic);}e lse{arsort ($liste_fi c);}}   670                             else i f($ordre== "taille"|| $ordre=="t ype") {if( $sens==0){ asort($lis te_fic);}e lse{arsort ($liste_fi c);}}
670                             else { if($sens== 0){ksort($ liste_fic) ;}else{krs ort($liste _fic);}}   671                             else { if($sens== 0){ksort($ liste_fic) ;}else{krs ort($liste _fic);}}
671                    }   672                    }
672                    else   673                    else
673                    {   674                    {
674                             $liste _fic = arr ay();   675                             $liste _fic = arr ay();
675                    }   676                    }
676                    if(i sset($list e_rep) &&  is_array($ liste_rep) )   677                    if(i sset($list e_rep) &&  is_array($ liste_rep) )
677                    {   678                    {
678                             if($or dre=="mod" ) {if($sen s==0){arso rt($liste_ rep);}else {asort($li ste_rep);} }   679                             if($or dre=="mod" ) {if($sen s==0){arso rt($liste_ rep);}else {asort($li ste_rep);} }
679                             else { if($sens== 0){ksort($ liste_rep) ;}else{krs ort($liste _rep);}}   680                             else { if($sens== 0){ksort($ liste_rep) ;}else{krs ort($liste _rep);}}
680                    }   681                    }
681                    else  ($liste_r ep = array ());   682                    else  ($liste_r ep = array ());
682              683           
683                    $lis te = Utils ::mergeArr ays($liste _rep,$list e_fic);   684                    $lis te = Utils ::mergeArr ays($liste _rep,$list e_fic);
684                    if(i sSet($list e_zip)){   685                    if(i sSet($list e_zip)){
685                             $liste  = Utils:: mergeArray s($liste,$ liste_zip) ;   686                             $liste  = Utils:: mergeArray s($liste,$ liste_zip) ;
686                    }   687                    }
687                    if ( $poidstota l >= 10737 41824) {$p oidstotal  = round($p oidstotal  / 10737418 24 * 100)  / 100 . "  G".$size_u nit;}   688                    if ( $poidstota l >= 10737 41824) {$p oidstotal  = round($p oidstotal  / 10737418 24 * 100)  / 100 . "  G".$size_u nit;}
688                    else if ($poids total >= 1 048576) {$ poidstotal  = round($ poidstotal  / 1048576  * 100) /  100 . " M" .$size_uni t;}   689                    else if ($poids total >= 1 048576) {$ poidstotal  = round($ poidstotal  / 1048576  * 100) /  100 . " M" .$size_uni t;}
689                    else if ($poids total >= 1 024) {$poi dstotal =  round($poi dstotal /  1024 * 100 ) / 100 .  " K".$size _unit;}   690                    else if ($poids total >= 1 024) {$poi dstotal =  round($poi dstotal /  1024 * 100 ) / 100 .  " K".$size _unit;}
690                    else  {$poidsto tal = $poi dstotal .  " ".$size_ unit;}   691                    else  {$poidsto tal = $poi dstotal .  " ".$size_ unit;}
691              692           
692                    retu rn array($ liste,$poi dstotal);   693                    retu rn array($ liste,$poi dstotal);
693           }   694           }
694              695           
695           fu nction dat e_modif($f ile)   696           fu nction dat e_modif($f ile)
696           {   697           {
697                    $tmp  = filemti me($file);   698                    $tmp  = filemti me($file);
698                    retu rn date("d /m/Y H:i", $tmp);   699                    retu rn date("d /m/Y H:i", $tmp);
699           }   700           }
700              701           
701           fu nction cop yOrMove($d estDir, $s electedFil es, &$erro r, &$succe ss, $move  = false)   702           fu nction cop yOrMove($d estDir, $s electedFil es, &$erro r, &$succe ss, $move  = false)
702           {   703           {
703                    $mes s = ConfSe rvice::get Messages() ;   704                    $mes s = ConfSe rvice::get Messages() ;
704                    if(! is_writabl e($this->g etPath()." /".$destDi r))   705                    if(! is_writabl e($this->g etPath()." /".$destDi r))
705                    {   706                    {
706                             $error [] = $mess [38]." ".$ destDir."  ".$mess[99 ];   707                             $error [] = $mess [38]." ".$ destDir."  ".$mess[99 ];
707                             return  ;   708                             return  ;
708                    }   709                    }
709                                         710                                      
710                    fore ach ($sele ctedFiles  as $select edFile)   711                    fore ach ($sele ctedFiles  as $select edFile)
711                    {   712                    {
712                             if($mo ve && !is_ writable(d irname($th is->getPat h()."/".$s electedFil e)))   713                             if($mo ve && !is_ writable(d irname($th is->getPat h()."/".$s electedFil e)))
713                             {   714                             {
714                                      $error[]  = "\n".$m ess[38]."  ".dirname( $selectedF ile)." ".$ mess[99];   715                                      $error[]  = "\n".$m ess[38]."  ".dirname( $selectedF ile)." ".$ mess[99];
715                                      continue ;   716                                      continue ;
716                             }   717                             }
717                             $this- >copyOrMov eFile($des tDir, $sel ectedFile,  $error, $ success, $ move);   718                             $this- >copyOrMov eFile($des tDir, $sel ectedFile,  $error, $ success, $ move);
718                    }   719                    }
719           }   720           }
720              721           
721           fu nction ren ameAction( $actionNam e, $httpVa rs)   722           fu nction ren ameAction( $actionNam e, $httpVa rs)
722           {   723           {
723                    $fil ePath = Sy stemTextEn coding::fr omUTF8($ht tpVars["fi le"]);   724                    $fil ePath = Sy stemTextEn coding::fr omUTF8($ht tpVars["fi le"]);
724                    $new Filename =  SystemTex tEncoding: :fromUTF8( $httpVars[ "filename_ new"]);   725                    $new Filename =  SystemTex tEncoding: :fromUTF8( $httpVars[ "filename_ new"]);
725                    retu rn $this-> rename($fi lePath, $n ewFilename );   726                    retu rn $this-> rename($fi lePath, $n ewFilename );
726           }   727           }
727              728           
728           fu nction ren ame($fileP ath, $file name_new)   729           fu nction ren ame($fileP ath, $file name_new)
729           {   730           {
730                    $nom _fic=basen ame($fileP ath);   731                    $nom _fic=basen ame($fileP ath);
731                    $mes s = ConfSe rvice::get Messages() ;   732                    $mes s = ConfSe rvice::get Messages() ;
732                    $fil ename_new= Utils::pro cessFileNa me($filena me_new);   733                    $fil ename_new= Utils::pro cessFileNa me($filena me_new);
733                    $old =$this->ge tPath()."/ $filePath" ;   734                    $old =$this->ge tPath()."/ $filePath" ;
734                    if(! is_writabl e($old))   735                    if(! is_writabl e($old))
735                    {   736                    {
736                             return  $mess[34] ." ".$nom_ fic." ".$m ess[99];   737                             return  $mess[34] ." ".$nom_ fic." ".$m ess[99];
737                    }   738                    }
738                    $new =dirname($ old)."/".$ filename_n ew;   739                    $new =dirname($ old)."/".$ filename_n ew;
739                    if($ filename_n ew=="")   740                    if($ filename_n ew=="")
740                    {   741                    {
741                             return  "$mess[37 ]";   742                             return  "$mess[37 ]";
742                    }   743                    }
743                    if(f ile_exists ($new))   744                    if(f ile_exists ($new))
744                    {   745                    {
745                             return  "$filenam e_new $mes s[43]";    746                             return  "$filenam e_new $mes s[43]"; 
746                    }   747                    }
747                    if(! file_exist s($old))   748                    if(! file_exist s($old))
748                    {   749                    {
749                             return  $mess[100 ]." $nom_f ic";   750                             return  $mess[100 ]." $nom_f ic";
750                    }   751                    }
751                    rena me($old,$n ew);   752                    rena me($old,$n ew);
752                    retu rn null;                753                    retu rn null;             
753           }   754           }
754              755           
755           fu nction aut oRenameFor Dest($dest ination, $ fileName){   756           fu nction aut oRenameFor Dest($dest ination, $ fileName){
756                    if(! is_file($d estination ."/".$file Name)) ret urn $fileN ame;   757                    if(! is_file($d estination ."/".$file Name)) ret urn $fileN ame;
757                    $i =  1;   758                    $i =  1;
758                    $ext  = "";   759                    $ext  = "";
759                    $nam e = "";   760                    $nam e = "";
760                    $spl it = split ("\.", $fi leName);   761                    $spl it = split ("\.", $fi leName);
761                    if(c ount($spli t) > 1){   762                    if(c ount($spli t) > 1){
762                             $ext =  ".".$spli t[count($s plit)-1];   763                             $ext =  ".".$spli t[count($s plit)-1];
763                             array_ pop($split );   764                             array_ pop($split );
764                             $name  = join("\. ", $split) ;   765                             $name  = join("\. ", $split) ;
765                    }els e{   766                    }els e{
766                             $name  = $fileNam e;   767                             $name  = $fileNam e;
767                    }   768                    }
768                    whil e (is_file ($destinat ion."/".$n ame."-$i". $ext)) {   769                    whil e (is_file ($destinat ion."/".$n ame."-$i". $ext)) {
769                             $i++;  // increme nt i until  finding a  non exist ing file.   770                             $i++;  // increme nt i until  finding a  non exist ing file.
770                    }   771                    }
771                    retu rn $name." -$i".$ext;   772                    retu rn $name." -$i".$ext;
772           }   773           }
773              774           
774           fu nction mkD ir($crtDir , $newDirN ame)   775           fu nction mkD ir($crtDir , $newDirN ame)
775           {   776           {
776                    $mes s = ConfSe rvice::get Messages() ;   777                    $mes s = ConfSe rvice::get Messages() ;
777                    if($ newDirName =="")   778                    if($ newDirName =="")
778                    {   779                    {
779                             return  "$mess[37 ]";   780                             return  "$mess[37 ]";
780                    }   781                    }
781                    if(f ile_exists ($this->ge tPath()."/ $crtDir/$n ewDirName" ))   782                    if(f ile_exists ($this->ge tPath()."/ $crtDir/$n ewDirName" ))
782                    {   783                    {
783                             return  "$mess[40 ]";    784                             return  "$mess[40 ]"; 
784                    }   785                    }
785                    if(! is_writabl e($this->g etPath()." /$crtDir") )   786                    if(! is_writabl e($this->g etPath()." /$crtDir") )
786                    {   787                    {
787                             return  $mess[38] ." $crtDir  ".$mess[9 9];   788                             return  $mess[38] ." $crtDir  ".$mess[9 9];
788                    }   789                    }
789                    mkdi r($this->g etPath()." /$crtDir/$ newDirName ",0775);   790                    mkdi r($this->g etPath()." /$crtDir/$ newDirName ",0775);
790                    retu rn null;                791                    retu rn null;             
791           }   792           }
792              793           
793           fu nction cre ateEmptyFi le($crtDir , $newFile Name)   794           fu nction cre ateEmptyFi le($crtDir , $newFile Name)
794           {   795           {
795                    $mes s = ConfSe rvice::get Messages() ;   796                    $mes s = ConfSe rvice::get Messages() ;
796                    if($ newFileNam e=="")   797                    if($ newFileNam e=="")
797                    {   798                    {
798                             return  "$mess[37 ]";   799                             return  "$mess[37 ]";
799                    }   800                    }
800                    if(f ile_exists ($this->ge tPath()."/ $crtDir/$n ewFileName "))   801                    if(f ile_exists ($this->ge tPath()."/ $crtDir/$n ewFileName "))
801                    {   802                    {
802                             return  "$mess[71 ]";   803                             return  "$mess[71 ]";
803                    }   804                    }
804                    if(! is_writabl e($this->g etPath()." /$crtDir") )   805                    if(! is_writabl e($this->g etPath()." /$crtDir") )
805                    {   806                    {
806                             return  "$mess[38 ] $crtDir  $mess[99]" ;   807                             return  "$mess[38 ] $crtDir  $mess[99]" ;
807                    }   808                    }
808                       809                    
809                    $fp= fopen($thi s->getPath ()."/$crtD ir/$newFil eName","w" );   810                    $fp= fopen($thi s->getPath ()."/$crtD ir/$newFil eName","w" );
810                    if($ fp)   811                    if($ fp)
811                    {   812                    {
812                             if(ere gi("\.html $",$newFil eName)||er egi("\.htm $",$newFil eName))   813                             if(ere gi("\.html $",$newFil eName)||er egi("\.htm $",$newFil eName))
813                             {   814                             {
814                                      fputs($f p,"<html>\ n<head>\n< title>New  Document -  Created B y AjaXplor er</title> \n<meta ht tp-equiv=\ "Content-T ype\" cont ent=\"text /html; cha rset=iso-8 859-1\">\n </head>\n< body bgcol or=\"#FFFF FF\" text= \"#000000\ ">\n\n</bo dy>\n</htm l>\n");   815                                      fputs($f p,"<html>\ n<head>\n< title>New  Document -  Created B y AjaXplor er</title> \n<meta ht tp-equiv=\ "Content-T ype\" cont ent=\"text /html; cha rset=iso-8 859-1\">\n </head>\n< body bgcol or=\"#FFFF FF\" text= \"#000000\ ">\n\n</bo dy>\n</htm l>\n");
815                             }   816                             }
816                             fclose ($fp);   817                             fclose ($fp);
817                             return  null;   818                             return  null;
818                    }   819                    }
819                    else   820                    else
820                    {   821                    {
821                             return  "$mess[10 2] $crtDir /$newFileN ame (".$fp .")";   822                             return  "$mess[10 2] $crtDir /$newFileN ame (".$fp .")";
822                    }                    823                    }                 
823           }   824           }
824              825           
825              826           
826           fu nction del ete($selec tedFiles,  &$logMessa ges)   827           fu nction del ete($selec tedFiles,  &$logMessa ges)
827           {   828           {
828                    $mes s = ConfSe rvice::get Messages() ;   829                    $mes s = ConfSe rvice::get Messages() ;
829                    fore ach ($sele ctedFiles  as $select edFile)   830                    fore ach ($sele ctedFiles  as $select edFile)
830                    {           831                    {        
831                             if($se lectedFile  == "" ||  $selectedF ile == DIR ECTORY_SEP ARATOR)   832                             if($se lectedFile  == "" ||  $selectedF ile == DIR ECTORY_SEP ARATOR)
832                             {   833                             {
833                                      return $ mess[120];   834                                      return $ mess[120];
834                             }   835                             }
835                             $fileT oDelete=$t his->getPa th().$sele ctedFile;   836                             $fileT oDelete=$t his->getPa th().$sele ctedFile;
836                             if(!fi le_exists( $fileToDel ete))   837                             if(!fi le_exists( $fileToDel ete))
837                             {   838                             {
838                                      $logMess ages[]=$me ss[100]."  ".SystemTe xtEncoding ::toUTF8($ selectedFi le);   839                                      $logMess ages[]=$me ss[100]."  ".SystemTe xtEncoding ::toUTF8($ selectedFi le);
839                                      continue ;   840                                      continue ;
840                             }                   841                             }                
841                             $this- >deldir($f ileToDelet e);   842                             $this- >deldir($f ileToDelet e);
842                             if(is_ dir($fileT oDelete))   843                             if(is_ dir($fileT oDelete))
843                             {   844                             {
844                                      $logMess ages[]="$m ess[38] ". SystemText Encoding:: toUTF8($se lectedFile )." $mess[ 44].";   845                                      $logMess ages[]="$m ess[38] ". SystemText Encoding:: toUTF8($se lectedFile )." $mess[ 44].";
845                             }   846                             }
846                             else    847                             else 
847                             {   848                             {
848                                      $logMess ages[]="$m ess[34] ". SystemText Encoding:: toUTF8($se lectedFile )." $mess[ 44].";   849                                      $logMess ages[]="$m ess[34] ". SystemText Encoding:: toUTF8($se lectedFile )." $mess[ 44].";
849                             }   850                             }
850                    }   851                    }
851                    retu rn null;   852                    retu rn null;
852           }   853           }
853              854           
854              855           
855              856           
856           fu nction cop yOrMoveFil e($destDir , $srcFile , &$error,  &$success , $move =  false)   857           fu nction cop yOrMoveFil e($destDir , $srcFile , &$error,  &$success , $move =  false)
857           {   858           {
858                    $mes s = ConfSe rvice::get Messages() ;                 859                    $mes s = ConfSe rvice::get Messages() ;              
859                    $des tFile = $t his->repos itory->get Option("PA TH").$dest Dir."/".ba sename($sr cFile);   860                    $des tFile = $t his->repos itory->get Option("PA TH").$dest Dir."/".ba sename($sr cFile);
860                    $rea lSrcFile =  $this->re pository-> getOption( "PATH")."/ $srcFile";   861                    $rea lSrcFile =  $this->re pository-> getOption( "PATH")."/ $srcFile";
861                    $rec ycle = $th is->reposi tory->getO ption("REC YCLE_BIN") ;            862                    $rec ycle = $th is->reposi tory->getO ption("REC YCLE_BIN") ;         
862                    if(! file_exist s($realSrc File))   863                    if(! file_exist s($realSrc File))
863                    {   864                    {
864                             $error [] = $mess [100].$src File;   865                             $error [] = $mess [100].$src File;
865                             return  ;   866                             return  ;
866                    }   867                    }
867                    if($ realSrcFil e==$destFi le)   868                    if($ realSrcFil e==$destFi le)
868                    {   869                    {
869                             $error [] = $mess [101];   870                             $error [] = $mess [101];
870                             return  ;   871                             return  ;
871                    }   872                    }
872                    if(i s_dir($rea lSrcFile))   873                    if(i s_dir($rea lSrcFile))
873                    {   874                    {
874                             $error s = array( );   875                             $error s = array( );
875                             $succF iles = arr ay();   876                             $succF iles = arr ay();
876                             $dirRe s = $this- >dircopy($ realSrcFil e, $destFi le, $error s, $succFi les);   877                             $dirRe s = $this- >dircopy($ realSrcFil e, $destFi le, $error s, $succFi les);
877                             if(cou nt($errors ))   878                             if(cou nt($errors ))
878                             {   879                             {
879                                      $error[]  = $mess[1 14];   880                                      $error[]  = $mess[1 14];
880                                      return ;   881                                      return ;
881                             }                            882                             }                         
882                    }   883                    }
883                    else     884                    else  
884                    {   885                    {
885                             $res =  copy($rea lSrcFile,$ destFile);   886                             $res =  copy($rea lSrcFile,$ destFile);
886                             if($re s != 1)   887                             if($re s != 1)
887                             {   888                             {
888                                      $error[]  = $mess[1 14];   889                                      $error[]  = $mess[1 14];
889                                      return ;   890                                      return ;
890                             }   891                             }
891                    }   892                    }
892                       893                    
893                    if($ move)   894                    if($ move)
894                    {   895                    {
895                             // Now  delete or iginal   896                             // Now  delete or iginal
896                             $this- >deldir($r ealSrcFile ); // both  file and  dir   897                             $this- >deldir($r ealSrcFile ); // both  file and  dir
897                             $messa gePart = $ mess[74]."  ".SystemT extEncodin g::toUTF8( $destDir);   898                             $messa gePart = $ mess[74]."  ".SystemT extEncodin g::toUTF8( $destDir);
898                             if($de stDir == " /".$recycl e)   899                             if($de stDir == " /".$recycl e)
899                             {   900                             {
900                                      RecycleB inManager: :fileToRec ycle($srcF ile);   901                                      RecycleB inManager: :fileToRec ycle($srcF ile);
901                                      $message Part = $me ss[123]."  ".$mess[12 2];   902                                      $message Part = $me ss[123]."  ".$mess[12 2];
902                             }   903                             }
903                             if(iss et($dirRes ))   904                             if(iss et($dirRes ))
904                             {   905                             {
905                                      $success [] = $mess [117]." ". SystemText Encoding:: toUTF8(bas ename($src File))." " .$messageP art." (".S ystemTextE ncoding::t oUTF8($dir Res)." ".$ mess[116]. ") ";   906                                      $success [] = $mess [117]." ". SystemText Encoding:: toUTF8(bas ename($src File))." " .$messageP art." (".S ystemTextE ncoding::t oUTF8($dir Res)." ".$ mess[116]. ") ";
906                             }   907                             }
907                             else    908                             else 
908                             {   909                             {
909                                      $success [] = $mess [34]." ".S ystemTextE ncoding::t oUTF8(base name($srcF ile))." ". $messagePa rt;   910                                      $success [] = $mess [34]." ".S ystemTextE ncoding::t oUTF8(base name($srcF ile))." ". $messagePa rt;
910                             }   911                             }
911                    }   912                    }
912                    else   913                    else
913                    {                            914                    {                         
914                             if($de stDir == " /".$this-> repository ->getOptio n("RECYCLE _BIN"))   915                             if($de stDir == " /".$this-> repository ->getOptio n("RECYCLE _BIN"))
915                             {   916                             {
916                                      RecycleB inManager: :fileToRec ycle($srcF ile);   917                                      RecycleB inManager: :fileToRec ycle($srcF ile);
917                             }   918                             }
918                             if(isS et($dirRes ))   919                             if(isS et($dirRes ))
919                             {   920                             {
920                                      $success [] = $mess [117]." ". SystemText Encoding:: toUTF8(bas ename($src File))." " .$mess[73] ." ".Syste mTextEncod ing::toUTF 8($destDir )." (".Sys temTextEnc oding::toU TF8($dirRe s)." ".$me ss[116].") ";     921                                      $success [] = $mess [117]." ". SystemText Encoding:: toUTF8(bas ename($src File))." " .$mess[73] ." ".Syste mTextEncod ing::toUTF 8($destDir )." (".Sys temTextEnc oding::toU TF8($dirRe s)." ".$me ss[116].") ";  
921                             }   922                             }
922                             else    923                             else 
923                             {   924                             {
924                                      $success [] = $mess [34]." ".S ystemTextE ncoding::t oUTF8(base name($srcF ile))." ". $mess[73]. " ".System TextEncodi ng::toUTF8 ($destDir) ;   925                                      $success [] = $mess [34]." ".S ystemTextE ncoding::t oUTF8(base name($srcF ile))." ". $mess[73]. " ".System TextEncodi ng::toUTF8 ($destDir) ;
925                             }   926                             }
926                    }   927                    }
927                       928                    
928           }   929           }
929     930  
930           //  A functio n to copy  files from  one direc tory to an other one,  including  subdirect ories and   931           //  A functio n to copy  files from  one direc tory to an other one,  including  subdirect ories and
931           //  nonexisti ng or newe r files. F unction re turns numb er of file s copied.   932           //  nonexisti ng or newe r files. F unction re turns numb er of file s copied.
932           //  This func tion is PH P implemen tation of  Windows xc opy  A:\di r1\* B:\di r2 /D /E / F /H /R /Y   933           //  This func tion is PH P implemen tation of  Windows xc opy  A:\di r1\* B:\di r2 /D /E / F /H /R /Y
933           //  Syntaxis:  [$number  =] dircopy ($sourcedi rectory, $ destinatio ndirectory  [, $verbo se]);   934           //  Syntaxis:  [$number  =] dircopy ($sourcedi rectory, $ destinatio ndirectory  [, $verbo se]);
934           //  Example:  $num = dir copy('A:\d ir1', 'B:\ dir2', 1);   935           //  Example:  $num = dir copy('A:\d ir1', 'B:\ dir2', 1);
935     936  
936           fu nction dir copy($srcd ir, $dstdi r, &$error s, &$succe ss, $verbo se = false   937           fu nction dir copy($srcd ir, $dstdi r, &$error s, &$succe ss, $verbo se = false
937           {   938           {
938                    $num  = 0;   939                    $num  = 0;
939                    if(! is_dir($ds tdir)) mkd ir($dstdir );   940                    if(! is_dir($ds tdir)) mkd ir($dstdir );
940                    if($ curdir = o pendir($sr cdir))    941                    if($ curdir = o pendir($sr cdir)) 
941                    {   942                    {
942                             while( $file = re addir($cur dir))    943                             while( $file = re addir($cur dir)) 
943                             {   944                             {
944                                      if($file  != '.' &&  $file !=  '..')    945                                      if($file  != '.' &&  $file !=  '..') 
945                                      {   946                                      {
946                                               $srcfile =  $srcdir .  DIRECTORY _SEPARATOR  . $file;   947                                               $srcfile =  $srcdir .  DIRECTORY _SEPARATOR  . $file;
947                                               $dstfile =  $dstdir .  DIRECTORY _SEPARATOR  . $file;   948                                               $dstfile =  $dstdir .  DIRECTORY _SEPARATOR  . $file;
948                                               if(is_file ($srcfile)   949                                               if(is_file ($srcfile)
949                                               {   950                                               {
950                                                       if (is_file($ dstfile))  $ow = file mtime($src file) - fi lemtime($d stfile); e lse $ow =  1;   951                                                       if (is_file($ dstfile))  $ow = file mtime($src file) - fi lemtime($d stfile); e lse $ow =  1;
951                                                       if ($ow > 0)    952                                                       if ($ow > 0) 
952                                                       {   953                                                       {
953                                                                if($ verbose) e cho "Copyi ng '$srcfi le' to '$d stfile'... ";   954                                                                if($ verbose) e cho "Copyi ng '$srcfi le' to '$d stfile'... ";
954                                                                if(c opy($srcfi le, $dstfi le))    955                                                                if(c opy($srcfi le, $dstfi le)) 
955                                                                {   956                                                                {
956                                                                         touch( $dstfile,  filemtime( $srcfile)) ; $num++;   957                                                                         touch( $dstfile,  filemtime( $srcfile)) ; $num++;
957                                                                         if($ve rbose) ech o "OK\n";   958                                                                         if($ve rbose) ech o "OK\n";
958                                                                         $succe ss[] = $sr cfile;   959                                                                         $succe ss[] = $sr cfile;
959                                                                }   960                                                                }
960                                                                else     961                                                                else  
961                                                                {   962                                                                {
962                                                                         $error s[] = $src file;   963                                                                         $error s[] = $src file;
963                                                                }   964                                                                }
964                                                       }   965                                                       }
965                                               }   966                                               }
966                                               else if(is _dir($srcf ile))    967                                               else if(is _dir($srcf ile)) 
967                                               {   968                                               {
968                                                       $n um += $thi s->dircopy ($srcfile,  $dstfile,  $errors,  $success,  $verbose);   969                                                       $n um += $thi s->dircopy ($srcfile,  $dstfile,  $errors,  $success,  $verbose);
969                                               }   970                                               }
970                                      }   971                                      }
971                             }   972                             }
972                             closed ir($curdir );   973                             closed ir($curdir );
973                    }   974                    }
974                    retu rn $num;   975                    retu rn $num;
975           }   976           }
976              977           
977           fu nction sim pleCopy($o rigFile, $ destFile)   978           fu nction sim pleCopy($o rigFile, $ destFile)
978           {   979           {
979                    retu rn copy($o rigFile, $ destFile);   980                    retu rn copy($o rigFile, $ destFile);
980           }   981           }
981              982           
982           fu nction isW riteable($ dir)   983           fu nction isW riteable($ dir)
983           {   984           {
984                    retu rn is_writ able($dir) ;   985                    retu rn is_writ able($dir) ;
985           }   986           }
986              987           
987           fu nction del dir($locat ion)   988           fu nction del dir($locat ion)
988           {   989           {
989                    if(i s_dir($loc ation))   990                    if(i s_dir($loc ation))
990                    {   991                    {
991                             $all=o pendir($lo cation);   992                             $all=o pendir($lo cation);
992                             while  ($file=rea ddir($all) )   993                             while  ($file=rea ddir($all) )
993                             {   994                             {
994                                      if (is_d ir("$locat ion/$file" ) && $file  !=".." &&  $file!=". ")   995                                      if (is_d ir("$locat ion/$file" ) && $file  !=".." &&  $file!=". ")
995                                      {   996                                      {
996                                               $this->del dir("$loca tion/$file ");   997                                               $this->del dir("$loca tion/$file ");
997                                               if(file_ex ists("$loc ation/$fil e")){rmdir ("$locatio n/$file");  }   998                                               if(file_ex ists("$loc ation/$fil e")){rmdir ("$locatio n/$file");  }
998                                               unset($fil e);   999                                               unset($fil e);
999                                      }   1000                                      }
1000                                      elseif ( !is_dir("$ location/$ file"))   1001                                      elseif ( !is_dir("$ location/$ file"))
1001                                      {   1002                                      {
1002                                               if(file_ex ists("$loc ation/$fil e")){unlin k("$locati on/$file") ; }   1003                                               if(file_ex ists("$loc ation/$fil e")){unlin k("$locati on/$file") ; }
1003                                               unset($fil e);   1004                                               unset($fil e);
1004                                      }   1005                                      }
1005                             }   1006                             }
1006                             closed ir($all);   1007                             closed ir($all);
1007                             rmdir( $location) ;   1008                             rmdir( $location) ;
1008                    }   1009                    }
1009                    else   1010                    else
1010                    {   1011                    {
1011                             if(fil e_exists(" $location" )) {unlink ("$locatio n");}   1012                             if(fil e_exists(" $location" )) {unlink ("$locatio n");}
1012                    }   1013                    }
1013                    if(b asename(di rname($loc ation)) ==  $this->re pository-> getOption( "RECYCLE_B IN"))   1014                    if(b asename(di rname($loc ation)) ==  $this->re pository-> getOption( "RECYCLE_B IN"))
1014                    {   1015                    {
1015                             // DEL ETING FROM  RECYCLE   1016                             // DEL ETING FROM  RECYCLE
1016                             Recycl eBinManage r::deleteF romRecycle ($location );   1017                             Recycl eBinManage r::deleteF romRecycle ($location );
1017                    }   1018                    }
1018           }   1019           }
1019              1020           
1020           /* *   1021           /* *
1021            *  @return z ipfile   1022            *  @return z ipfile
1022            *   1023            *
1023       functi on makeZip  ($src, $d est, $base dir)   1024       functi on makeZip  ($src, $d est, $base dir)
1024       {   1025       {
1025           se t_time_lim it(60);   1026           se t_time_lim it(60);
1026           re quire_once (SERVER_RE SOURCES_FO LDER."/pcl zip.lib.ph p");   1027           re quire_once (SERVER_RE SOURCES_FO LDER."/pcl zip.lib.ph p");
1027           $f ilePaths =  array();   1028           $f ilePaths =  array();
1028           $t otalSize =  0;   1029           $t otalSize =  0;
1029           fo reach ($sr c as $item ){   1030           fo reach ($sr c as $item ){
1030                    $fil ePaths[] =  array(PCL ZIP_ATT_FI LE_NAME =>  $this->ge tPath().$i tem,    1031                    $fil ePaths[] =  array(PCL ZIP_ATT_FI LE_NAME =>  $this->ge tPath().$i tem, 
1031                                                                 PCL ZIP_ATT_FI LE_NEW_SHO RT_NAME =>  basename( $item));   1032                                                                 PCL ZIP_ATT_FI LE_NEW_SHO RT_NAME =>  basename( $item));
1032           }   1033           }
1033           $a rchive = n ew PclZip( $dest);   1034           $a rchive = n ew PclZip( $dest);
1034           $v List = $ar chive->cre ate($fileP aths, PCLZ IP_OPT_REM OVE_PATH,  $this->get Path().$ba sedir, PCL ZIP_OPT_NO _COMPRESSI ON);   1035           $v List = $ar chive->cre ate($fileP aths, PCLZ IP_OPT_REM OVE_PATH,  $this->get Path().$ba sedir, PCL ZIP_OPT_NO _COMPRESSI ON);
1035           if ($vList ==  0) return  false;   1036           if ($vList ==  0) return  false;
1036       }   1037       }
1037          1038       
1038          1039       
1039       /**   1040       /**
1040        * @pa ram $selec tion UserS election   1041        * @pa ram $selec tion UserS election
1041        */   1042        */
1042       functi on convert SelectionT oTmpFiles( $tmpDir, & $selection ){   1043       functi on convert SelectionT oTmpFiles( $tmpDir, & $selection ){
1043           $z ipPath = $ selection- >getZipPat h();   1044           $z ipPath = $ selection- >getZipPat h();
1044           $l ocalDir =  $selection ->getZipLo calPath();   1045           $l ocalDir =  $selection ->getZipLo calPath();
1045           $f iles = $se lection->g etFiles();   1046           $f iles = $se lection->g etFiles();
1046           fo reach ($fi les as $ke y => $item ){// Remov e path   1047           fo reach ($fi les as $ke y => $item ){// Remov e path
1047                    $ite m = substr ($item, st rlen($zipP ath));   1048                    $ite m = substr ($item, st rlen($zipP ath));
1048                    if($ item[0] ==  "/") $ite m = substr ($item, 1) ;   1049                    if($ item[0] ==  "/") $ite m = substr ($item, 1) ;
1049                    $fil es[$key] =  $item;   1050                    $fil es[$key] =  $item;
1050           }   1051           }
1051           re quire_once ("server/c lasses/pcl zip.lib.ph p");   1052           re quire_once ("server/c lasses/pcl zip.lib.ph p");
1052           $z ip = new P clZip($thi s->getPath ().$zipPat h);   1053           $z ip = new P clZip($thi s->getPath ().$zipPat h);
1053           $e rr = $zip- >extract(P CLZIP_OPT_ BY_NAME, $ files,    1054           $e rr = $zip- >extract(P CLZIP_OPT_ BY_NAME, $ files, 
1054                                        PCLZIP _OPT_PATH,  $this->ge tPath()."/ ".$tmpDir) ;   1055                                        PCLZIP _OPT_PATH,  $this->ge tPath()."/ ".$tmpDir) ;
1055           fo reach ($fi les as $ke y => $item ){// Remov e path   1056           fo reach ($fi les as $ke y => $item ){// Remov e path
1056                    $fil es[$key] =  $tmpDir." /".$item;   1057                    $fil es[$key] =  $tmpDir." /".$item;
1057           }   1058           }
1058           $s election-> setFiles($ files);   1059           $s election-> setFiles($ files);
1059       }   1060       }
1060          1061       
1061   }   1062   }
1062     1063  
1063   ?>   1064   ?>