Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

user/userbox.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: userbox.php 9518 2002-05-08 11:51:36Z vl $
5 //
6 // Created on: <20-Sep-2000 13:32:11 ce>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 //require( "kernel/ezuser/user/usercheck.php" );
28
29
30 // include_once( "classes/INIFile.php" );
31 // include_once( "classes/eztemplate.php" );
32 // include_once( "classes/eztexttool.php" );
33
34 $ini =& eZINI::instance( 'site.ini' );
35 $Language = $ini->variable( "eZUserMain", "Language" );
36 $UserWithAddress = $ini->variable( "eZUserMain", "UserWithAddress" );
37
38 // include_once( "ezuser/classes/ezuser.php" );
39 // include_once( "ezuser/classes/ezusergroup.php" );
40 // include_once( "ezuser/classes/ezmodule.php" );
41 // include_once( "ezuser/classes/ezpermission.php" );
42 // include_once( "ezsession/classes/ezsession.php" );
43
44 $user =& eZUser::currentUser();
45
46 if ( !$user )
47 {
48 if ( !isset( $IntlDir ) )
49 $IntlDir = "kernel/ezuser/user/intl";
50 else if ( is_array( $IntlDir ) )
51 $IntlDir[] = "kernel/ezuser/user/intl";
52 if ( !isset( $IniFile ) )
53 $IniFile = "userbox.php";
54 else if ( is_array( $IniFile ) )
55 $IniFile[] = "userbox.php";
56
57 $t = new eZTemplate( "kernel/ezuser/user/" . $ini->variable( "eZUserMain", "TemplateDir" ),
58 "kernel/ezuser/user/intl/", $Language, "/userbox.php" );
59
60 $t->setAllStrings();
61
62 if ( isset( $template_array ) and isset( $block_array ) )
63 {
64 $standard_array = array( "login" => "loginmain.tpl" );
65 $t->set_file( array_merge( $standard_array, $template_array ) );
66 $t->set_file_block( $template_array );
67 $t->parse( $block_array );
68 }
69 else
70 {
71 $t->set_file( "login", "loginmain.tpl" );
72 }
73 $t->set_block( "login", "standard_creation_tpl", "standard_creation" );
74 $t->set_block( "login", "extra_creation_tpl", "extra_creation" );
75
76 if ( !isset( $GlobalSectionID ) )
77 $GlobalSectionID = "";
78 $t->set_var( "section_id", $GlobalSectionID );
79
80 $t->set_var( "standard_creation", "" );
81 $t->set_var( "extra_creation", "" );
82 if ( !isset( $no_address ) )
83 $no_address = "";
84 $t->set_var( "no_address", $no_address );
85
86 if ( isset( $type_list ) )
87 {
88 $t->parse( "extra_creation", "extra_creation_tpl" );
89 }
90 else
91 {
92 if ( $UserWithAddress == "enabled" )
93 {
94 //$t->set_var( "user_edit_url", "/user/userwithaddress/new/" );
95 //$t->set_var( "user_edit_url", "/user/step1/" );
96 $t->set_var( "user_edit_url", "/user/new/" );
97 }
98 else
99 {
100 $t->set_var( "user_edit_url", "/user/new/" );
101 //$t->set_var( "user_edit_url", "/user/step1/" );
102 }
103 $t->parse( "standard_creation", "standard_creation_tpl" );
104 }
105
106 if ( !isset( $RedirectURL ) or !$RedirectURL )
107 $RedirectURL = $_SERVER['REQUEST_URI'];
108 if ( preg_match( "#^/user/user/login.*#", $RedirectURL ) ||
109 preg_match( "#^/user/forgot.*#", $RedirectURL) )
110 {
111 $t->set_var( "redirect_url", "/" );
112
113 }
114 else
115 {
116 $t->set_var( "redirect_url", eZTextTool::htmlspecialchars( $RedirectURL ) );
117 }
118
119 $t->set_var( "action_value", "login" );
120
121 $t->set_var( "sitedesign", $GlobalSiteDesign );
122
123 $t->pparse( "output", "login" );
124
125 }
126 else
127 {
128 $t = new eZTemplate( "kernel/ezuser/user/" . $ini->variable( "eZUserMain", "TemplateDir" ),
129 "kernel/ezuser/user/intl", $Language, "userbox.php" );
130 $t->setAllStrings();
131
132 $t->set_file( array(
133 "userbox" => "userbox.tpl"
134 ) );
135
136 $t->set_block( "userbox", "message_switch_tpl", "message_switch" );
137 $t->set_block( "message_switch_tpl", "message_switch_item_tpl", "message_switch_item" );
138
139 if ( !isset( $GlobalSectionID ) )
140 $GlobalSectionID = "";
141 $t->set_var( "section_id", $GlobalSectionID );
142
143 $t->set_var( "user_first_name", $user->firstName() );
144 $t->set_var( "user_last_name", $user->lastName() );
145 $t->set_var( "user_id", $user->id() );
146 if ( ! isset( $SiteDesign ) )
147 $SiteDesign = "";
148 $t->set_var( "style", $SiteDesign );
149
150 if ( ! isset( $no_address ) )
151 $no_address = "";
152 $t->set_var( "no_address", $no_address );
153
154 if ( ! isset( $RedirectURL ) )
155 $RedirectURL = $_SERVER['REQUEST_URI'];
156 if ( preg_match( "#^/user/user/login.*#", $RedirectURL ) )
157 {
158 $t->set_var( "redirect_url", "/" );
159
160 }
161 else
162 {
163 $t->set_var( "redirect_url", eZTextTool::htmlspecialchars( $RedirectURL ) );
164 }
165
166 if ( $UserWithAddress == "enabled" )
167 {
168 //$t->set_var( "user_edit_url", "/user/userwithaddress/edit/" );
169 $t->set_var( "user_edit_url", "/user/step1/" );
170 }
171 else
172 {
173 //$t->set_var( "user_edit_url", "/user/user/edit/" );
174 $t->set_var( "user_edit_url", "/user/step1/" );
175 }
176 $adminSiteAccessHostNameURL = $ini->variable( "site", "AdminSiteURL" );
177 $isAdminShowLinkMarkup = "<tr><td width='1%' valign='top'><img src='/design/intranet/images/dot.gif' width='10' height='12' border='0' alt=''><br></td>
178 <td width='99%'><a target='_blank' class='menu' href='https://$adminSiteAccessHostNameURL'>Administrator</a></td></tr>
179 ";
180
181 if ( eZPermission::checkPermission( $user, "eZUser", "AdminLogin" ) )
182 {
183 $t->set_var( "is_admin_show_link", $isAdminShowLinkMarkup );
184 }
185 else
186 {
187 $t->set_var( "is_admin_show_link", '' );
188 }
189
190 $t->set_var( "user_password_edit_url", '/user/passwordchange/' );
191
192 // include_once( "ezmessage/classes/ezmessage.php" );
193 $t->set_var( "message_switch", "" );
194 $t->set_var( "message_switch_item", "" );
195
196 $message = new eZMessage( );
197 //$user = new eZUser();
198 //$user->currentUser();
199 $locale = new eZLocale( $Language );
200 $messageArray =& $message->messagesToUser( $user );
201 $i = 0;
202
203 foreach ( $messageArray as $message )
204 {
205 if ( $message->isRead() != true )
206 {
207 $i++;
208 $created = $message->created();
209 $t->set_var( "message_date", $locale->format( $created ) );
210 $fromUser = $message->fromUser();
211 $t->set_var( "message_from_user", $fromUser->firstName() . " " . $fromUser->lastName() );
212 $t->set_var( "message_subject", $message->subject() ) ;
213 $t->parse( "message_switch_item", "message_switch_item_tpl", true );
214 }
215 if ( $i > 0 )
216 {
217 $t->set_var( "new_message_count", $i );
218 $t->parse( "message_switch", "message_switch_tpl" );
219 }
220 }
221
222 $t->set_var( "new_message_count", $i );
223 $t->set_var( "message_count", count($messageArray) );
224
225 $t->set_var( "sitedesign", $GlobalSiteDesign );
226
227 $t->pparse( "output", "userbox" );
228 }
229
230 ?>
eZLocale
Definition: ezlocale.php:119
eZMessage
Definition: ezmessage.php:39
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZTemplate
Definition: eztemplate.php:107
eZTextTool\htmlspecialchars
static htmlspecialchars( $string)
Definition: eztexttool.php:144
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
$block_array
$block_array
Definition: countryedit.php:44
$template_array
$template_array
Definition: countryedit.php:43
$GlobalSectionID
$GlobalSectionID
Definition: ezad/user/datasupplier.php:28
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$RedirectURL
$RedirectURL
Definition: ezforum/user/userlogin.php:91
$GlobalSiteDesign
global $GlobalSiteDesign
Definition: latestmessages.php:52
$messageArray
$messageArray
Definition: user/userbox.php:200
$locale
$locale
Definition: user/userbox.php:199
$isAdminShowLinkMarkup
$isAdminShowLinkMarkup
Definition: user/userbox.php:177
$user
$user
Definition: user/userbox.php:44
$i
$i
Definition: user/userbox.php:201
$Language
$Language
Definition: user/userbox.php:35
$ini
$ini
Definition: user/userbox.php:34
$message
$message
Definition: user/userbox.php:196
$UserWithAddress
$UserWithAddress
Definition: user/userbox.php:36
$adminSiteAccessHostNameURL
$adminSiteAccessHostNameURL
Definition: user/userbox.php:176
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.