File: global_vars.php

package info (click to toggle)
dtc 0.35.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,824 kB
  • sloc: php: 50,739; sh: 8,596; makefile: 572; perl: 148; xml: 25
file content (144 lines) | stat: -rw-r--r-- 5,639 bytes parent folder | download
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
<?php

// Those are supposed to be filled at eatch queries, therefore they
// are global variables.

$send_email_header = "Content-Type: text/plain; charset=\"UTF-8\"\n";
// I'm not sure wich of the following 2 I should use when using UTF-8 ...
//$send_email_header .= "Content-Transfer-Encoding: 8bit\n";
$send_email_header .= "Content-Transfer-Encoding: quoted-printable\n";

$version_ar = explode(".",phpversion());
$php_major_vers = $version_ar[0];
$php_minor_vers = $version_ar[1];
if($php_major_vers > 5 || ($php_major_vers == 5 && $php_minor_vers >= 4)){
        $php_vers_bigger_than_53 = 1;
}else{
        $php_vers_bigger_than_53 = 0;
}

if(isset($_REQUEST["rub"])){
	if(!preg_match("/^([a-z0-9]+)([.a-z_0-9-]*)([a-z0-9]+)\$/",$_REQUEST["rub"]) && $_REQUEST["rub"] != ""){
		die("Rub parameter not correct: XSS attempt?");
	}
	$rub = $_REQUEST["rub"];
}

if(isset($_REQUEST["rub"]) && $_REQUEST["rub"] == "crm"){
	if(isset( $_REQUEST["id_client"] )){
		$id_client = $_REQUEST["id_client"];
		if($id_client != "" && isset($id_client) && !preg_match("/^([0-9]+)\$/",$id_client)){
			die("The provided id_client does not seems to be in the correct format. It should be a single number.");
		}
	}
}

if(isset($_REQUEST["adm_login"]))	$adm_login = $_REQUEST["adm_login"];
else	$adm_login = "";
if(isset($_REQUEST["adm_pass"]))	$adm_pass = $_REQUEST["adm_pass"];
else	$adm_pass = "";
if(isset($_REQUEST["adm_email_login"]))	$adm_email_login = $_REQUEST["adm_email_login"];
else	$adm_email_login = "";
if(isset($_REQUEST["adm_email_pass"]))	$adm_email_pass = $_REQUEST["adm_email_pass"];
else	$adm_email_pass = "";
if(isset($_REQUEST["addrlink"]))	$addrlink = $_REQUEST["addrlink"];
else	$addrlink = "";

function isValidEmailLogin($email){
        $reg = "/^([a-z0-9]+)([_.a-z0-9-]+)@([a-z0-9]+)([-a-z0-9.]*)\.([a-z0-9-]*)([a-z0-9]+)\$/";
        if(!preg_match($reg,$email))  return false;
        else                    return true;
}


if(isset($adm_login) && !preg_match("/^([a-zA-Z0-9]+)([._a-zA-Z0-9-]+)\$/",$adm_login) && $adm_login != ""){
	die("DTC client login error: Requested login does not look like to be correct. It should be made only with letters, numbers, \".\" or \"-\" signs.");
}
if(isset($adm_pass) && !preg_match("/^([a-zA-Z0-9]+)([._a-zA-Z0-9-]+)([a-zA-Z0-9])\$/",$adm_pass) && $adm_pass != ""){
	die("DTC client login error: Requested pass does not look like to be correct. It should be made only with letters, numbers, \".\" or \"-\" signs.");
}
if(isset($adm_email_login) && !preg_match("/^([a-z0-9]+)([_.a-z0-9-]*)@([a-z0-9]+)([-a-z0-9.]*)\.([a-z0-9-]*)([a-z0-9]+)\$/",$adm_email_login) && $adm_email_login != ""){
	die("DTC email client login error: Requested login does not look like to be correct. It should be made only with letters, numbers, \".\" or \"-\" signs.");
}
if(isset($adm_email_pass) && !preg_match("/^([a-zA-Z0-9]+)([._a-zA-Z0-9-]+)([a-zA-Z0-9])\$/",$adm_email_pass) && $adm_email_pass != ""){
	die("DTC email client login error: Requested pass does not look like to be correct. It should be made only with letters, numbers, \".\" or \"-\" signs.");
}

if(isset($addrlink) && $addrlink != ""){
        $check = str_replace(":","",$addrlink);
        $check = str_replace("/","",$check);
        if(!preg_match("/^([a-z0-9]+)([.a-z0-9-]+)([a-z0-9])\$/",$check)){
                die("Parameter incorect in addrlink.");
        }

	$vps_exploded = explode(":",$addrlink);
	if(sizeof($vps_exploded) > 1){
		$server_subscreen = $vps_exploded[0];
		switch($server_subscreen){
		case "server":
			$dedicated_server_hostname = $vps_exploded[1];
			break;
		case "vps":
			$vps_node = $vps_exploded[1];
			$vps_last_value = explode("/",$vps_exploded[2]);
			if( sizeof($vps_last_value) > 1){
				$vps_subcommand = $vps_last_value[1];
				$vps_name = $vps_last_value[0];
			}else{
				$vps_name = $vps_exploded[2];
			}
			break;
		case "custom":
			$custom_id = $vps_exploded[1];
			break;
		default:
			die("No command recognized and a : in \$addrlink line ".__LINE__." file ".__FILE__);
		}
	}else{
	        $exploded = explode("/",$addrlink);
	        if($addrlink != "help" && $addrlink != "database"){
	        	if(sizeof($exploded) > 1)	$whatdoiedit = $exploded[1];
	                $edit_domain = $exploded[0];
	        }
	}
}

if(isset($whatdoiedit) && $whatdoiedit == "nickhandles" && isset($_REQUEST["edit_id"])){
	$edit_id = $_REQUEST["edit_id"];
}

if($panel_type != "email" && isset($edit_domain) && !preg_match("/^([a-z0-9]+)([.a-z0-9-]+)([a-z0-9])\$/",$edit_domain) && $edit_domain != ""){
	die("The domain provided does not look like a correct domain name...");
}

require("$dtcshared_path/inc/idna_convert.class.php");
$idn = new idna_convert(array('idn_version' => 2008));
if (isset($edit_domain)) {
	$edit_domain_idn = $idn->decode($edit_domain);	
}

//don't save things into the session for cronjobs
if($panel_type!="cronjob"){
	// Save menu style preference in session
	@session_start();
	if(isset($dtc_use_text_menu)) $_SESSION["dtc_use_text_menu"]=$dtc_use_text_menu;
	if(isset($_SESSION["dtc_use_text_menu"]) && !is_string($_SESSION["dtc_use_text_menu"])){
		unset($dtc_use_text_menu);
	}
	if(isset($_SESSION["dtc_use_text_menu"])){
		$dtc_use_text_menu = $_SESSION["dtc_use_text_menu"];
	}
	if(isset($_REQUEST["use_text_menu"]) && $_REQUEST["use_text_menu"] == "yes"){
		$dtc_use_text_menu = "yes";
	}
	if(isset($_REQUEST["use_text_menu"]) && $_REQUEST["use_text_menu"] == "no"){
		$dtc_use_text_menu = "no";
	}
	if(!isset($dtc_use_text_menu) || !is_string($dtc_use_text_menu)){
		$dtc_use_text_menu = "no";
	}
	$_SESSION["dtc_use_text_menu"] = $dtc_use_text_menu;
}


?>