Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

configure.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: configure.php 6931 2001-09-04 13:20:16Z fh $
5 //
6 // Created on: <23-Oct-2000 17:53:46 bf>
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 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "ezuser/classes/ezuser.php" );
31 // include_once( "classes/ezhttptool.php" );
32 // include_once( "ezsession/classes/ezpreferences.php" );
33
34 // include_once( "ezmail/classes/ezmailaccount.php" );
35 // include_once( "ezmail/classes/ezmailfolder.php" );
36 // include_once( "ezmail/classes/ezmailfilterrule.php" );
37
38 $user =& eZUser::currentUser();
39
40 if( isset( $Ok ) || isset( $NewAccount ) || isset( $NewFilter ) ||
41 isset( $DeleteAccounts ) )
42 {
43 // this strange way of enabling accounts makes sure that one user doesn't tamper
44 // with the accounts of someone else.
45 $accounts = eZMailAccount::getByUser( eZUser::currentUser() );
46 foreach( $accounts as $account )
47 {
48 if( count( $AccountActiveArrayID ) > 0 &&
49 in_array( $account->id(), $AccountActiveArrayID ) )
50 $account->setIsActive( true );
51 else
52 $account->setIsActive( false );
53
54 $account->store();
55 }
56 // save options
57 if( $user )
58 {
59 if( isset( $OnDelete ) && $OnDelete == "trash" )
60 eZPreferences::setVariable( "eZMail_OnDel", "trash" );
61 else
62 eZPreferences::setVariable( "eZMail_OnDel", "del" );
63
64 if( isset( $Signature ) )
65 eZPreferences::setVariable( "eZMail_Signature", $Signature );
66
67 if( isset( $AutoSignature ) )
68 eZPreferences::setVariable( "eZMail_AutoSignature", "true" );
69 else
70 eZPreferences::setVariable( "eZMail_AutoSignature", "false" );
71
72 if( isset( $ShowUnread ) )
73 eZPreferences::setVariable( "eZMail_ShowUnread", "true" );
74 else
75 eZPreferences::setVariable( "eZMail_ShowUnread", "false" );
76
77 if( isset( $AutoCheckMail ) )
78 eZPreferences::setVariable( "eZMail_AutoCheckMail", "true" );
79 else
80 eZPreferences::setVariable( "eZMail_AutoCheckMail", "false" );
81 }
82 }
83
84 if( isset( $NewAccount ) )
85 {
86 eZHTTPTool::header( "Location: /mail/accountedit" );
87 exit();
88 }
89
90 if( isset( $NewFilter) )
91 {
92 eZHTTPTool::header( "Location: /mail/filteredit" );
93 exit();
94 }
95
96 if( isset( $DeleteAccounts ) && count( $AccountArrayID ) > 0 )
97 {
98 foreach( $AccountArrayID as $accountID )
99 {
100 (new eZMailAccount())->delete( $accountID );
101 }
102 }
103 if( isset( $DeleteAccounts ) && isset( $FilterArrayID ) && count( $FilterArrayID ) > 0 )
104 {
105 foreach( $FilterArrayID as $filterID )
106 {
107 eZMailFilterRule::delete( $filterID );
108 }
109 }
110
111
112 $ini =& eZINI::instance( 'site.ini' );
113 $Language = $ini->variable( "eZMailMain", "Language" );
114
115 $t = new eZTemplate( "kernel/ezmail/user/" . $ini->variable( "eZMailMain", "TemplateDir" ),
116 "kernel/ezmail/user/intl/", $Language, "configure.php" );
117 $t->setAllStrings();
118
119 $t->set_file( array(
120 "mail_configure_page_tpl" => "configure.tpl"
121 ) );
122
123 $t->set_var( "site_style", $siteDesign );
124 $t->set_block( "mail_configure_page_tpl", "account_item_tpl", "account_item" );
125 $t->set_block( "mail_configure_page_tpl", "filter_item_tpl", "filter_item" );
126 $t->set_var( "account_item", "" );
127 $t->set_var( "filter_item" ,"" );
128
129 // init options
130 $t->set_var( "trash_checked", "checked" );
131 $t->set_var( "delete_checked", "" );
132 $t->set_var( "signature", "" );
133 if( $user )
134 {
135 $del_var =& eZPreferences::variable( "eZMail_OnDel" );
136 if( $del_var == "del" )
137 {
138 $t->set_var( "trash_checked", "" );
139 $t->set_var( "delete_checked", "checked" );
140 }
141 $signature =& eZPreferences::variable( "eZMail_Signature" );
142 if( $signature )
143 $t->set_var( "signature", htmlspecialchars( $signature ) );
144
145 $t->set_var( "signature_checked", "" );
146 $auto_signature =& eZPreferences::variable( "eZMail_AutoSignature" );
147 if( $auto_signature && $auto_signature == "true" )
148 $t->set_var( "signature_checked", "checked" );
149
150 $t->set_var( "show_unread_checked", "" );
151 $show_unread = eZPreferences::variable( "eZMail_ShowUnread" );
152 if( $show_unread == "true" )
153 $t->set_var( "show_unread_checked", "checked" );
154
155 $t->set_var( "check_mail_checked", "" );
156 $auto_check_mail = eZPreferences::variable( "eZMail_AutoCheckMail" );
157 if( $auto_check_mail == "true" )
158 $t->set_var( "check_mail_checked", "checked" );
159 }
160
161 $accounts = eZMailAccount::getByUser( $user->id() );
162 foreach( $accounts as $account )
163 {
164 $t->set_var( "account_id", $account->id() );
165 $t->set_var( "account_name", htmlspecialchars( $account->name() ) );
166 $t->set_var( "account_type", $account->serverType() );
167 $t->set_var( "account_folder", "" );
168 $account->isActive() ? $t->set_var( "account_active_checked", "checked" ) : $t->set_var( "account_active_checked", "" );
169 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
170 $t->parse( "account_item", "account_item_tpl", true );
171 }
172
173 $filters = eZMailFilterRule::getByUser( $user->id() );
174 foreach( $filters as $filter )
175 {
176 $t->set_var( "filter_id", $filter->id() );
177 $t->set_var( "filter_name", htmlspecialchars( buildFilterName( $filter, $Language) ) );
178
179 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
180 $t->parse( "filter_item", "filter_item_tpl", true );
181 }
182
183 $t->pparse( "output", "mail_configure_page_tpl" );
184
185 function buildFilterName( &$filter, $Language )
186 {
187 $localINI = new eZINI( "kernel/ezmail/user/intl/" . $Language . "/configure.php.ini" );
188 $if = $localINI->variable( "strings", "if" );
189 $move = $localINI->variable( "strings", "move" );
190 $headerName = "";
191 switch( $filter->headerType() )
192 {
193 case FILTER_MESSAGE: $headerName = $localINI->variable( "strings", "message"); break;
194 case FILTER_BODY: $headerName = $localINI->variable( "strings", "body"); break;
195 case FILTER_ANY: $headerName = $localINI->variable( "strings", "any_header"); break;
196 case FILTER_TOCC: $headerName = $localINI->variable( "strings", "tocc"); break;
197 case FILTER_SUBJECT: $headerName = $localINI->variable( "strings", "subject"); break;
198 case FILTER_FROM: $headerName = $localINI->variable( "strings", "from"); break;
199 case FILTER_TO: $headerName = $localINI->variable( "strings", "to"); break;
200 case FILTER_CC: $headerName = $localINI->variable( "strings", "cc"); break;
201 }
202
203 $checkName = "";
204 switch( $filter->checkType() )
205 {
206 case FILTER_EQUALS: $checkName = $localINI->variable( "strings", "equals"); break;
207 case FILTER_NEQUALS: $checkName = $localINI->variable( "strings", "nequals"); break;
208 case FILTER_CONTAINS: $checkName = $localINI->variable( "strings", "contains"); break;
209 case FILTER_NCONTAINS: $checkName = $localINI->variable( "strings", "ncontains"); break;
210 case FILTER_REGEXP: $checkName = $localINI->variable( "strings", "regexp"); break;
211 }
212 $folder = new eZMailFolder( $filter->folderID() );
213
214 return $if ." " . $headerName ." " . $checkName . " " . " \"". $filter->match() . "\" " . $move . " \"" . $folder->name() . "\"";
215 }
216
217 ?>
$i
$i
Definition: admin/adlist.php:91
$Signature
$Signature
Definition: admin/useredit.php:417
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZINI
Reads and writes .ini style configuration files.
eZMailAccount
Definition: ezmailaccount.php:61
eZMailAccount\getByUser
static getByUser( $user)
Definition: ezmailaccount.php:372
eZMailFilterRule\getByUser
static getByUser( $user)
Definition: ezmailfilterrule.php:280
eZMailFilterRule\delete
delete( $id=-1)
Definition: ezmailfilterrule.php:80
eZMailFolder
Definition: ezmailfolder.php:49
eZPreferences\variable
static variable( $name, $group=false)
Definition: ezpreferences.php:95
eZPreferences\setVariable
static setVariable( $name, $value, $group=false)
Definition: ezpreferences.php:128
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
buildFilterName
buildFilterName(&$filter, $Language)
Definition: configure.php:185
$ini
if(isset( $Ok)||isset( $NewAccount)||isset( $NewFilter)||isset( $DeleteAccounts)) if(isset( $NewAccount)) if(isset( $NewFilter)) if(isset( $DeleteAccounts) &&count( $AccountArrayID) > 0) if(isset( $DeleteAccounts) &&isset( $FilterArrayID) &&count( $FilterArrayID) > 0) $ini
Definition: configure.php:112
$t
$t
Definition: configure.php:115
$filters
foreach( $accounts as $account) $filters
Definition: configure.php:173
$user
$user
Definition: configure.php:38
$Language
$Language
Definition: configure.php:113
$accounts
if( $user) $accounts
Definition: configure.php:161
$folder
if(!isset( $FolderID)) $folder
Definition: ezfilemanager/admin/browse.php:74
FILTER_TO
const FILTER_TO
Definition: ezmailfilterrule.php:51
FILTER_CC
const FILTER_CC
Definition: ezmailfilterrule.php:52
FILTER_TOCC
const FILTER_TOCC
Definition: ezmailfilterrule.php:48
FILTER_REGEXP
const FILTER_REGEXP
Definition: ezmailfilterrule.php:58
FILTER_ANY
const FILTER_ANY
Definition: ezmailfilterrule.php:47
FILTER_CONTAINS
const FILTER_CONTAINS
Definition: ezmailfilterrule.php:56
FILTER_BODY
const FILTER_BODY
Definition: ezmailfilterrule.php:46
FILTER_NCONTAINS
const FILTER_NCONTAINS
Definition: ezmailfilterrule.php:57
FILTER_NEQUALS
const FILTER_NEQUALS
Definition: ezmailfilterrule.php:55
FILTER_FROM
const FILTER_FROM
Definition: ezmailfilterrule.php:50
FILTER_SUBJECT
const FILTER_SUBJECT
Definition: ezmailfilterrule.php:49
FILTER_EQUALS
const FILTER_EQUALS
Definition: ezmailfilterrule.php:54
FILTER_MESSAGE
const FILTER_MESSAGE
Definition: ezmailfilterrule.php:45
$localINI
if( $FilterID !=0) $localINI
Definition: filteredit.php:95
exit
exit
Definition: folder.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.