-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
executable file
·90 lines (87 loc) · 2.18 KB
/
functions.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
<?php
function pms_jquery1()
{
global $pms_domain;
echo "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>\n";
}
function pms_jquery2()
{
global $pms_domain;
echo "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\n";
}
function pms_lightbox()
{
global $pms_domain;
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://" . $pms_domain . "/lightbox/css/lightbox.css\">\n";
echo "<script type=\"text/javascript\" src=\"http://" . $pms_domain . "/lightbox/js/lightbox-2.6.min.js\"></script>\n";
}
function pms_bootstrap3()
{
global $pms_domain;
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://" . $pms_domain . "/bootstrap/3/css/bootstrap.css\">\n";
echo "<script type=\"text/javascript\" src=\"http://" . $pms_domain . "/bootstrap/3/js/bootstrap.min.js\"></script>\n";
}
function pms_get_page()
{
global $page;
if (isset($_GET['error']))
{
switch($_GET['error']) {
case 404:
echo "Reguested file not found. <br />";
break;
case 403:
echo "You aren´t allowed to visit this page. <br />";
break;
default:
echo "Loading this page ended with error " . $_GET['error'] . ".<br />";
}
}
elseif(isset($_GET['page']))
{
include("pages/" . $page);
}
else
{
include("pages/Home.php");
}
}
function pms_get_pages()
{
global $pms_domain;
global $pagename;
if (isset($_SESSION['pass']))
{
$pages = array_diff(scandir("../pages/"), array('..', '.', 'Home.php'));
}
else
{
$pages = array_diff(scandir("pages/"), array('..', '.', 'Home.php'));
}
$pages = str_replace(".php", "", $pages);
return $pages;
}
function pms_viewcount()
{
$fp = fopen("admin/count.txt", "r");
$count = fgets($fp, 200);
fclose($fp);
$count = $count + 1;
$fp = fopen("admin/count.txt", "w");
fwrite($fp, $count);
fclose($fp);
}
function pms_contact_write($mail, $text)
{
$mail = htmlspecialchars($mail);
$mail = str_replace("+++", "#", $mail);
$text = nl2br(htmlspecialchars($text));
$text = str_replace("+++", "#", $text);
$fp = fopen("admin/msg.txt", "a");
$write = $mail . "+++" . $text . "+++" . time() . "\n";
if (fwrite($fp, $write))
{return 1;}
else {return 0;}
fclose($fp);
}
?>