Subversion Repositories Applications.papyrus

Rev

Rev 1371 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
//                                                                            //
5
//   Copyright (C) 2006  Phorum Development Team                              //
6
//   http://www.phorum.org                                                    //
7
//                                                                            //
8
//   This program is free software. You can redistribute it and/or modify     //
9
//   it under the terms of either the current Phorum License (viewable at     //
10
//   phorum.org) or the Phorum License that was distributed with this file    //
11
//                                                                            //
12
//   This program is distributed in the hope that it will be useful,          //
13
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
14
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
15
//                                                                            //
16
//   You should have received a copy of the Phorum License                    //
17
//   along with this program.                                                 //
18
////////////////////////////////////////////////////////////////////////////////
19
 
20
if ( !defined( "PHORUM_CONTROL_CENTER" ) ) return;
21
 
22
function phorum_cc_get_language_info()
23
{
24
    $langs = phorum_get_language_info();
25
    $f_langs = array();
26
    $profile = $GLOBALS['PHORUM']['DATA']['PROFILE'];
27
    if ( !isset( $profile['user_language'] ) )
28
        $defsel = " selected=\"selected\"";
29
    else
30
        $defsel = "";
31
    $f_langs[] = array( 'file' => '', 'name' => $GLOBALS['PHORUM']['DATA']['LANG']['Default'], 'sel' => $defsel );
32
 
33
    foreach( $langs as $entry => $name ) {
34
        $sel = "";
35
        if ( isset( $profile['user_language'] ) && $profile['user_language'] == $entry ) {
36
            $sel = " selected=\"selected\"";
37
        }
38
        $f_langs[] = array( 'file' => $entry, 'name' => $name, 'sel' => $sel );
39
    }
40
    return $f_langs;
41
}
42
 
43
function phorum_cc_get_template_info()
44
{
45
    $langs = phorum_get_template_info();
46
    $profile = $GLOBALS['PHORUM']['DATA']['PROFILE'];
47
 
48
    $f_langs = array();
49
    if ( !isset( $profile['user_template'] ) )
50
        $defsel = " selected=\"selected\"";
51
    else
52
        $defsel = "";
53
    $f_langs[] = array( 'file' => '', 'name' => $GLOBALS['PHORUM']['DATA']['LANG']['Default'], 'sel' => $defsel );
54
 
55
    foreach( $langs as $entry => $name ) {
56
        $sel = "";
57
        if ( isset( $profile['user_template'] ) && $profile['user_template'] == $entry ) {
58
            $sel = " selected=\"selected\"";
59
        }
60
        $f_langs[] = array( 'file' => $entry, 'name' => $name, 'sel' => $sel );
61
    }
62
    return $f_langs;
63
}
64
 
65
if ( count( $_POST ) ) {
66
    // dst is time + 1 hour
67
    if(isset($_POST['tz_offset']) && $_POST['tz_offset'] != -99) {
68
        if($_POST['tz_offset'] && isset($_POST['is_dst']) && $_POST['is_dst']) {
69
            $_POST['tz_offset']=++$_POST['tz_offset']."";
70
        }
71
    }
72
    // unsetting dst if not checked
73
    if(!isset($_POST['is_dst'])) {
74
        $_POST['is_dst']=0;
75
    }
76
 
77
    list($error,$okmsg) = phorum_controlcenter_user_save( $panel );
78
}
79
 
80
if ( isset( $PHORUM["user_time_zone"] ) ) {
81
    $PHORUM['DATA']['PROFILE']['TZSELECTION'] = $PHORUM["user_time_zone"];
82
}
83
// compute the tz-array
84
if ( !isset( $PHORUM['DATA']['PROFILE']['tz_offset'] ) || $PHORUM['DATA']['PROFILE']['tz_offset'] == -99 ) {
85
    $defsel = " selected=\"selected\"";
86
} else {
87
    $defsel = "";
88
}
89
 
90
// remove dst from tz_offset
91
if(isset($PHORUM['DATA']['PROFILE']['is_dst']) && $PHORUM['DATA']['PROFILE']['is_dst']) {
92
    $PHORUM['DATA']['PROFILE']['tz_offset']=--$PHORUM['DATA']['PROFILE']['tz_offset']."";
93
}
94
 
95
$PHORUM["DATA"]["TIMEZONE"][] = array( 'tz' => '-99', 'str' => $PHORUM['DATA']['LANG']['Default'], 'sel' => $defsel );
96
foreach( $PHORUM['DATA']['LANG']['TIME'] as $tz => $str ) {
97
    if ( isset($PHORUM['DATA']['PROFILE']['tz_offset']) && $PHORUM['DATA']['PROFILE']['tz_offset'] === "$tz" ) {
98
        $sel = " selected";
99
    } else {
100
        $sel = "";
101
    }
102
    $PHORUM["DATA"]["TIMEZONE"][] = array( 'tz' => $tz, 'str' => $str, 'sel' => $sel );
103
}
104
 
105
$PHORUM['DATA']['LANGUAGES'] = phorum_cc_get_language_info();
106
if ( isset( $PHORUM["user_template"] ) ) {
107
    $PHORUM['DATA']['PROFILE']['TMPLSELECTION'] = $PHORUM["user_template"];
108
}
109
$PHORUM['DATA']['TEMPLATES'] = phorum_cc_get_template_info();
110
 
111
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["EditBoardsettings"];
112
$PHORUM['DATA']['PROFILE']['BOARDSETTINGS'] = 1;
113
$template = "cc_usersettings";
114
 
115
?>