Subversion Repositories web.creative

Rev

Rev 11 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
1 mjordaan 1
<?php
2
# vim:et:ts=3:sts=3:sw=3:
3
 
4
// RLD Creative base functions
5
// Copyright (C) 2017 RLD Creative
6
//
7
 
8
/* ======================================================================
9
 * Function get_docroot()
10
 * Parameters: 
11
 * Returns: root document dir
12
 *
13
 * Get the root dir from the ccurrent webpage.
14
 * ====================================================================== */
15
function get_docroot() {
16
  $docroot = $_SERVER['SCRIPT_FILENAME'];
17
  $filename = $_SERVER['PHP_SELF'];
18
 
19
  //backslashes vervangen door forward slashes
20
  $docroot = str_replace("\\", "/", $docroot);
21
 
22
  //bepaal positie waar bestandsnaam start
23
  $positie = strpos( $docroot, $filename);
24
 
25
  //filenaam van docroot verwijderen en document root afleveren
26
  return substr( $docroot, 0, $positie);
27
} //get_docroot
28
 
29
 
30
//load configuration settings
31
include_once( get_docroot()."/include/config_inc.php");
32
 
33
/* Return the registered company name */
34
function get_company() {
35
  global $config;
36
 
37
  echo( $config["company"]);
38
}
39
 
40
/* return the configured page title */
41
function get_title() {
42
  global $config;
43
 
44
  echo( $config["title"]);
45
}
46
 
47
/* return home page url */
48
function get_homepage() {
49
 
50
  echo('/');  
51
}
52
 
53
/* return the configured page title */
54
function get_page_title() {
55
  global $page_title;
56
 
57
  $page = basename($_SERVER["SCRIPT_FILENAME"], '.php');
58
 
59
	if (empty($page_title[$page])) {
60
    echo( $page_title["index"]);
61
  } else {
62
    echo( $page_title[$page]); 
63
  }
64
}
65
 
66
//set actuele kleurschema
67
function set_kleurschema( $schema = 0) {
68
  global $config;
69
 
70
  $config["kleurschema"] = $schema;
71
}
72
 
73
function get_kleur( $index = 0, $hash = 1) {
74
 global $kleur_hexa, $config;
75
 
76
  $x = $config["kleurschema"];
77
 
78
  if ($index < 0) {$index = 0;}
79
  if ($index > 6) {$index = 6;}
80
  if ($index > 4) {$x = 0;}
81
  if ($hash != 0) { 
82
    echo( '#'.$kleur_hexa[$x][$index]);
83
  }
84
  else {
85
    echo( $kleur_hexa[$x][$index]);
86
  }
87
}
88
 
89
function get_kleur_a( $index = 0) {
90
 global $kleur_rgba, $config;
91
 
92
  $x = $config["kleurschema"];
93
 
94
  if ($index < 0) {$index = 0;}
95
  if ($index > 6) {$index = 6;}
96
  if ($index > 4) {$x = 0;}
97
 
98
  echo( $kleur_rgba[$x][$index]);
99
}
100
 
101
?>
102
 
103