[ PHPXref.com ] [ Generated: Sun Jul 20 19:16:27 2008 ] [ Owl Intranet 0.82 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> view.php (source)

   1  <?php
   2  
   3  /**
   4   * view.php
   5   * 
   6   * Copyright (c) 1999-2003 The Owl Project Team
   7   * Licensed under the GNU GPL. For full terms see the file COPYING.
   8   * 
   9   * $Id: view.php,v 1.10 2005/06/16 18:35:58 b0zz Exp $
  10   */
  11  
  12  require_once ("./config/owl.php");
  13  require_once ("./lib/disp.lib.php");
  14  require_once ("./lib/owl.lib.php");
  15  require_once ("./lib/security.lib.php");
  16  require_once ("./phpid3v2/class.id3.php");
  17  
  18  if ($sess == "0" && $default->anon_ro == 1)
  19  {
  20     printError($owl_lang->err_login);
  21  }
  22  
  23  // BEGIN what Richard Bartz added to show PDF, DOC, and TXT special view
  24  // While I was at it I added xls, mp3, and ppt.
  25  
  26  if ($action == "pdf_show" || $action == "xls_show" || $action == "doc_show" || $action == "ppt_show" || $action == "mp3_play" or $action == "inline")
  27  {
  28     if (check_auth($id, "file_download", $userid) == 1)
  29     {
  30        if ($default->owl_use_fs)
  31        {
  32           $fid = fGetPhysicalFileId($id);
  33           $path = $default->owl_FileDir . "/" . find_path(owlfileparent($fid)) . "/" . flid_to_filename($fid);
  34           //$path = $default->owl_FileDir . "/" . find_path($parent) . "/" . flid_to_filename($id);
  35        } 
  36        else
  37        {
  38           $uncomptmpfile = $default->owl_tmpdir . "/owltmp.$id.$sess";
  39           $getfile = new Owl_DB;
  40           $getfile->query("select data,compressed from $default->owl_files_data_table where id='$id'");
  41           while ($getfile->next_record())
  42           {
  43              if ($getfile->f("compressed"))
  44              {
  45                 $tmpfile = $default->owl_tmpdir . "/owltmp.$id.$sess.gz";
  46                 if ($default->debug)
  47                 {
  48                    if (!file_exists($default->owl_tmpdir))
  49                    {
  50                       printError("$owl_lang->debug_tmp_not_exists");
  51                    } 
  52                    if (!is_writable($default->owl_tmpdir))
  53                    {
  54                       printError("$owl_lang->debug_tmp_not_writeable");
  55                    } 
  56                 } 
  57                 if (file_exists($tmpfile)) unlink($tmpfile);
  58  
  59                 $fp = fopen($tmpfile, "wb");
  60                 fwrite($fp, $getfile->f("data"));
  61                 fclose($fp);
  62  
  63                 system($default->gzip_path . " -df $tmpfile");
  64  
  65                 $fsize = filesize($uncomptmpfile);
  66                 $fd = fopen($uncomptmpfile, 'rb');
  67                 $filedata = fread($fd, $fsize);
  68                 fclose($fd);
  69              } 
  70              else
  71              {
  72                 $tmpfile = $default->owl_tmpdir . "/owltmp.$id.$sess";
  73                 if ($default->debug)
  74                 {
  75                    if (!file_exists($default->owl_tmpdir))
  76                    {
  77                       printError("$owl_lang->debug_tmp_not_exists");
  78                    } 
  79                    if (!is_writable($default->owl_tmpdir))
  80                    {
  81                       printError("$owl_lang->debug_tmp_not_writeable");
  82                    } 
  83                 } 
  84                 if (file_exists($tmpfile)) unlink($tmpfile);
  85  
  86                 $fp = fopen($tmpfile, "wb");
  87                 fwrite($fp, $getfile->f("data"));
  88                 fclose($fp);
  89              } 
  90           } 
  91           $path = $uncomptmpfile;
  92        } 
  93     } 
  94     else
  95     {
  96        printError($owl_lang->err_nofileaccess);
  97     } 
  98  } 
  99  
 100  if ($action == "pdf_show" || $action == "xls_show" || $action == "doc_show" || $action == "ppt_show" || $action == "mp3_play" || $action == "inline")
 101  {
 102     $mimetyp = fGetMimeType(flid_to_filename($id));
 103  
 104     $len = filesize($path);
 105     header("Content-type: $mimetyp");
 106     header("Content-Length: $len");
 107     header("Content-Disposition: inline; filename=" . flid_to_filename($id));
 108     readfile($path);
 109     if (!$default->owl_use_fs)
 110     {
 111        unlink($path);
 112     } 
 113     owl_syslog(FILE_VIEWED, $userid, flid_to_filename($id), $parent, "", "FILE");
 114     die;
 115  } 
 116  
 117  // end of what Richard Bartz added to show PDF, DOC, and TXT special view
 118  // cv change for security, should deny documents directory
 119  // added image_show that passes the image through
 120  if ($action != "image_show")
 121  {
 122     include ("./lib/header.inc");
 123     include ("./lib/userheader.inc");
 124     print("<center>\n");
 125  } 
 126  
 127  
 128  switch ($order)
 129  {
 130     case "name":
 131        $sortorder = 'sortname';
 132        break;
 133     case "major_revision":
 134        $sortorder = 'sortver';
 135        break;
 136     case "filename" :
 137        $sortorder = 'sortfilename';
 138        break;
 139     case "size" :
 140        $sortorder = 'sortsize';
 141        break;
 142     case "creatorid" :
 143        $sortorder = 'sortposted';
 144        break;
 145     case "smodified" :
 146        $sortorder = 'sortmod';
 147        break;
 148     case "checked_out":
 149        $sortorder = 'sortcheckedout';
 150        break;
 151     default:
 152        $order= "name";
 153        $sortorder= "sortname";
 154        break;
 155  } 
 156  
 157  if ($action == "image_show")
 158  {
 159     if (check_auth($id, "file_download", $userid) == 1)
 160     {
 161        if ($default->owl_use_fs)
 162        {
 163           $path = $default->owl_FileDir . "/" . find_path($parent) . "/" . flid_to_filename($id);
 164           readfile("$path");
 165        } 
 166        else
 167        {
 168           $sql = new Owl_DB;
 169           $filename = flid_to_filename($id);
 170           if ($filetype = strrchr($filename, "."))
 171           {
 172              $filetype = substr($filetype, 1);
 173              $sql->query("select * from $default->owl_mime_table where filetype = '$filetype'");
 174              while ($sql->next_record()) $mimeType = $sql->f("mimetype");
 175           } 
 176           if ($mimeType)
 177           {
 178              header("Content-Type: $mimeType");
 179              $sql->query("select data,compressed from " . $default->owl_files_data_table . " where id='$id'");
 180              while ($sql->next_record())
 181              {
 182                 if ($sql->f("compressed"))
 183                 {
 184                    $tmpfile = $default->owl_tmpdir . "/owltmp.$id";
 185                    if (file_exists($tmpfile)) unlink($tmpfile);
 186                    $fp = fopen($tmpfile, "wb");
 187                    fwrite($fp, $sql->f("data"));
 188                    fclose($fp);
 189                    flush(passthru($default->gzip_path . " -dfc $tmpfile"));
 190                    unlink($tmpfile);
 191                 } 
 192                 else
 193                 {
 194                    print $sql->f("data");
 195                 } 
 196              } 
 197           } 
 198        } 
 199     } 
 200     else
 201     {
 202        print($owl_lang->err_nofileaccess);
 203     } 
 204     die;
 205  } 
 206  
 207  if ($action == "file_details")
 208  {
 209     if (check_auth($parent, "folder_view", $userid) == 1)
 210     {
 211        if ($expand == 1)
 212        {
 213           print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_expand_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 214        }
 215        else
 216        {
 217           print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_collapse_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 218        }
 219        fPrintButtonSpace(12, 1);
 220        print("<br />\n");
 221        print("<table class=\"border2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 222                                                                                                                                                                                                         
 223       if ($default->show_prefs == 1 or $default->show_prefs == 3)
 224       {
 225          fPrintPrefs("infobar1", "top");
 226       }
 227  
 228       fPrintButtonSpace(12, 1);
 229       print("<br />\n");
 230  
 231        fPrintNavBar($parent);
 232        $sql = new Owl_DB;
 233        $sql->query("select * from $default->owl_files_table where id = '$id'");
 234        while ($sql->next_record())
 235        {
 236           $security = $sql->f("security");
 237           if ($security == "0") $security = $owl_lang->everyoneread;
 238           if ($security == "1") $security = $owl_lang->everyonewrite;
 239           if ($security == "2") $security = $owl_lang->groupread;
 240           if ($security == "3") $security = $owl_lang->groupwrite;
 241           if ($security == "4") $security = $owl_lang->onlyyou;
 242           if ($security == "5") $security = $owl_lang->groupwrite_nod;
 243           if ($security == "6") $security = $owl_lang->everyonewrite_nod;
 244           if ($security == "7") $security = $owl_lang->groupwrite_worldread;
 245           if ($security == "8") $security = $owl_lang->groupwrite_worldread_nod;
 246  
 247           $choped = split("\.", $sql->f("filename"));
 248           $pos = count($choped);
 249           $ext = strtolower($choped[$pos-1]);
 250           print("<table class=\"margin2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 251           print("<tr>\n");
 252           print("<td align=\"left\" valign=\"top\">\n");
 253           print("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 254           print("<tr>\n");
 255           print("<td class=\"form1\">$owl_lang->title:</td>\n");
 256           print("<td class=\"form1\" width=\"100%\">". $sql->f("name") ." &nbsp;&nbsp;");
 257  
 258           // Tiian change 2003-07-31
 259           $pos = strpos(get_dirpath($sql->f("parent")), "backup");
 260           if (is_integer($pos) && $pos)
 261           {
 262               $is_backup_folder = true;
 263           }
 264           else
 265           {
 266               $is_backup_folder = false;
 267           }
 268           printFileIcons($sql->f("id"), $sql->f("filename"), $sql->f("checked_out"), $sql->f("url"), $default->owl_version_control, $ext, $sql->f("parent"),$is_backup_folder);
 269  
 270           print("</td>\n");
 271           print("</tr>\n");
 272  
 273           
 274           $link = $default->owl_notify_link . "browse.php?sess=0&parent=" . $parent . "&expand=1&fileid=" . $id;
 275           fPrintFormTextLine($owl_lang->notify_link . ":" , "", "",  $link , "", true);
 276           fPrintFormTextLine($owl_lang->file . ":" , "", "", $sql->f("filename"), gen_filesize($sql->f("f_size")), true );
 277           // if a MP3 tag was found Display the information
 278           $filepath = $default->owl_FileDir . "/" . get_dirpath($sql->f("parent")) . "/" . $sql->f("filename");
 279           if ($sql->f("url") != 1 && file_exists($filepath))
 280           {
 281              $id3 = new id3($filepath);
 282  
 283              if ($id3->id3v11 || $id3->id3v1 || $id3->id3v2)
 284              {
 285                 $id3->study();
 286                 print("<tr><td align=\"right\" valign=\"top\"><br />$owl_lang->disp_mp3<br /><br /></td>");
 287                 print("<td align=\"left\">");
 288                 print("<b>$id3->artists - $id3->name <br />");
 289                 print("$id3->album <br />");
 290                 print("$id3->bitrate kbps&nbsp;&nbsp;$id3->frequency Hz&nbsp;$id3->mode <br />");
 291                 print("$id3->length<br />");
 292                 print("$id3->genre<br />");
 293                 print("$id3->comment</b>");
 294                 print("</td></tr>");
 295              } 
 296           } 
 297  
 298           fPrintFormTextLine($owl_lang->ownership . ":" , "", "",  fid_to_creator($id) . "&nbsp;(" . group_to_name(owlfilegroup($id)) . ")" , "", true);
 299           fPrintFormTextLine($owl_lang->permissions . ":" , "", "",  $security , "", true);
 300           fPrintFormTextLine($owl_lang->keywords . ":" , "", "",  $sql->f("metadata")  , "", true);
 301           $sql_custom = new Owl_db;
 302           $sql_custom_values = new Owl_db;
 303                                                                                                                                                                                                 
 304              $sql_custom->query("SELECT * from $default->owl_docfields_table where doc_type_id = '" . $sql->f("doctype") . "' order by field_position");
 305                                                                                                                                                                                                 
 306              if ($sql_custom->num_rows($sql_custom) > 0)
 307              {
 308                 print("<tr><td class=\"browse0\" width=\"100%\" colspan=\"2\">$owl_lang->doc_specific</td></tr>\n");
 309              }
 310                                                                                                                                                                                                 
 311              $qFieldLabel = new Owl_DB;
 312                                                                                                                                                                                                 
 313              while ($sql_custom->next_record())
 314              {
 315                 $sql_custom_values->query("SELECT  field_value from $default->owl_docfieldvalues_table where file_id = '" . $sql->f("id") . "' and field_name = '" . $sql_custom->f("field_name") ."'");
 316                 $values_result = $sql_custom_values->next_record();
 317                                                                                                                                                                                                 
 318                 $qFieldLabel->query("SELECT field_label from $default->owl_docfieldslabel_table where locale = '$language' and doc_field_id='" . $sql_custom->f("id") . "'");
 319                 $qFieldLabel->next_record();
 320                 print("<tr><td align=\"right\" class=\"form1\">". $qFieldLabel->f("field_label") .":");
 321                                                                                                                                                                                                 
 322                 if ($sql_custom->f("required") == "1")
 323                 {
 324                    print("<font color=\"red\"><b>&nbsp;*&nbsp;</b></font>");
 325                 }
 326                 else
 327                 {
 328                    print("<font color=\"red\"><b>&nbsp;&nbsp;&nbsp;</b></font>");
 329                 }
 330                                                                                                                                                                                                 
 331                 print("</td><td align=\"left\" class=\"form1\">" . $sql_custom_values->f("field_value") ."</td></tr>");
 332              }
 333                                                                                                                                                                                                 
 334              if ($sql_custom->num_rows($sql_custom) > 0)
 335              {
 336                 print("<tr><td class=\"browse0\" width=\"100%\" colspan=\"2\">&nbsp;</td></tr>\n");
 337              }
 338  
 339           fPrintFormTextArea($owl_lang->description. ":", "description", $sql->f("description"));
 340  
 341        print("</table>\n");
 342        print("</td></tr></table>\n");
 343        fPrintButtonSpace(12, 1);
 344        if ($default->show_prefs == 2 or $default->show_prefs == 3)
 345        {
 346           fPrintPrefs("infobar2");
 347        }
 348        print("</td></tr></table>\n");
 349        include ("./lib/footer.inc");
 350  
 351        } 
 352     } 
 353  } 
 354  
 355  if ($action == "image_preview")
 356  {
 357     if (check_auth($id, "file_download", $userid) == 1)
 358     {
 359        owl_syslog(FILE_VIEWED, $userid, flid_to_filename($id), $parent, "", "FILE");
 360        if ($expand == 1)
 361        {
 362           print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_expand_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 363        }
 364        else
 365        {
 366           print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_collapse_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 367        }
 368        fPrintButtonSpace(12, 1);
 369        print("<br />\n");
 370        print("<table class=\"border2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 371                                                                                                                                                                                                         
 372       if ($default->show_prefs == 1 or $default->show_prefs == 3)
 373       {
 374          fPrintPrefs();
 375       }
 376  
 377       fPrintButtonSpace(12, 1);
 378  
 379  
 380        if ($default->owl_use_fs)
 381        {
 382           $path = find_path($parent) . "/" . flid_to_filename($id);
 383        }
 384        else
 385        {
 386           $path = flid_to_filename($id);
 387           if (file_exists($default->owl_FileDir . "/$path")) unlink($default->owl_FileDir . "/$path");
 388           $file = fopen($default->owl_FileDir . "/$path", 'wb');
 389           $sql->query("select data,compressed from $default->owl_files_data_table where id='$id'");
 390           while ($sql->next_record())
 391           {
 392              if ($sql->f("compressed"))
 393              {
 394                 $tmpfile = $default->owl_tmpdir . "/owltmp.$id.gz";
 395                 $uncomptmpfile = $default->owl_tmpdir . "/owltmp.$id";
 396                 if (file_exists($tmpfile)) unlink($tmpfile);
 397  
 398                 $fp = fopen($tmpfile, "wb");
 399                 fwrite($fp, $sql->f("data"));
 400                 fclose($fp);
 401  
 402                 system($default->gzip_path . " -df $tmpfile");
 403  
 404                 $fsize = filesize($uncomptmpfile);
 405                 $fd = fopen($uncomptmpfile, 'rb');
 406                 $filedata = fread($fd, $fsize);
 407                 fclose($fd);
 408  
 409                 fwrite($file, $filedata);
 410                 unlink($uncomptmpfile);
 411              }
 412              else
 413              {
 414                 fwrite($file, $sql->f("data"));
 415              }
 416              fclose($file);
 417           }
 418        }
 419  
 420       fPrintNavBar($parent, $owl_lang->viewing . ":&nbsp;", $id);
 421  
 422       print("<table class=\"margin2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 423       print("<tr>\n");
 424       print("<td align=\"left\" valign=\"top\">\n");
 425       print("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 426       print('<tr>');
 427       print("<td align=\"left\">");
 428       print('<p align="center">');
 429       print("<img src=\"$path\" alt=\"\"></img></p>");
 430       print("</td></tr></table>");
 431       print("</td></tr></table>");
 432       fPrintButtonSpace(12, 1);
 433       if ($default->show_prefs == 2 or $default->show_prefs == 3)
 434       {
 435          fPrintPrefs("infobar2");
 436       }
 437       print("</td></tr></table>");
 438       include ("./lib/footer.inc");
 439     } 
 440     else
 441     {
 442        printError($owl_lang->err_nofileaccess);
 443     } 
 444  } 
 445  
 446  if ($action == "zip_preview")
 447  {
 448     if (check_auth($id, "file_download", $userid) == 1)
 449     {
 450        owl_syslog(FILE_VIEWED, $userid, flid_to_filename($id), $parent, "", "FILE");
 451        $name = flid_to_filename($id);
 452  
 453        if ($default->owl_use_fs)
 454        {
 455           $path = find_path($parent) . "/" . $name;
 456        } 
 457        else
 458        {
 459           $path = $name;
 460           if (file_exists($default->owl_FileDir . "/$path")) unlink($default->owl_FileDir . "/$path");
 461           $file = fopen($default->owl_FileDir . "/$path", 'wb');
 462           $sql->query("select data,compressed from $default->owl_files_data_table where id='$id'");
 463           while ($sql->next_record())
 464           {
 465              if ($sql->f("compressed"))
 466              {
 467                 $tmpfile = $default->owl_tmpdir . "/owltmp.$id.gz";
 468                 $uncomptmpfile = $default->owl_tmpdir . "/owltmp.$id";
 469                 if (file_exists($tmpfile)) unlink($tmpfile);
 470  
 471                 $fp = fopen($tmpfile, "wb");
 472                 fwrite($fp, $sql->f("data"));
 473                 fclose($fp);
 474  
 475                 system($default->gzip_path . " -df $tmpfile");
 476  
 477                 $fsize = filesize($uncomptmpfile);
 478                 $fd = fopen($uncomptmpfile, 'rb');
 479                 $filedata = fread($fd, $fsize);
 480                 fclose($fd);
 481  
 482                 fwrite($file, $filedata);
 483                 unlink($uncomptmpfile);
 484              } 
 485              else
 486              {
 487                 fwrite($file, $sql->f("data"));
 488              } 
 489              fclose($file);
 490           } 
 491        } 
 492     
 493  
 494        if ($expand == 1)
 495        {
 496           print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_expand_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 497        }
 498        else
 499        {
 500           print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_collapse_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 501        }
 502        fPrintButtonSpace(12, 1);
 503        print("<br />\n");
 504        print("<table class=\"border2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 505  
 506  
 507        if ($default->show_prefs == 1 or $default->show_prefs == 3)
 508        {
 509           fPrintPrefs();
 510        }
 511  
 512        fPrintButtonSpace(12, 1);
 513  
 514  
 515        fPrintNavBar($parent, $owl_lang->viewing . ":&nbsp;", $id);
 516  
 517        print("<table><tr><td align=\"left\"><pre>");
 518  
 519        if ($filext == "tar")
 520        {
 521           $expr = "-tvf ";
 522           $unzipbin = "$default->tar_path $expr " . "\"" . "./" . $path . "\" ";
 523           if (substr(php_uname(), 0, 7) != "Windows")
 524           {
 525              $unzipbin .= " 2>&1";
 526           } 
 527           passthru("$unzipbin");
 528        } 
 529        else if (($filext == "tar.gz") || ($filext == "tgz"))
 530        {
 531           $expr = "-tz ";
 532           $unzipbin = "$default->tar_path $expr  < " . "\"" . "./" . $path . "\" ";
 533           if (substr(php_uname(), 0, 7) != "Windows")
 534           {
 535              $unzipbin .= " 2>&1";
 536           } 
 537           passthru("$unzipbin");
 538        } elseif ($filext == "gz")
 539        {
 540           $expr = "-lt";
 541           $unzipbin = "$default->gzip_path $expr " . "\"" . "./" . $path . "\" ";
 542           if (substr(php_uname(), 0, 7) != "Windows")
 543           {
 544              $unzipbin .= " 2>&1";
 545           } 
 546           passthru("$unzipbin");
 547        } 
 548        else if ($filext == "zip")
 549        {
 550           $expr = "-l";
 551           $unzipbin = "$default->unzip_path $expr " . "\"" .  $default->owl_FileDir  . "/" . $path . "\" ";
 552           if (substr(php_uname(), 0, 7) != "Windows")
 553           {
 554              $unzipbin .= " 2>&1";
 555           } 
 556           passthru("$unzipbin");
 557        } 
 558        else
 559        {
 560           exit();
 561        }
 562  
 563        if (!$default->owl_use_fs)
 564        {
 565           unlink($default->owl_FileDir . "/$path");
 566        } 
 567        print("</pre></td></tr></table>");
 568  
 569        fPrintButtonSpace(12, 1);
 570  
 571        if ($default->show_prefs == 2 or $default->show_prefs == 3)
 572        {
 573           fPrintPrefs("infobar2");
 574        }
 575        print("</td></tr></table>\n");
 576        include ("./lib/footer.inc");
 577     } 
 578     else
 579     {
 580        print($owl_lang->err_nofileaccess);
 581     } 
 582  } 
 583  // BEGIN wes change
 584  if ($action == "html_show" || $action == "text_show" || $action == "note_show" || $action == "pod_show" || $action == "php_show")
 585  {
 586     if (check_auth($id, "file_download", $userid) == 1)
 587     {
 588        owl_syslog(FILE_VIEWED, $userid, flid_to_filename($id), $parent, "", "FILE");
 589        if ($default->owl_use_fs)
 590        {
 591           $path = $default->owl_FileDir . "/" . find_path($parent) . "/" . flid_to_filename($id);
 592           if ($expand == 1)
 593           {
 594              print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_expand_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 595           }
 596           else
 597           {
 598              print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_collapse_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 599           }
 600           fPrintButtonSpace(12, 1);
 601           print("<br />\n");
 602           print("<table class=\"border2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 603                                                                                                                                                                                                   
 604           if ($default->show_prefs == 1 or $default->show_prefs == 3)
 605           {
 606              fPrintPrefs();
 607           }
 608  
 609           fPrintButtonSpace(12, 1);
 610           print("<br />\n");
 611                                                                                                                                                                                                   
 612  
 613           fPrintNavBar($parent, $owl_lang->viewing . ":&nbsp;", $id);
 614           print("<table class=\"margin2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 615           print("<tr>\n");
 616           print("<td align=\"left\" valign=\"top\">\n");
 617           print("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 618           print('<tr>');
 619           print("<td align=\"left\">");
 620           print('<p align="left">');
 621  
 622           if ($action == "text_show" or $action == "note_show" or $action == "html_show") 
 623           {
 624              print("<xmp>"); 
 625           }
 626  
 627           if ($action == "pod_show")
 628           {
 629              if (file_exists($default->pod2html_path))
 630              {
 631                 $sOwltmpview = $default->owl_tmpdir . "/owltmpview.$id.$sess";
 632                 $mystring = system("$default->pod2html_path --cachedir=$default->owl_tmpdir --infile=$path --outfile=$sOwltmpview");
 633                 readfile("$sOwltmpview"); 
 634                 myDelete($sOwltmpview); 
 635              }
 636              else 
 637              {
 638                 print("<H2>$owl_lang->err_pod2html_not_found $default->pod2html_path</H2>");
 639              }
 640           }
 641           elseif ($action == "php_show")
 642           {
 643                 $sOwltmpview = $default->owl_tmpdir . "/owltmpview.$id.$sess";
 644                 $mystring = system("php -s -q $path > $sOwltmpview");
 645                 readfile("$sOwltmpview");
 646                 myDelete($sOwltmpview);
 647           }
 648           else
 649           {
 650              readfile("$path"); 
 651           }
 652        } 
 653        else
 654        {
 655           if ($expand == 1)
 656           {
 657              print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_expand_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 658           }
 659           else
 660           {
 661              print("<table class=\"border1\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"$default->table_collapse_width\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 662           }
 663           fPrintButtonSpace(12, 1);
 664           print("<br />\n");
 665           print("<table class=\"border2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\"><tr><td align=\"left\" valign=\"top\" width=\"100%\">\n");
 666                                                                                                                                                                                                      
 667           if ($default->show_prefs == 1 or $default->show_prefs == 3)
 668           {
 669              fPrintPrefs();
 670           }
 671                                                                                                                                                                                                      
 672           fPrintButtonSpace(12, 1);
 673           print("<br />\n");
 674                                                                                                                                                                                                      
 675                                                                                                                                                                                                      
 676           fPrintNavBar($parent, $owl_lang->viewing . ":&nbsp;", $id);
 677           print("<table class=\"margin2\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 678           print("<tr>\n");
 679           print("<td align=\"left\" valign=\"top\">\n");
 680           print("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n");
 681           print('<tr>');
 682           print("<td align=\"left\">");
 683           print('<p align="left">');
 684  
 685           if ($action == "text_show" or $action == "note_show" or $action == "html_show") 
 686           {
 687              print("<xmp>");
 688           }
 689  
 690           $sql->query("select data,compressed from " . $default->owl_files_data_table . " where id='$id'");
 691  
 692           while ($sql->next_record())
 693           {
 694              if ($sql->f("compressed"))
 695              {
 696                    print("<xmp>");
 697                    $tmpfile = $default->owl_tmpdir . "/owltmp.$id.$sess";
 698                    if (file_exists($tmpfile)) unlink($tmpfile);
 699                    $fp = fopen($tmpfile, "wb");
 700                    fwrite($fp, $sql->f("data"));
 701                    fclose($fp);
 702                    flush(stripslashes(passthru($default->gzip_path . " -dfc $tmpfile")));
 703                    print("</xmp>");
 704                    unlink($tmpfile);
 705              } 
 706              else
 707              {
 708                 if ($action == "php_show")
 709                 {
 710                       $sOwltmpview = $default->owl_tmpdir . "/owltmpview.$id.$sess";
 711                       $tmpfile = $default->owl_tmpdir . "/owltmpview2.$id.$sess";
 712                       if (file_exists($tmpfile)) unlink($tmpfile);
 713                       $fp = fopen($tmpfile, "wb");
 714                       fwrite($fp, stripslashes($sql->f("data")));
 715                       fclose($fp);
 716                       $mystring = system("php -s -q $tmpfile > $sOwltmpview");
 717                       readfile("$sOwltmpview");
 718                       myDelete($sOwltmpview);
 719                       myDelete($tmpfile);
 720                 }
 721                 else
 722                 {
 723                    print stripslashes($sql->f("data"));
 724                 }
 725              } 
 726           } 
 727        } 
 728  
 729        if ($action == "text_show" or $action == "note_show" or $action == "html_show") 
 730        {
 731           print("</xmp>");
 732        }
 733  
 734        print('</td>');
 735        print('</tr>');
 736        print('</table>');
 737        $path = find_path($parent) . "/" . flid_to_filename($id);
 738  
 739        print("</td></tr></table>");
 740  
 741        fPrintButtonSpace(12, 1);
 742  
 743         if ($default->show_prefs == 2 or $default->show_prefs == 3)
 744         {
 745            fPrintPrefs("infobar2");
 746         }
 747         print("</td></tr></table>\n");
 748         include ("./lib/footer.inc");
 749     } 
 750     else
 751     {
 752        print($owl_lang->err_nofileaccess);
 753     } 
 754  } 
 755  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]