-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp.php
executable file
·897 lines (782 loc) · 28.6 KB
/
php.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
<?php
####################################################################################################
#
# PHP - Personal Home Page system
# Copyright 2012-2013: Andrew Rump ([email protected])
#
# History
# 0.1 12-11-12 Created
# 0.2 13-11-12 Implemented access control ground work
# 0.3 14-11-12
# 0.4 15-11-12
# 0.5 16-11-12 Centered Gallery and footer and fiexed menu code
# 0.6 17-11-12 Rewrote menu code
# 0.7 19-11-12 Implemented one level menu code hack
# 0.8 21-11-12 Renamed the project to PHP - Personal Home Page system :-D
# 0.9 02-12-12
# 1.0 02-12-12
# 1.1 04-12-12 Fixed a bug (by removing a comma in a Gallery conf)
# 1.2 05-12-12
# 1.3 05-12-12 Implemented LOCAL_GALLERY
# 1.4
# 1.5 17-12-12 Implemented RECUSIVE_GALLERY
# 1.6 20-12-12 Implemented RECUSIVE_GALLERY
# 1.7 20-12-12 Implemented TABLE extra
# 1.8 xx-01-13 Enhanced the snow JavaScript to show falen stars
# 1.9 15-03-13 Fixed a bug after One.com enhanced security
#
# Include this file an you have a simple but full blown website with:
# * Automagic menu
# * Automagic user control
# * Automagic gallery
# * CSS support
# * Easy HTML code generation
#
####################################################################################################
#
# Configuration
#
define('SITE_NAME', 'Weber Design');
define('DEFAULT_CSS', "/include/birgith.css");
define('VERSION', "1.9");
#############################################################################################
#
# Call php in each php file with the content you want on that page and you are done!
# Use the values below to configure the content on the page
#
define('NO_OPTIONS', 0);
define('NO_GALLERY', NO_OPTIONS);
define('RANDOM_PICTURE', 1);
define('LOCAL_GALLERY', 2 * RANDOM_PICTURE);
define('RANDOM_GALLERY', 2 * LOCAL_GALLERY);
define('RECURSIVE_GALLERY', 2 * RANDOM_GALLERY);
define('BOTTOM_GALLERY', 2 * RECURSIVE_GALLERY);
define('GALLERY_OPTIONS', RANDOM_PICTURE + LOCAL_GALLERY + RANDOM_GALLERY +
RECURSIVE_GALLERY + BOTTOM_GALLERY);
define('NO_SHARE', 2 * BOTTOM_GALLERY);
define('NO_COPYRIGHT', 2 * NO_SHARE);
####################################################################################################
#
# BUGS:
# 12-11-12 A lot of cleanup required! A lot of duplicat and badly written code
# 19-11-12 +Files in the top folder are not made submenu to the top menu?!?
# 24-11-12 +Using the wrong charset in <HEAD>
# 14-12-12 RANDOM_GALLERY only randomize each directory and not all images
# 05-01-13 Folders should have / at the end (or an extra roundtrip to the server is performed)
# TODO:
# 15-11-12 +Use htmlspecialchars() in HREF() and escape possible
# 15-11-12 +Cleanup $dirname usage
# 17-11-12 +Implement general global name, i.e., Weber Design (but not on home page)
# 17-11-12 +Implement image upload and image.alt edit
# 17-11-12 +Implement Form incl. spam
# 17-11-12 +Implement mail submit incl. spam
# 22-11-12 -Blog
# 22-11-12 -Mailingliste
# 22-11-12 -Automagic 404 reporting
# 26-11-12 *Mindre bred tekst
# 26-11-12 +Baggrundsbillede
# 26-11-12 *Copyright med mere hele ned i bunden
# DONE:
# 12-11-12 *Menu code not working
# 13-11-12 -Remove newline from title from control file
# 12-11-12 +Center footer and gallery
# 15-11-12 +Put some code above gallery, e.g., header
# 13-11-12 *Implement access control
# 17-11-12 *Create random image playlist
# 18-11-12 *404.php not working
# 24-11-12 +Add favicon.ico
# <link rel="shortcut icon" href="http://yourdomain.com/favicon.ico" type="image/vnd.microsoft.icon">
# NONE:
# 17-11-12 -Find images recursively
#
####################################################################################################
#<FORM method="post" action="http://www.dit-domæne.dk/cgi-bin/FormMail.pl">
#<input type="hidden" name="recipient" value="mail@dit-domæne.dk">
#<input type="hidden" name="subject" value="Her kan du skrive en emne-tekst">
#<input type="hidden" name="redirect" value="http://www.dit-domæne.dk/nyside.html">
#Navn:<INPUT TYPE="TEXT" VALUE="" NAME="Navn" SIZE="20">
#Efternavn:<INPUT TYPE="TEXT" VALUE="" NAME="Efternavn" SIZE="20">
#Mail:<INPUT TYPE="TEXT" VALUE="" NAME="Mail" SIZE="20">
#Kommentar:<TEXTAREA name="Kommentar" COLS="40" ROWS="7"> </TEXTAREA>
#<INPUT TYPE="Reset" VALUE="Nulstil"><INPUT TYPE="Submit" VALUE="Send">
#</form>
####################################################################################################
#
$error_level = $_REQUEST["error_level"]; # BUG sanitize
error_reporting(~0); # -1
error_reporting(E_ALL);
#############################################################################################
#
# Default values
#
define('DEFAULT_LEVEL', 1);
define('DEFAULT_PAGE', 'index.php');
define('DEFAULT_TEST', 'index1.php');
define('IMG_ALT_FILE', 'images.alt');
#############################################################################################
#
# HTML helper functions
#
function fixtags($text) {
$text = htmlspecialchars($text);
$text = preg_replace("/=/", "=\"\"", $text);
$text = preg_replace("/"/", ""\"", $text);
$tags = "/<(\/|)(\w*)(\ |)(\w*)([\\\=]*)(?|(\")\""\"|)(?|(.*)?"(\")|)([\ ]?)(\/|)>/i";
$replacement = "<$1$2$3$4$5$6$7$8$9$10>";
$text = preg_replace($tags, $replacement, $text);
$text = preg_replace("/=\"\"/", "=", $text);
return $text;
}
#############################################################################################
#
# Expand HTML statements
#
function expand($HTML, $contentvalue = NULL, $newline = true, $attributes = NULL, $extra = NULL)
{
if (is_null($contentvalue) or is_numeric($contentvalue))
if (!is_null($contentvalue) and $contentvalue)
if (is_null($attributes))
return "<" . $HTML . ">" . ($newline ? "\n" : "");
else
return "<" . $HTML . " " . $attributes . ">" . ($newline ? "\n" : "");
else
return "</" . $HTML . ">" . ($newline ? "\n" : "");
else
if (is_null($attributes))
return "<" . $HTML . ">" . ($newline ? "\n" : "") . $contentvalue .
"</" . $HTML . ">" . ($newline ? "\n" : "");
else
return "<" . $HTML . " " . $attributes . ">" . ($newline ? "\n" : "") . $contentvalue .
"</" . $HTML . ">" . ($newline ? "\n" : "");
}
#############################################################################################
#
# HTML DIV tag
#
function DIV($id = NULL, $contentvalue = NULL, $newline = true)
{
if (is_null($id) or is_null($contentvalue) or is_numeric($contentvalue))
if (!is_null($id) and (is_null($contentvalue) or is_numeric($contentvalue) and $contentvalue))
return "<DIV ID='" . $id. "'>" . ($newline ? "\n" : "");
else
return "</DIV>" . ($newline ? "\n" : "");
else
return "<DIV ID='" . $id. "'>\n" . $contentvalue . "</DIV>" . ($newline ? "\n" : "");
}
#############################################################################################
#
# HTML Header tag
#
function H($level, $header)
{
return "<H" . $level . ">" . $header . "</H" . $level . ">\n";
}
#############################################################################################
#
# HTML Paragraph tag
#
function P($paragraph)
{
return "<P>" . $paragraph . "</P>\n";
}
#############################################################################################
#
# HTML Bold tag
#
function B($paragraph, $newline = false)
{
return "<B>" . $paragraph . "</B>" . ($newline ? "\n" : "");
}
#############################################################################################
#
# HTML EMpazise tag
#
function EM($paragraph, $newline = false)
{
return "<EM>" . $paragraph . "</EM>" . ($newline ? "\n" : "");
}
#############################################################################################
#
# HTML BLOCKQUOTE tag
#
function BLOCKQUOTE($contentvalue = NULL)
{ # cite="http"
return expand("BLOCKQUOTE", $contentvalue);
}
#############################################################################################
#
# HTML Horizontal Row tag
#
function HR()
{
return "<HR>\n";
}
#############################################################################################
#
# HTML BReak tag
#
function BR()
{
return "<BR>\n";
}
#############################################################################################
#
# HTML HREF tag
#
function HREF($text, $link, $target = NULL, $newline = true, $active = true)
{
if ($active)
if (!is_null($target) and strlen($target) > 0)
return "<A HREF=\"" . $link . "\" TARGET=\"" . $target . "\">" .
$text . "</A>" . ($newline ? "\n" : "");
else
if (strncmp($link, "http", 4) == 0 or strlen($_SERVER["QUERY_STRING"]) == 0)
return "<A HREF=\"" . $link . "\">" . $text . "</A>" .
($newline ? "\n" : "");
else
return "<A HREF=\"" . $link . "?" . $_SERVER["QUERY_STRING"] . "\">" .
$text . "</A>" . ($newline ? "\n" : "");
else
return $text . ($newline ? "\n" : "");
}
#############################################################################################
#
# HTML ADDRESS tag
#
function ADDRESS($contentvalue = NULL)
{
return expand("ADDRESS", $contentvalue);
}
#############################################################################################
#
# HTML Unordered List tag
#
function UL($contentvalue = NULL)
{
return expand("UL", $contentvalue);
}
#############################################################################################
#
# HTML Ordered List tag
#
function OL($contentvalue = NULL)
{
return expand("OL", $contentvalue);
}
#############################################################################################
#
# HTML LIst tag
#
function LI($contentvalue = NULL, $id = NULL, $class = NULL, $newline = true)
{
$LI = "<LI". ($id ? " ID='" . $id . "'" : "") .
($class ? " CLASS='" . $class . "'" : "") . ">" . ($newline ? "\n" : "");
if (is_null($contentvalue) or is_numeric($contentvalue))
if (!is_null($contentvalue) and $contentvalue)
return $LI;
else
return "</LI>" . ($newline ? "\n" : "");
else
return $LI . $contentvalue . "</LI>" . ($newline ? "\n" : "");
}
#############################################################################################
#
# HTML IMaGe tag
#
function IMG($path, $alternate = NULL, $newline = true, $extra = NULL)
{
$img = "<IMG SRC='" . $path . "'";
if (!is_null($alternate))
$img .= " ALT='" . htmlspecialchars($alternate) . "'";
if (!is_null($extra))
$img .= " " . $extra;
return $img . '>' . ($newline ? "\n" : "");
}
#############################################################################################
#
# HTML SPAN tag
#
function SPAN($contentvalue, $newline = true, $attributes = NULL)
{
return expand("SPAN", $contentvalue, $newline, $attributes);
}
#############################################################################################
#
# HTML TABLE tag
#
function TABLE($contentvalue)
{
return expand("TABLE", $contentvalue);
}
#############################################################################################
#
# HTML Table Row tag
#
function TR($contentvalue)
{
return expand("TR", $contentvalue);
}
#############################################################################################
#
# HTML Table Heading tag
#
function TH($contentvalue, $newline = true, $extra = NULL)
{
return expand("TH", $contentvalue, $newline, $extra);
}
#############################################################################################
#
# HTML Table Data tag
#
function TD($contentvalue, $newline = true, $extra = NULL)
{
return expand("TD", $contentvalue, $newline, $extra);
}
#############################################################################################
#
# Check if the scriptfile is a file having the extension .php. If so get the first line
# from the file and extract the: order number, access control and header from the file.
# The access control has the following access levels:
# ! = invisible (e.g., 404), * = everyone, + = 2, - = 3, ...
#
function cms_control($scriptfilename, $access)
{
#define(TITLE, "<?php #");
$header = array(-1, "X", htmlspecialchars("(Undefined)"), -1);
if (is_file($scriptfilename)) {
$parts = explode(".", $scriptfilename);
if (is_array($parts) && count($parts) > 1) {
$ext = strtolower(end($parts));
if (strcmp($ext, "php") == 0) {
$handle = fopen($scriptfilename, "r");
$control = fgets($handle);
fclose($handle);
#if (ereg("<\?php +# +([0-9]+)([\!\*\+-])(.*)", $control, $regs)) {
if (preg_match("/^<\?php +# +([0-9]+)([\!\*\+-])(.*)/", $control, $regs)) {
$level = strpos('!*+-/\\', $regs[2]); # \/\\
if ($access >= $level) {
$header = array($regs[1], $regs[2], htmlspecialchars(rtrim($regs[3])), $level);
}
}
}
}
}
return $header;
}
#############################################################################################
#
# Create a menu structure by checking all the files and make a Unordered List with CSS tags
# which CssMenuMaker can work with
#
# http://cssmenumaker.com
#
#<div id='cssmenu'>
#<ul>
# <li class='active '><a href='index.html'><span>Home</span></a></li>
# <li class='has-sub '><a href='#'><span>Products</span></a>
# <ul>
# <li><a href='#'><span>Product 1</span></a></li>
# <li><a href='#'><span>Product 2</span></a></li>
# </ul>
# </li>
# <li><a href='#'><span>About</span></a></li>
# <li><a href='#'><span>Contact</span></a></li>
#</ul>
#</div>
function create_menu($docroot, $scriptname, $access)
{
if ($hDir = opendir($docroot)) {
while (($entry = readdir($hDir)) !== false) {
if ($entry[0] != '.' and $entry[0] != '..') { # Assume . and .. are dir to avoid warnings
if (is_dir($docroot . '/' . $entry)) {
$control = cms_control($docroot . '/' . $entry . '/' . DEFAULT_PAGE, $access);
if ($control[3] >= DEFAULT_LEVEL) {
if ($hFiles = opendir($docroot . '/' . $entry)) {
$files = NULL;
while (($fil = readdir($hFiles)) !== false) {
if ($fil != '.' and $fil != '..') { # Assume . and .. are dir to avoid warnings
if (is_file($docroot . '/' . $entry . '/' . $fil)) {
$ctrl = cms_control($docroot . '/' . $entry . '/' . $fil, $access);
if (strcmp($fil, DEFAULT_PAGE) != 0 and strcmp($fil, DEFAULT_TEST) != 0)
if ($ctrl[3] >= DEFAULT_LEVEL) {
$files[$ctrl[0]] = HREF(SPAN($ctrl[2], false), '/' . $entry . '/' . $fil,
NULL, false);
}
}
}
}
closedir($hFiles);
}
$folder[$control[0]] = array(HREF(SPAN($control[2], false), '/' . $entry . '/',
NULL, false), $files);
}
} else {
if (is_file($docroot . '/' . $entry)) {
$control = cms_control($docroot . '/' . $entry, $access);
if (strcmp($entry, DEFAULT_PAGE) == 0 or strcmp($entry, DEFAULT_TEST) == 0)
$entry = '';
if ($control[3] >= DEFAULT_LEVEL)
$file[$control[0]] = HREF(SPAN($control[2], false), '/' . $entry, NULL, false);
}
}
}
}
closedir($hDir);
}
$html = '';
if (!is_null($folder))
{
ksort($folder);
foreach ($folder as $X) {
if (!is_null($X))
ksort($X);
}
}
if (!is_null($file))
ksort($file);
if (empty($folder))
$menu = NULL;
else
$menu = reset($folder);
if (empty($file))
$item = NULL;
else
$item = reset($file);
while (!is_null($menu) or !is_null($item)) {
if (is_null($menu))
$menu_pos = key($file) + 1; # One above, i.e., take the other one
else
$menu_pos = key($folder);
if (is_null($item))
$item_pos = key($folder) + 1; # One above, i.e., take the other one
else
$item_pos = key($file);
$html .= LI(1, NULL, ($menu_pos <= $item_pos and !is_null($menu[1])) ? 'has-sub' : NULL, false);
#strcmp('/' . $entry, $scriptname) == 0 ? 'active' : ''
if ($menu_pos <= $item_pos) {
$html .= $menu[0];
if (!is_null($menu[1])) {
$html .= UL(1);
foreach ($menu[1] as $Z)
$html .= LI($Z);
$html .= UL();
}
$menu = NULL;
} else {
$html .= $item;
$item = NULL;
}
$html .= LI();
if (is_null($menu) and !empty($folder))
if (($menu = next($folder)) === FALSE)
$menu = NULL;
if (is_null($item) and !empty($file))
if (($item = next($file)) === FALSE)
$item = NULL;
}
return $html;
}
#############################################################################################
#
# Find all image files and correspondong IMG_ALT_FILE (which contains ALTernate text to
# the IMaGes and create a list of files
#
function img_from_dir($options = NULL, $imagedir = "")
{
if (strlen($imagedir) == 0)
$imagedir = "./";
else
if (strcmp(substr($imagedir, -1), '/') != 0)
$imagedir .= '/';
$images = NULL;
if (file_exists($imagedir) and $hDir = opendir($imagedir)) {
if (file_exists($imagedir . IMG_ALT_FILE))
if ($img_alt_file = fopen($imagedir . 'images.alt', 'r')) {
while ($array = fgetcsv($img_alt_file))
$img_alt[$array[0]] = $array[1];
fclose($img_alt_file);
}
while (($entry = readdir($hDir)) !== false) {
if ($entry != '.' and $entry != '..') { # Assume . and .. are dir to avoid warnings
if (is_file($imagedir . $entry)) {
$parts = explode(".", $entry);
if (is_array($parts) && count($parts) > 1) {
$ext = strtolower(end($parts));
if (strcmp($ext, "jpg") == 0 or strcmp($ext, "jpeg") == 0 or
strcmp($ext, "gif") == 0 or strcmp($ext, "png") == 0) {
if (isset($img_alt[$entry]))
$images[] .= IMG($imagedir . $entry, htmlspecialchars($img_alt[$entry]));
else
$images[] .= IMG($imagedir . $entry, $entry);
}
}
}
}
}
closedir($hDir);
}
$img_src = "";
if (isset($images) and !is_null($images)) {
if ($options & RANDOM_GALLERY)
shuffle($images);
foreach ($images as $image)
$img_src .= $image;
}
return $img_src;
}
#############################################################################################
#
# Take (a) list(s) of images and write them out in a format ready for Gallery to work with them
#
function gallery($content, $scriptname, $access)
{
if ($content & GALLERY_OPTIONS) {
$path_parts = pathinfo($scriptname);
if ($content & RANDOM_PICTURE)
$img_src = ""; # TODO
else
if ($content & LOCAL_GALLERY)
{
$img_src = img_from_dir($content, 'images_' . $path_parts['filename'] . '/');
}
else
{
$img_src = img_from_dir($content);
$img_src .= img_from_dir($content, 'images/');
if ($content & RECURSIVE_GALLERY) {
# TODO DUP CODE! :-(
if ($hDir = opendir('.')) {
while (($entry = readdir($hDir)) !== false) {
if ($entry[0] != '.' and $entry[0] != '..') { # Assume . and .. are dir to avoid warnings
if (is_dir($entry)) {
$control = cms_control($entry . '/' . DEFAULT_PAGE, $access);
if ($control[3] >= DEFAULT_LEVEL) {
if ($hFiles = opendir($entry)) {
$files = NULL;
while (($fil = readdir($hFiles)) !== false) {
if (is_file($entry . '/' . $fil)) {
$ctrl = cms_control($entry . '/' . $fil, $access);
if ($ctrl[3] >= DEFAULT_LEVEL) {
$image_parts = pathinfo($fil);
$img_src .= img_from_dir($content, $entry . '/images_' .
$image_parts['filename'] . '/');
}
}
}
closedir($hFiles);
}
$img_src .= img_from_dir($content, $entry);
$img_src .= img_from_dir($content, $entry . 'images/');
}
} else {
if (is_file($entry)) {
$control = cms_control($entry, $access);
if (strcmp($entry, DEFAULT_PAGE) == 0 or strcmp($entry, DEFAULT_TEST) == 0)
$entry = DEFAULT_PAGE;
if ($control[3] >= DEFAULT_LEVEL) {
$image_parts = pathinfo($entry);
$img_src .= img_from_dir($content, 'images_' .
$image_parts['filename'] . '/');
}
}
}
}
}
closedir($hDir);
}
}
}
if (strcmp($img_src, "") != 0) {
echo DIV("galleria", $img_src);
?>
<script>
Galleria.loadTheme('/include/galleria/themes/classic/galleria.classic.min.js');
Galleria.run('#galleria', {
autoplay: 7000 // will move forward every 7 seconds
});
//var gallery = Galleria.get(0);
//gallery.play();
</script>
<?php
}
}
}
#############################################################################################
#
# Call php in each php file with the content you want on that page and you are done!
# $content contains the configuration value specified at the beginning of this file.
# $above is the content above the gallery
# $below is the content below the gallery
# $css is used if you want to use another css
# $fakeroot is used if you want to change root
#
function php($content, $above, $below = NULL, $css = NULL, $fakeroot = NULL)
{
#if (is_null($below)) { # You may want it above! :-|
# $below = $above;
# $above = NULL;
#}
$scriptname = $_SERVER["SCRIPT_NAME"];
$scriptfilename = $_SERVER["SCRIPT_FILENAME"];
$docroot = $_SERVER["DOCUMENT_ROOT"];
if (is_null($css))
$css = DEFAULT_CSS;
if (is_null($fakeroot))
$fakeroot = $docroot;
$debug = 0;
if (isset($_REQUEST["debug"]))
$debug = $_REQUEST["debug"]; # BUG sanitize
$access = DEFAULT_LEVEL;
if (isset($_REQUEST["access"]))
$access = $_REQUEST["access"]; # BUG sanitize
$control = cms_control($scriptfilename, $access);
if ($control[0] < 0) { # Deny access to pages not accessable
#header("HTTP/1.0 404 Not Found");
#header("Status: 404 Not Found");
header('Location: /404.php');
#require $docroot . "/404.php";
exit;
}
#############################################################################################
#
# Write out HTML header
#
?>
<!DOCTYPE HTML>
<!--[if lte IE 6]>
<style>#top, #bottom, #left, #right { display: none; }</style>
<![endif]-->
<!--[if lt IE 7 ]><HTML LANG="DA" class="ie6"><![endif]-->
<!--[if IE 7 ]><HTML LANG="DA" class="ie7"><![endif]-->
<!--[if IE 8 ]><HTML LANG="DA" class="ie8"><![endif]-->
<!--[if IE 9 ]><HTML LANG="DA" class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><HTML LANG="DA"><![endif]-->
<HEAD>
<TITLE><?=$control[2] . ' - ' . SITE_NAME; ?></TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<!--<META CONTENT="TEXT/HTML; CHARSET=WINDOWS-1252" HTTP-EQUIV=CONTENT-TYPE>-->
<!--<META HTTP-EQUIV="content-type" CONTENT="text/html; CHARSET=UTF-8">-->
<META NAME="Description" CONTENT="Weber Design, en verden af kreativitet. Smykker, billedkunst, kreativt værksted, ... - rum for fordybelse. Unik kunsthåndværk med håndværksmæssig og kunstnerisk kvalitet.">
<META NAME="Keywords" CONTENT="Birgith, Nicoline, Weber, Weber Design, design, smykker, smykkefremstilling, kunsthåndværk, workshops, kreativitet, undervisning, kurser, indretning, engle, ikoner, billedkunst, decoupage, cup cake, blomsterbinding, blomsterkunst, ...">
<META NAME="Author" CONTENT="Birgith Weber, Nicoline Weber & Andrew Rump">
<META NAME="Generator" CONTENT="Automagically generated by Andrew Rump!">
<META NAME="Timestamp" CONTENT="<?=date("F d, Y H:i:s"); ?>">
<META NAME="Copyright" CONTENT="Copyright©: 2012-<?=date('Y'); ?> Andrew Rump">
<LINK REL="Stylesheet" TYPE="TEXT/CSS" HREF="<?= $css; ?>">
<LINK REL="Stylesheet" TYPE="TEXT/CSS" HREF="/include/galleria/themes/classic/galleria.classic.css">
<META HTTP-EQUIV="Window-target" CONTENT="_top">
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">
<!-- Hide script from older browsers so it doesn't show it
if(top != self)
{top.location = self.location;}
// The above script get the page out of frames -->
</SCRIPT>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src="/include/galleria/galleria-1.2.8.min.js"></script>
<LINK REL="shortcut icon" HREF="/favicon.ico" TYPE="image/x-icon">
<LINK REL="icon" HREF="http://weberdesign.dk/favicon.ico" TYPE="image/vnd.microsoft.icon">
</HEAD>
<BODY>
<?=DIV("container", 1); ?>
<?=DIV("header", 1); ?>
<!-- Facebook Like -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/da_DK/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Facebook Like -->
<?php
#############################################################################################
#
# Write out HTML body
#
echo DIV("cssmenu", UL(create_menu($docroot, $scriptname, $access)));
if (!is_null($above))
echo DIV("content", $above);
# Gallery?
if (!($content & BOTTOM_GALLERY))
gallery($content, $scriptname, $access);
echo DIV("header", 0);
echo DIV("body", 1);
echo DIV("content", $below);
# Gallery?
if ($content & BOTTOM_GALLERY)
gallery($content, $scriptname, $access);
# Copyright?
if (!($content & NO_COPYRIGHT)) {
echo DIV("footer", P("Copyright: © 2012-" . date('Y') . " " .
HREF("Weber Design", "#top", NULL, false)) . " " .
HREF("[email protected]", "mailto:[email protected]", 'target="_blank"', false));
# . "Version: " . VERSION
}
echo DIV("body", 0);
#############################################################################################
#
# Share?
#
if (0 and ($content & NO_SHARE)) {
echo DIV("footer");
?>
<!-- Google+ Share -->
<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share"></div>
<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
window.___gcfg = {lang: 'da'};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<!-- Google+ Share -->
<!-- Facebook Like -->
<div class="fb-like" data-href="http://weberdesign.dk/" data-send="true" data-width="450" data-show-faces="true"></div>
<!-- Facebook Like -->
<?php
#############################################################################################
echo DIV("footer", 0);
}
#############################################################################################
#
# Debug?
#
if ($debug)
phpinfo();
#############################################################################################
?>
<!--
<script>
$("body").text("jQuery works");
</script>
-->
<?=DIV("container", 0); ?>
<div id="left"></div>
<div id="right"></div>
<div id="top"></div>
<div id="bottom"></div>
<?php
#############################################################################################
#
# Animation
#
if (date('n') == 12 or date('n') == 1) {
?>
<SCRIPT TYPE="text/javascript" SRC="/include/snow.js"></SCRIPT>
<?php
} else {
?>
<SCRIPT TYPE="text/javascript" SRC="/include/star.js"></SCRIPT>
<?php
}
#############################################################################################
?>
</BODY>
</HTML>
<?php
}
?>