This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_functions.php
82 lines (60 loc) · 1.86 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
<?php
// Get the language functions
$language = $system_language;
systeminc('language');
$_language = new Language;
$_language->set_language($language);
// -- Additional Database Functions -- //
systeminc('database');
// Filter REQUEST_URI for use with causes
function page($page){
$page = str_replace('/', '', $_SERVER['REQUEST_URI']);
$page = str_replace('.php', '', $page);
return $page;
}
$page = page($_SERVER['REQUEST_URI']);
// -- SITE VARIABLE -- //
if(isset($_GET['site'])) $site = $_GET['site'];
elseif(($page == 'index')) $site = 'homepage';
else $site = 'overview';
// -- Action Variable -- //
if(isset($_GET['action'])) $action = $_GET['action'];
else $action = '';
// -- Template Function -- //
function gettemplate($template,$endung="htm", $calledfrom="root") {
$templatefolder = "templates";
if($calledfrom=='root') {
return str_replace("\"", "\\\"", $GLOBALS['_language']->replace(file_get_contents($templatefolder."/".$template.".".$endung)));
}
elseif($calledfrom=='backend') {
return str_replace("\"", "\\\"", $GLOBALS['_language']->replace(file_get_contents("../".$templatefolder."/".$template.".".$endung)));
}
}
// -- SEARCH ENGINE OPTIMIZATION (SEO) -- //
if(stristr($_SERVER['PHP_SELF'],"/admin/") == false){
systeminc('seo');
}
else{
define('PAGETITLE', $GLOBALS['hp_title']);
}
// Slug Generator for URLS und Dropdown Menus
function generateSlug($string)
{
$string=strtolower($string);
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
return $slug;
}
// -- User Stuff -- //
systeminc('users');
if(isset($_SESSION['userID'])) $userID = $_SESSION['userID'];
else $userID = '';
// -- RANDOM PASSWORD CREATION -- //
function new_password($length){
$bytes = openssl_random_pseudo_bytes($length);
$password = bin2hex($bytes);
return $password;
}
// -- Current Year -- //
$year = time();
$currentyear = date("Y",$year);
?>