forked from doxbox/doxbox-dms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_default.php
executable file
·1362 lines (1214 loc) · 53.7 KB
/
view_default.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* view_default.php -- Default view for Browse page
*
* Author: Steve Bourgeois <[email protected]>
*
* Copyright (c) 2006-2009 Bozz IT Consulting Inc
*
* Licensed under the GNU GPL. For full terms see the file LICENSE.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
if ($default->show_bulk > 0 or (fIsAdmin() and $default->show_bulk == 0 ))
{
if ($sess != "0" || ( $sess == "0" && $default->anon_ro == 0 ))
{
$xtpl->assign('TITLE_BULK_URL', '#');
$xtpl->assign('TITLE_BULK_TITLE', $owl_lang->alt_toggle_check_box);
$xtpl->assign('TITLE_BULK_ONCLICK', ' onclick="CheckAll(); return false;"');
$urlArgs = array();
$urlArgs['sess'] = $sess;
$urlArgs['parent'] = $parent;
$urlArgs['expand'] = $expand;
$urlArgs['order'] = $order;
$urlArgs['sort'] = $sortname;
$urlArgs['curview'] = $curview;
$urlArgs[${$sortorder}] = $sort;
$xtpl->assign('BULKBUTTONS_HIDDEN', fGetHiddenFields ($urlArgs));
$xtpl->parse('main.BulkFormStart');
$xtpl->parse('main.BulkFormEnd');
$xtpl->parse('main.DataBlock.Title.Bulk');
}
}
if (($default->expand_disp_status and $expand == 1) or ($default->collapse_disp_status and $expand == 0))
{
if ($default->show_bulk == 0 and ! fIsAdmin())
{
$xtpl->assign('TITLE_STATUS', "<input id=\"fcheckid" . $sql->f("id") . "\" type=\"hidden\" name=\"fstyle_change\" value=\"" . $sql->f("id") . "\" />");
}
$xtpl->parse('main.DataBlock.Title.Status');
}
if (($default->expand_disp_doc_num and $expand == 1) or ($default->collapse_disp_doc_num and $expand == 0))
{
show_linkXTPL("id", "sortid", $sortid, $order, $sess, $expand, $parent, $owl_lang->doc_number);
}
if ($default->thumbnails == 1 and $default->thumbnails_small_width > 0)
{
$xtpl->parse('main.DataBlock.Title.Thumb');
}
if (($default->expand_disp_doc_type and $expand == 1) or ($default->collapse_disp_doc_type and $expand == 0))
{
$xtpl->parse('main.DataBlock.Title.DocType');
}
if (($default->expand_disp_title and $expand == 1) or ($default->collapse_disp_title and $expand == 0))
{
show_linkXTPL("name", "sortname", $sortname, $order, $sess, $expand, $parent, $owl_lang->title);
}
if (($default->expand_disp_doc_fields and $expand == 1) or ($default->collapse_disp_doc_fields and $expand == 0))
{
$xtpl->assign('TITLE_DOCFIELDS', $owl_lang->doc_fields);
$xtpl->parse('main.DataBlock.Title.DocFields');
}
if ($default->owl_version_control == 1)
{
if (($default->expand_disp_version and $expand == 1) or ($default->collapse_disp_version and $expand == 0))
{
show_linkXTPL("major_minor_revision", "sortver", $sortver, $order, $sess, $expand, $parent, $owl_lang->ver);
}
}
if (($default->expand_disp_file and $expand == 1) or ($default->collapse_disp_file and $expand == 0))
{
show_linkXTPL("filename", "sortfilename", $sortfilename, $order, $sess, $expand, $parent, $owl_lang->file);
}
/*
Show DocType Fields that have Been Selected to be viewed as a column
TO BE ADDED
*/
if (($default->expand_disp_size and $expand == 1) or ($default->collapse_disp_size and $expand == 0))
{
show_linkXTPL("f_size", "sortsize", $sortsize, $order, $sess, $expand, $parent, $owl_lang->size);
}
if (($default->expand_disp_posted and $expand == 1) or ($default->collapse_disp_posted and $expand == 0))
{
show_linkXTPL("creatorid", "sortposted", $sortposted, $order, $sess, $expand, $parent, $owl_lang->postedby);
}
if (($default->expand_disp_updated and $expand == 1) or ($default->collapse_disp_updated and $expand == 0))
{
show_linkXTPL("updatorid", "sortupdator", $sortupdator, $order, $sess, $expand, $parent, $owl_lang->updated_by);
}
if (($default->expand_disp_modified and $expand == 1) or ($default->collapse_disp_modified and $expand == 0))
{
show_linkXTPL("smodified", "sortmod", $sortmod, $order, $sess, $expand, $parent, $owl_lang->modified);
}
if ((($default->expand_disp_action and $expand == 1) or ($default->collapse_disp_action and $expand == 0)) and $default->old_action_icons)
{
$xtpl->assign('TITLE_ACTIONS', $owl_lang->actions);
$xtpl->parse('main.DataBlock.Title.Actions');
}
if ($default->owl_version_control == 1)
{
if (($default->expand_disp_held and $expand == 1) or ($default->collapse_disp_held and $expand == 0))
{
show_linkXTPL("checked_out", "sortcheckedout", $sortcheckedout, $order, $sess, $expand, $parent, $owl_lang->held);
}
}
// Looping out Folders
if ($default->owl_LookAtHD != "false")
{
$sql->query("SELECT * from $default->owl_folders_table where parent = '$parent' $whereclause");
//exit("SELECT * from $default->owl_folders_table where parent = '$parent' $whereclause");
while ($sql->next_record())
{
// LOOKATHDDEBUG
//if ($default->records_per_page == 0)
//if ($default->records_per_page > 0)
//{
if ($sql->f("linkedto") == 0)
{
$DBFolderCount++; //count number of filez in db 2 use with array
$DBFolders[$DBFolderCount] = $sql->f("name"); //create list if files in
}
//}
}
}
$sql = new Owl_DB;
$sql->query($FolderQuery);
// **********************
// BEGIN Print Folders
// **********************
if ($default->records_per_page > 0)
{
if ($default->restrict_view == 1)
{
$iPageStartCount = $default->records_per_page * $iCurrentPage;
$iPageEndCount = $default->records_per_page * ($iCurrentPage + 1);
$iRecordCounter = 0;
}
}
$iIsOneRecPrinted = 0;
while ($sql->next_record())
{
if ($default->restrict_view == 1)
{
if (!check_auth($sql->f("id"), "folder_view", $userid, false, false))
{
//if ($default->records_per_page == 0)
//{
//if ($sql->f("linkedto") == 0)
//{
//$DBFolderCount++; //count number of filez in db 2 use with array
//$DBFolders[$DBFolderCount] = $sql->f("name"); //create list if files in
//}
//}
continue;
}
}
if ($default->records_per_page > 0)
{
if ($default->restrict_view == 1)
{
$iRecordCounter++;
if ($iRecordCounter > $iPageEndCount or $iRecordCounter <= $iPageStartCount)
{
continue;
}
}
}
$iIsOneRecPrinted++;
// *******************************************
// Find out how many items (Folders and Files)
// *******************************************
if(!$default->hide_folder_doc_count)
{
$GetItems = new Owl_DB;
$iFolderCount = 0;
$iParent = $sql->f("parent");
$GetItems->query("SELECT id from $default->owl_folders_table where parent = '" . $sql->f("id") . "'" . $whereclause);
if ($default->restrict_view == 1)
{
while ($GetItems->next_record())
{
$bFileDownload = check_auth($GetItems->f("id"), "folder_view", $userid, false, false);
if ($bFileDownload)
{
$iFolderCount++;
}
}
}
else
{
$iFolderCount = $GetItems->num_rows();
}
$iFileCount = fCountFileType ($sql->f("id"), '0');
$iUrlCount = fCountFileType ($sql->f("id"), '1');
$iNoteCount = fCountFileType ($sql->f("id"), '2');
}
$CountLines++;
$PrintLines = $CountLines % 2;
if ($PrintLines == 0)
{
$sTrClass = "hover1";
$sLfList = "lfile1";
$sTrClassHilite = "mouseover1";
$sTrClassHiliteAlt = "mouseover3";
}
else
{
$sTrClass = "hover2";
$sLfList = "lfile1";
$sTrClassHilite = "mouseover2";
$sTrClassHiliteAlt = "mouseover3";
}
/** This code is only used when debugging customer issues, it creates the missing
* Directories based on the database
*/
// $fix_path = find_path($sql->f("id"));
// if (!file_exists($fix_path))
// {
// mkdir($fix_path);
// }
$xtpl->assign('FOLDER_TR_ID', "foldertr" . $sql->f("id"));
$xtpl->assign('FOLDER_TR_CLASS', $sTrClassHilite);
$xtpl->assign('FOLDER_TR_MOUSOVER', "class=\"$sTrClassHilite\" onmouseover=\"alt_css_style('fcheckid" . $sql->f("id") . "', this, '$sTrClassHiliteAlt')\" onmouseout=\"alt_css_style('fcheckid" . $sql->f("id") . "', this, '$sTrClassHilite')\"");
$xtpl->assign('FOLDER_TD_CLASS', $sTrClass);
if ($default->show_bulk > 0 or (fIsAdmin() and $default->show_bulk == 0 ))
{
if ($sess != "0" || ($sess == "0" && $default->anon_ro == 0))
{
$xtpl->assign('FOLDER_BULK_CHECKBOX', "<input id=\"fcheckid" . $sql->f("id") . "\" type=\"checkbox\" name=\"fbatch[]\" value=\"" . $sql->f("id") . "\" onclick=\"mark_selected('foldertr" . $sql->f("id") . "', this, '$sTrClassHilite')\" />");
$xtpl->parse('main.DataBlock.Folder.Bulk');
}
}
if(($default->expand_disp_status and $expand == 1) or ($default->collapse_disp_status and $expand == 0))
{
if (fIsFolderRSSFeed($sql->f("id")) == true and $default->rss_feed_enabled == 1)
{
$sRssName = $sql->f("name") . ".xml";
if (file_exists($default->RSS_TxtFilePath . DIR_SEP . $sRssName ))
{
if ($default->show_bulk == 0 and ! fIsAdmin())
{
$xtpl->assign('FOLDER_STATUS', "<input id=\"fcheckid" . $sql->f("id") . "\" type=\"hidden\" name=\"fstyle_change\" value=\"" . $sql->f("id") . "\" />");
}
$xtpl->assign('FOLDER_STATUS_RSS_IMG', "<a href=\"https://" . $_SERVER['SERVER_NAME'] . $default->owl_root_url . "/RSS/". $sRssName ."\" class=\"\" title=\"Right Click Save AS\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/ui_misc/rss.gif\" border=\"0\" alt=\"Right Click Save AS\" title=\"Right Click Save AS\"><br /></a>");
$xtpl->parse('main.DataBlock.Folder.Status');
}
else
{
if ($default->show_bulk == 0 and ! fIsAdmin())
{
$xtpl->assign('FOLDER_STATUS', "<input id=\"fcheckid" . $sql->f("id") . "\" type=\"hidden\" name=\"fstyle_change\" value=\"" . $sql->f("id") . "\" />");
}
$xtpl->assign('FOLDER_STATUS_RSS_IMG', "<img src=\"$default->owl_graphics_url/$default->sButtonStyle/ui_misc/rss_gray.gif\" border=\"0\" alt=\"Feed has not been Created Yet\" title=\"Feed has not been Created Yet\">");
$xtpl->parse('main.DataBlock.Folder.Status');
}
}
else
{
if ($default->show_bulk == 0 and ! fIsAdmin())
{
$xtpl->assign('FOLDER_STATUS', "<input id=\"fcheckid" . $sql->f("id") . "\" type=\"hidden\" name=\"fstyle_change\" value=\"" . $sql->f("id") . "\" />");
}
$xtpl->parse('main.DataBlock.Folder.Status');
}
}
if(($default->expand_disp_doc_num and $expand == 1) or ($default->collapse_disp_doc_num and $expand == 0))
{
$xtpl->parse('main.DataBlock.Folder.id');
}
if ($default->thumbnails == 1 and $default->thumbnails_small_width > 0)
{
$xtpl->parse('main.DataBlock.Folder.Thumb');
}
$urlArgs2 = $urlArgs;
$urlArgs2['parent'] = $parent;
// 0 = View File Details
// 1 = Download File
// 2 = Modify File Properties
if ($default->folder_action_click_title_column == 0)
{
$urlArgs2['parent'] = $sql->f("id");
$url = fGetURL ('browse.php', $urlArgs2);
$sAltString = $owl_lang->title_browse_folder;
}
else if ($default->folder_action_click_title_column == 1)
{
$urlArgs2['binary'] = '1';
$urlArgs2['id'] = $sql->f('id');
$urlArgs2['action'] = 'folder';
$url = fGetURL ('download.php', $urlArgs2);
$sAltString = $owl_lang->alt_get_folder;
}
else if ($default->folder_action_click_title_column == 2)
{
$urlArgs2['action'] = 'folder_modify';
$urlArgs2['id'] = $sql->f('id');
$url = fGetURL ('modify.php', $urlArgs2);
}
else
{
$urlArgs2['parent'] = $sql->f("id");
$url = fGetURL ('browse.php', $urlArgs2);
$sAltString = $owl_lang->title_browse_folder;
}
if(($default->expand_disp_doc_type and $expand == 1) or ($default->collapse_disp_doc_type and $expand == 0))
{
$xtpl->assign('FOLDER_DOCTYPE_URL', $url);
$xtpl->assign('FOLDER_DOCTYPE_TITLE', $sAltString);
$xtpl->parse('main.DataBlock.Folder.DocType');
}
if(($default->expand_disp_title and $expand == 1) or ($default->collapse_disp_title and $expand == 0))
{
if ($default->show_folder_desc_as_popup == '1')
{
$sPopupDescription= htmlentities(strip_tags(fCleanDomTTContent($sql->f("description")), $default->permited_html_tags ), ENT_QUOTES, "UTF-8");
if (trim($sPopupDescription) == "")
{
$sPopupDescription = $owl_lang->no_description;
}
$sPopupCode = " onmouseover=" . '"' . sprintf($default->domtt_popup , $owl_lang->description, $sPopupDescription, $default->popup_lifetime) . '"';
}
else
{
$sPopupCode = "";
$sPopupDescription = strip_tags($sql->f("description"), $default->permited_html_tags);
}
$urlArgs2 = $urlArgs;
$urlArgs2['parent'] = $sql->f("id");
$url = fGetURL ('browse.php', $urlArgs2);
$xtpl->assign('FOLDER_NAME_URL', $url);
$xtpl->assign('FOLDER_NAME_TITLE', $sAltString);
$xtpl->assign('FOLDER_NAME_MOUSEOVER', $sPopupCode);
$xtpl->assign('FOLDER_NAME_NAME', $sql->f("name"));
if(!$default->hide_folder_doc_count)
{
$sCounts = '';
if ($iFolderCount > 0 or $iFileCount > 0 or $iUrlCount > 0 or $iNoteCount > 0)
{
$sCounts .= " (";
}
if ($iFolderCount > 0 )
{
$sCounts .= "<a href=\"#\" class=\"cfolders1\" title=\"$owl_lang->folder_count_pre $iFolderCount $owl_lang->folder_count_folder\">$iFolderCount</a>";
}
if ($iFileCount > 0 )
{
if ($iFolderCount > 0)
{
$sCounts .= ":";
}
$sCounts .= "<a href=\"#\" class=\"cfiles1\" title=\"$owl_lang->folder_count_pre $iFileCount $owl_lang->folder_count_file\">$iFileCount</a>";
}
if ($iUrlCount > 0 )
{
if ($iFileCount > 0 or $iFolderCount > 0)
{
$sCounts .= ":";
}
$sCounts .= "<a href=\"#\" class=\"curl1\" title=\"$owl_lang->folder_count_pre $iUrlCount $owl_lang->folder_count_url\">$iUrlCount</a>";
}
if ($iNoteCount > 0)
{
if ($iUrlCount > 0 or $iFileCount > 0 or $iFolderCount > 0)
{
$sCounts .= ":";
}
$sCounts .= "<a href=\"#\" class=\"cnotes1\" title=\"$owl_lang->folder_count_pre $iNoteCount $owl_lang->folder_count_note\">$iNoteCount</a>";
}
if ($iFolderCount > 0 or $iFileCount > 0 or $iUrlCount > 0 or $iNoteCount > 0)
{
$sCounts .= ")";
}
$xtpl->assign('FOLDER_NAME_COUNTS', $sCounts);
}
if (trim($sql->f("description")) and $default->show_folder_desc_as_popup == '0')
{
$sDescription = strip_tags($sql->f("description"), $default->permited_html_tags);
//$xtpl->assign('FOLDER_NAME_DESC_POP', "<br /><img src=\"$default->owl_graphics_url/$default->sButtonStyle/ui_misc/transparent.gif\" border=\"0\"><a class=\"desc\">" . "<br /><img src=\"$default->owl_graphics_url/$default->sButtonStyle/ui_misc/transparent.gif\" border=\"0\" />$sDescription</a>");
$xtpl->assign('FOLDER_NAME_DESC', nl2br($sDescription));
$xtpl->parse('main.DataBlock.Folder.Name.Description');
}
$xtpl->parse('main.DataBlock.Folder.Name');
}
//if ($default->records_per_page == 0)
//{
//if ($sql->f("linkedto") == 0)
//{
//$DBFolderCount++; //count number of filez in db 2 use with array
//$DBFolders[$DBFolderCount] = $sql->f("name"); //create list if files in
//}
//}
if (($default->expand_disp_doc_fields and $expand == 1) or ($default->collapse_disp_doc_fields and $expand == 0))
{
$xtpl->parse('main.DataBlock.Folder.DocFields');
}
if ($default->owl_version_control == 1)
{
if (($default->expand_disp_version and $expand == 1) or ($default->collapse_disp_version and $expand == 0))
{
$xtpl->parse('main.DataBlock.Folder.major_minor_revision');
}
if (($default->expand_disp_file and $expand == 1) or ($default->collapse_disp_file and $expand == 0))
{
if(!$default->old_action_icons)
{
fSetupFolderActionMenusXTPL($sql->f("id"), $sql->f("name"));
$xtpl->parse('main.DataBlock.Folder.filename');
}
else
{
$xtpl->parse('main.DataBlock.Folder.oldaction_filename');
}
}
if (($default->expand_disp_size and $expand == 1) or ($default->collapse_disp_size and $expand == 0))
{
if ($default->hide_folder_size)
{
$xtpl->assign('FOLDER_SIZE', ' ');
}
else
{
$FolderSize = fGetFolderSize($sql->f("id"));
$xtpl->assign('FOLDER_SIZE', gen_filesize($FolderSize));
}
$xtpl->parse('main.DataBlock.Folder.f_size');
}
if( $default->show_user_info == 1)
{
$sLinkToUser = "<a class=\"$sLfList\" href=\"prefs.php?owluser=" . $sql->f("creatorid") . "&sess=$sess&expand=$expand&parent=$parent&order=$order&sortname=$sortname\">" . flid_to_creator($sql->f("id")) . "</a>";
}
else
{
$sLinkToUser = uid_to_name($sql->f("creatorid"));
}
if (($default->expand_disp_posted and $expand == 1) or ($default->collapse_disp_posted and $expand == 0))
{
$xtpl->assign('FOLDER_CREATOR', $sLinkToUser);
$xtpl->parse('main.DataBlock.Folder.creatorid');
}
if (($default->expand_disp_updated and $expand == 1) or ($default->collapse_disp_updated and $expand == 0))
{
$xtpl->parse('main.DataBlock.Folder.updatorid');
}
if (($default->expand_disp_modified and $expand == 1) or ($default->collapse_disp_modified and $expand == 0))
{
if ($sql->f("smodified"))
{
$xtpl->assign('FOLDER_MODIFIED', date($owl_lang->localized_date_format, strtotime($sql->f("smodified")) + $default->time_offset));
}
else
{
$xtpl->assign('FOLDER_MODIFIED', ' ');
}
$xtpl->parse('main.DataBlock.Folder.smodified');
}
}
else
{
if (($default->expand_disp_file and $expand == 1) or ($default->collapse_disp_file and $expand == 0))
{
if(!$default->old_action_icons)
{
fSetupFolderActionMenusXTPL($sql->f("id"), $sql->f("name"));
$xtpl->parse('main.DataBlock.Folder.filename');
}
else
{
$xtpl->parse('main.DataBlock.Folder.oldaction_filename');
}
}
if (($default->expand_disp_size and $expand == 1) or ($default->collapse_disp_size and $expand == 0))
{
if ($default->hide_folder_size)
{
$xtpl->assign('FOLDER_SIZE', ' ');
}
else
{
$FolderSize = fGetFolderSize($sql->f("id"));
$xtpl->assign('FOLDER_SIZE', gen_filesize($FolderSize));
}
$xtpl->parse('main.DataBlock.Folder.f_size');
}
if( $default->show_user_info == 1)
{
$sLinkToUser = "<a class=\"$sLfList\" href=\"prefs.php?owluser=" . $sql->f("creatorid") . "&sess=$sess&expand=$expand&parent=$parent&order=$order&sortname=$sortname\">" . flid_to_creator($sql->f("id")) . "</a>";
}
else
{
$sLinkToUser = uid_to_name($sql->f("creatorid"));
}
if (($default->expand_disp_posted and $expand == 1) or ($default->collapse_disp_posted and $expand == 0))
{
$xtpl->assign('FOLDER_CREATOR', $sLinkToUser);
$xtpl->parse('main.DataBlock.Folder.creatorid');
}
if (($default->expand_disp_updated and $expand == 1) or ($default->collapse_disp_updated and $expand == 0))
{
$xtpl->parse('main.DataBlock.Folder.updatorid');
}
if (($default->expand_disp_modified and $expand == 1) or ($default->collapse_disp_modified and $expand == 0))
{
if ($sql->f("smodified"))
{
$xtpl->assign('FOLDER_MODIFIED', date($owl_lang->localized_date_format, strtotime($sql->f("smodified")) + $default->time_offset));
}
else
{
$xtpl->assign('FOLDER_MODIFIED', ' ');
}
$xtpl->parse('main.DataBlock.Folder.smodified');
}
}
if ((($default->expand_disp_action and $expand == 1) or ($default->collapse_disp_action and $expand == 0)) and $default->old_action_icons)
{
$sSpacer = "<img src=\"$default->owl_graphics_url/$default->sButtonStyle/ui_misc/x_clear.gif\" height=\"1\" width=\"17\" alt=\"\" />";
$xtpl->assign('FOLDER_ACTION_LOG', $sSpacer);
$xtpl->assign('FOLDER_ACTION_HOTLINK', $sSpacer);
$xtpl->assign('FOLDER_ACTION_DEL', $sSpacer);
$xtpl->assign('FOLDER_ACTION_MOD', $sSpacer);
$xtpl->assign('FOLDER_ACTION_INLINE', $sSpacer);
$xtpl->assign('FOLDER_ACTION_ACL', $sSpacer);
$xtpl->assign('FOLDER_ACTION_LINK', $sSpacer);
$xtpl->assign('FOLDER_ACTION_COPY', $sSpacer);
$xtpl->assign('FOLDER_ACTION_MOVE', $sSpacer);
$xtpl->assign('FOLDER_ACTION_UPD', $sSpacer);
$xtpl->assign('FOLDER_ACTION_DNLD', $sSpacer);
$xtpl->assign('FOLDER_ACTION_COMMENT', $sSpacer);
$xtpl->assign('FOLDER_ACTION_CHECKOUT', $sSpacer);
$xtpl->assign('FOLDER_ACTION_EMAIL', $sSpacer);
$xtpl->assign('FOLDER_ACTION_MON', $sSpacer);
$xtpl->assign('FOLDER_ACTION_RELATED', $sSpacer);
$xtpl->assign('FOLDER_ACTION_VIEW', $sSpacer);
$xtpl->assign('FOLDER_ACTION_GENTHUMB', $sSpacer);
// *****************************************
// Display the Delete Icons For the Folders
// *****************************************
if (check_auth($sql->f("id"), "folder_delete", $userid, false, false) == 1)
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['action'] = 'folder_delete';
$url = fGetURL ('dbmodify.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_DEL', "<a href=\"$url\" onclick=\"return confirm('$owl_lang->reallydelete " . htmlspecialchars($sql->f("name"), ENT_QUOTES) . "?');\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/trash.gif\" title=\"$owl_lang->alt_del_folder\" border=\"0\" /></a>");
}
// *****************************************
// Display the Property Icons For the Folders
// *****************************************
if (check_auth($sql->f("id"), "folder_property", $userid, false, false) == 1)
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['action'] = 'folder_modify';
$url = fGetURL ('modify.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_MOD', "<a href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/edit.gif\" border=\"0\" alt=\"$owl_lang->alt_mod_folder\" title=\"$owl_lang->alt_mod_folder\" /></a>");
}
if ( $default->advanced_security == 1 )
{
if (check_auth($sql->f("id"), "folder_acl", $userid, false, false) == 1)
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['parent'] = $parent;
$urlArgs2['edit'] = 1;
$urlArgs2['action'] = "folder_acl";
$sUrl = fGetURL ('setacl.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_ACL', "<a href=\"$sUrl\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/setacl.png\" border=\"0\" alt=\"$owl_lang->alt_set_folder_acl\" title=\"$owl_lang->alt_set_folder_acl\" /></a>");
}
}
// *****************************************
// Display the move Icons For the Folders
// *****************************************
//if (check_auth($sql->f("id"), "folder_modify", $userid, false, false) == 1 and check_auth($sql->f("id"), "folder_delete", $userid, false, false) == 1)
if (check_auth($sql->f("id"), "folder_cp", $userid, false, false) == 1)
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['action'] = 'cp_folder';
$urlArgs2['parent'] = $parent;
$url = fGetURL ('move.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_COPY', "<a href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/copy.gif\" border=\"0\" alt=\"$owl_lang->alt_copy_folder\" title=\"$owl_lang->alt_copy_folder\" /></a>");
}
if (check_auth($sql->f("id"), "folder_move", $userid, false, false) == 1)
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['action'] = 'folder';
$urlArgs2['parent'] = $parent;
$url = fGetURL ('move.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_MOVE', "<a href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/move.gif\" border=\"0\" alt=\"$owl_lang->alt_move_folder\" title=\"$owl_lang->alt_move_folder\" /></a>");
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['action'] = 'lnk_folder';
$urlArgs2['parent'] = $parent;
$url = fGetURL ('move.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_LINK', "<a href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/fld_link.gif\" border=\"0\" alt=\"LINK THIS FOLDER\" title=\"LINK THIS FOLDER\" /></a>");
}
//if (check_auth($sql->f("id"), "folder_view", $userid, false, false) == 1)
if (check_auth($sql->f("id"), "folder_monitor", $userid, false, false) == 1)
{
$folder_id = $sql->f("id");
$checksql = new Owl_DB;
$checksql->query("select * from $default->owl_monitored_folder_table where fid = '$folder_id' and userid = '$userid'");
$checknumrows = $checksql->num_rows($checksql);
$checksql->query("SELECT * from $default->owl_users_table where id = '$userid'");
$checksql->next_record();
if (trim($checksql->f("email")) != "")
{
if ($checknumrows == 0)
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $folder_id;
$urlArgs2['parent'] = $parent;
$urlArgs2['action'] = 'folder_monitor';
$url = fGetURL ('dbmodify.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_MON', "<a href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/monitor.gif\" border=\"0\" alt=\"$owl_lang->alt_monitor_folder\" title=\"$owl_lang->alt_monitor_folder\" /></a>");
}
else
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $folder_id;
$urlArgs2['parent'] = $parent;
$urlArgs2['action'] = 'folder_monitor';
$url = fGetURL ('dbmodify.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_MON', "<a href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/monitored.gif\" border=\"0\" alt=\"$owl_lang->alt_monitored_folder\" title=\"$owl_lang->alt_monitored_folder\" /></a>");
}
}
}
if (check_auth($sql->f("id"), "folder_view", $userid, false, false) == 1)
{
$urlArgs2 = array();
$urlArgs2['sess'] = $sess;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['parent'] = $sql->f("parent");
$urlArgs2['action'] = 'folder';
$urlArgs2['binary'] = 1;
$urlArgs2['expand'] = $expand;
$urlArgs2['order'] = $order;
$urlArgs2['sortorder'] = $sort;
$url = fGetURL ('download.php', $urlArgs2);
if (file_exists($default->tar_path) && trim($default->tar_path) != "" && file_exists($default->gzip_path) && trim($default->gzip_path) != "")
{
$xtpl->assign('FOLDER_ACTION_DNLD', "<a href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_filetype/zip.gif\" border=\"0\" alt=\"$owl_lang->alt_get_folder\" title=\"$owl_lang->alt_get_folder\" /></a>");
}
}
if ($default->thumbnails == 1 and fisAdmin())
{
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['parent'] = $sql->f("parent");
$urlArgs2['action'] = 'folder_thumb';
$sUrl = fGetURL ('dbmodify.php', $urlArgs2);
$xtpl->assign('FOLDER_ACTION_GENTHUMB', "<a href=\"$sUrl\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/thumb.png\" border=\"0\" alt=\"$owl_lang->thumb_re_generate\" title=\"$owl_lang->thumb_re_generate\" /></a>");
}
$xtpl->parse('main.DataBlock.Folder.Action');
}
if ($default->owl_version_control == 1)
{
if (($default->expand_disp_held and $expand == 1) or ($default->collapse_disp_held and $expand == 0))
{
$xtpl->parse('main.DataBlock.Folder.checked_out');
}
}
$xtpl->parse('main.DataBlock.Folder');
}
if ($default->owl_LookAtHD != "false")
{
$DBFolders[$DBFolderCount + 1] = "[END]"; //end DBfolder array
$RefreshPage = CompareDBnHD('folder', $default->owl_FileDir . DIR_SEP . get_dirpath($parent), $DBFolders, $parent, $default->owl_folders_table);
}
//*************************************
// BEGIN Print Files
//*************************************
//
$DBFileCount = 0;
if ($default->records_per_page > 0)
{
$sql->query("select * from $default->owl_files_table where parent = '$parent'");
while ($sql->next_record())
{
$DBFileCount++; //count number of filez in db 2 use with array
$DBFiles[$DBFileCount] = $sql->f("filename"); //create list if files in
}
}
$sql->query($FileQuery);
while ($sql->next_record())
{
$bPrintNew = false;
$bPrintUpdated = false;
$bFileDownload = check_auth($sql->f("id"), "file_download", $userid, false, false);
if ($default->restrict_view == 1)
{
if (!$bFileDownload)
{
if ($default->records_per_page == 0)
{
$DBFileCount++; //count number of filez in db 2 use with array
$DBFiles[$DBFileCount] = $sql->f("filename"); //create list if files in
}
continue;
}
}
$iIsOneRecPrinted++;
if ($default->peer_review_leave_old_file_accessible)
{
$CheckOlderVersion = new Owl_DB;
$aFirstpExtension = fFindFileFirstpartExtension ($sql->f("filename"));
$firstpart = $aFirstpExtension[0];
$file_extension = $aFirstpExtension[1];
$haveextension = $aFirstpExtension[2];
if ($default->owl_use_fs)
{
$CheckOlderVersion->query("SELECT id FROM $default->owl_folders_table WHERE name='$default->version_control_backup_dir_name' and parent='$parent'");
if ($CheckOlderVersion->num_rows($CheckOlderVersion) != 0)
{
while ($CheckOlderVersion->next_record())
{
$backup_parent = $CheckOlderVersion->f("id");
}
}
else
{
$backup_parent = $parent;
}
$sQuery = "SELECT * FROM $default->owl_files_table WHERE (filename LIKE '" . $firstpart . "\\_%" . $file_extension . "') AND (parent = '$backup_parent' OR parent = '$parent') ORDER BY major_revision desc, minor_revision desc";
$CheckOlderVersion->query($sQuery);
}
else
{
// name based query -- assuming that the given name for the file doesn't change...
// at some point, we should really look into creating a "revision_id" field so that all revisions can be linked.
// in the meanwhile, the code for changing the Title of the file has been altered to go back and
$name = flid_to_name($id);
$sQuery = "select * from $default->owl_files_table where name='$name' AND parent='$parent' order by major_revision desc, minor_revision desc";
$CheckOlderVersion->query($sQuery);
}
$iNumrows = $CheckOlderVersion->num_rows();
}
if ($sql->f("approved") == 0 and !$default->peer_review_leave_old_file_accessible)
{
if ($iNumrows == 0)
{
$DBFileCount++; //count number of filez in db 2 use with array
$DBFiles[$DBFileCount] = $sql->f("filename"); //create list if files in
continue;
}
}
if ($default->records_per_page > 0)
{
if ($default->restrict_view == 1)
{
$iRecordCounter++;
if ($iRecordCounter > $iPageEndCount or $iRecordCounter <= $iPageStartCount )
{
continue;
}
}
}
//
// Find New files
//
if ($bFileDownload == 1)
{
if ($sql->f("created") > $lastlogin)
{
$bPrintNew = true;
}
if ($sql->f("smodified") > $lastlogin and $sql->f("created") < $lastlogin)
{
$bPrintUpdated = true;
}
}
// ******************************************
// Check to see if this file as any comments
// ******************************************
$bHasComments = true;
$bPrintNewComment = false;
$CheckComments = $cCommonDBConnection;
if (empty($CheckComments))
{
$CheckComments = new Owl_DB;
}
$CheckComments->query("SELECT comment_date from $default->owl_comment_table where fid = '" . $sql->f("id") . "' order by comment_date desc");
$iTotalComments = $CheckComments->num_rows();
$CheckComments->next_record();
if ($CheckComments->f("comment_date") > $lastlogin)
{
$bPrintNewComment = true;
}
if ($iTotalComments == 0)
{
$bHasComments = false;
}
// ******************************************
// Check to see if this file is Word Indexed
// ******************************************
$CheckComments->query("SELECT owlfileid from $default->owl_searchidx where owlfileid = '" . $sql->f("id") . "'");
if ($CheckComments->num_rows() > 0)
{
$bWasIndexed = true;
}
else
{
$bWasIndexed = false;
}
$iRealFileID = fGetPhysicalFileId($sql->f('id'));
$CountLines++;
$PrintLines = $CountLines % 2;
if ($PrintLines == 0)
{
$sTrClass = "hover1";
$sLfList = "lfile1";
$sTrClassHilite = "mouseover1";
$sTrClassHiliteAlt = "mouseover3";
}
else
{
$sTrClass = "hover2";
$sLfList = "lfile1";
$sTrClassHilite = "mouseover2";
$sTrClassHiliteAlt = "mouseover3";
}
$xtpl->assign('FILE_TR_ID', "filetr" . $sql->f("id"));
$xtpl->assign('FILE_TR_CLASS', $sTrClassHilite);
$xtpl->assign('FILE_TR_MOUSOVER', "class=\"$sTrClassHilite\" onmouseover=\"alt_css_style('checkid" . $sql->f("id") . "', this, '$sTrClassHiliteAlt')\" onmouseout=\"alt_css_style('checkid" . $sql->f("id") . "', this, '$sTrClassHilite')\"");
$xtpl->assign('FILE_TD_CLASS', $sTrClass);
if ($fileid == $sql->f("id"))
{
$sBoldBegin = '<b class="hilite">';
$sBoldEnd = '</b>';
}
else
{
$sBoldBegin = '';
$sBoldEnd = '';
}
if ($default->show_bulk > 0 or (fIsAdmin() and $default->show_bulk == 0 ))
{
if ($sess != "0" || ($sess == "0" && $default->anon_ro == 0))
{
$xtpl->assign('FILE_BULK_CHECKBOX', "<input id=\"checkid" . $sql->f("id") . "\" type=\"checkbox\" name=\"batch[]\" value=\"" . $sql->f("id") . "\" onclick=\"mark_selected('filetr" . $sql->f("id") . "', this, '$sTrClassHilite')\" />");
$xtpl->parse('main.DataBlock.File.Bulk');
}
}
if(($default->expand_disp_status and $expand == 1) or ($default->collapse_disp_status and $expand == 0))
{
if ($default->show_bulk == 0 and ! fIsAdmin())
{
$xtpl->assign('FILE_STATUS', "<input id=\"checkid" . $sql->f("id") . "\" type=\"hidden\" name=\"style_change\" value=\"" . $sql->f("id") . "\" />");
}
$xtpl->assign('FILE_STATUS_COMMENT_IMG', '');
if ($bHasComments)
{
if ($bPrintNewComment)
{
$iImage = "newcomment";
}
else
{
$iImage = "comment";
}
$urlArgs2 = $urlArgs;
$urlArgs2['id'] = $sql->f("id");
$urlArgs2['parent'] = $parent;
$urlArgs2['action'] = 'file_comment';
$url = fGetURL ('modify.php', $urlArgs2);
$xtpl->assign('FILE_STATUS_COMMENT_IMG', "<a class=\"$sLfList\" href=\"$url\"><img src=\"$default->owl_graphics_url/$default->sButtonStyle/icon_action/$iImage.gif\" border=\"0\" alt=\"$iTotalComments --- $owl_lang->alt_comments\" title=\"$iTotalComments --- $owl_lang->alt_comments\" /></a>");
}
if ($default->anon_user <> $userid)