]>
git.datanom.net - webcal.git/blob - include/user_settings.inc.php
3 require_once 'helper.php';
21 private $session_start;
23 public function __construct($uid) {
24 $this->calendars
= array();
26 $this->session_start
= time();
29 public function setCalendars($calendars) {
30 $this->calendars
= $calendars;
33 public function addCalendar($id, CalendarInfo
$calendar) {
34 $this->calendars
[$id] = $calendar;
37 public function removeCalendar($id) {
38 unset($this->calendars
[$id]);
41 public function setSettings($settings) {
42 //file_put_contents('/tmp/davical.log',
43 // __FILE__ . ": " . var_export($settings, TRUE), FILE_APPEND);
45 foreach ($settings as $row) {
47 $this->viewStyle
= $row['userview'];
48 $this->startWeek
= ($row['weekstart']) ?
TRUE : FALSE;
49 $this->startHour
= $row['daystart'];
50 $this->endHour
= $row['dayend'];
51 $this->role
= (int) $row['userrole'];
52 $this->timeout
= (int) $row['timeout'];
53 $this->timezone
= $row['timezone'];
56 if (isset($row['id']) && $row['id'] >= 0) {
57 $calendar = new CalendarInfo();
58 $calendar->name
= $row['name'];
59 $calendar->color
= $row['color'];
60 $calendar->config
= $row['config'];
61 $this->calendars
[$row['id']] = $calendar;
64 $this->isTimeout(TRUE);
67 public function getCalendars() {
68 return $this->calendars
;
71 public function getCalendar($name) {
72 foreach ($this->calendars
as $calendar) {
73 if ($calendar->name
== $name)
74 return $calendar->config
;
79 public function getViewStyle() {
80 return $this->viewStyle
;
83 public function getStartWeek() {
84 return $this->startWeek
;
87 public function getStartHour() {
88 return $this->startHour
;
91 public function getEndHour() {
92 return $this->endHour
;
95 public function getRole() {
96 return (int) $this->role
;
99 public function getTimeout() {
100 return $this->timeout
;
103 public function isTimeout($reset = FALSE) {
108 $this->session_start
= $now;
110 //echo "$this->session_start -> $this->timeout -> $now<br/>";
111 $_SESSION['isTimeout'] = TRUE;
112 if ($this->session_start +
$this->timeout
> $now) {
113 $this->session_start
= $now;
115 $remain = $this->timeout
/ 60;
116 setcookie('WEBCAL_EXPIRE', $remain, 0, $_SESSION['WEB_ROOT']);
119 header('Location: ' . $_SESSION['WEB_ROOT'] . 'logout.php');
124 public function getUid() {
128 public function getTimezone() {
129 return $this->timezone
;
This page took 0.071008 seconds and 6 git commands to generate.