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
|
<?php
/*
(C) Copyright 2006-2008, GetDeb Team - https://launchpad.net/~getdeb
--------------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?
require_once 'config.php';
$db = DB::connect($dsn);
if (PEAR::isError($db)) {
print "There was an error connecting to the database...<br>";
die($db->getMessage());
}
unset($dsn);
//session_set_cookie_params(0);
if(!isset($skipsession))
session_start();
require 'engine/user.php';
$current_user = new User;
$current_user_data = $current_user->CheckRemember();
if($current_user_data)
{
$smarty->assign("session_user", $current_user_data);
if(time()-$current_user_data['t_seen'] > 5*3600)
{
$_SESSION['user']['t_seen'] = time();
$username = $db->escapeSimple($_SESSION['username']);
$sql = "UPDATE gd_user SET t_seen=NOW() WHERE username=\'+$username+'\'";
$db->Query($sql);
}
}
// Add the stats here
$lang=$locale = $smarty->getCurrentLanguage();
$smarty->assign("lang", $lang);
if(file_exists(FS_ROOT ."/languages/global.$lang.php.problems"))
{
$smarty->assign("lang_problems", 1);
}
//die($smarty->getProblems());
if(($lang != "en") && $_SESSION['user'] && IsMemberOf("Translator", $_SESSION['user']['id']))
$smarty->assign("is_translator", "yes");
if(isset($_COOKIE['app_types']))
$app_types_cookie = $_COOKIE['app_types'];
else
$app_types_cookie = "1";
$app_types = explode(",", $app_types_cookie);
$app_types_str = "";
$app_types_desc = "";
foreach($app_types as $value) {
$id = intval($value);
$name = $db->GetOne("SELECT name FROM gd_app_type WHERE id=$id");
if(!$name)
continue;
$smarty->assign("app_types_desc_$id", 1);
if($app_types_str)
$app_types_str .= ",";
$app_types_str .= $id;
}
$app_types = $app_types_str;
$smarty->assign("app_types_desc", $app_types_desc);
?>
|