Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

filteredit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: filteredit.php 6221 2001-07-20 11:18:28Z jakobn $
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
33 // include_once( "ezmail/classes/ezmailfilterrule.php" );
34 // include_once( "ezmail/classes/ezmailfolder.php" );
35
36 if( isset( $Ok ) )
37 {
38 if( $FilterID == 0 )
39 {
40 $filter = new eZMailFilterRule();
41 $filter->setOwner( eZUser::currentUser() );
42 $filter->setIsActive( true );
43 }
44 else
45 {
46 $filter = new eZMailFilterRUle( $FilterID );
47 }
48
49 $filter->setHeaderType( $HeaderSelect );
50 $filter->setCheckType( $CheckSelect );
51 $filter->setFolderID( $FolderSelectID );
52 $filter->setMatch( $Match );
53 $filter->store();
54 eZHTTPTool::header( "Location: /mail/config/" );
55 exit();
56 }
57
58 if( isset( $Cancel ) )
59 {
60 eZHTTPTool::header( "Location: /mail/config/" );
61 exit();
62 }
63
64
65 $ini =& eZINI::instance( 'site.ini' );
66 $Language = $ini->variable( "eZMailMain", "Language" );
67
68 $t = new eZTemplate( "kernel/ezmail/user/" . $ini->variable( "eZMailMain", "TemplateDir" ),
69 "kernel/ezmail/user/intl/", $Language, "filteredit.php" );
70 $t->setAllStrings();
71
72 $t->set_file( array(
73 "filter_edit_page_tpl" => "filteredit.tpl"
74 ) );
75
76 $t->set_block( "filter_edit_page_tpl", "header_item_tpl", "header_item" );
77 $t->set_block( "filter_edit_page_tpl", "check_item_tpl", "check_item" );
78 $t->set_block( "filter_edit_page_tpl", "folder_item_tpl", "folder_item" );
79 $t->set_var( "check_item", "" );
80 $t->set_var( "header_item", "" );
81 $t->set_var( "match_value", "" );
82 $t->set_var( "folder_item", "" );
83 $t->set_var( "current_filter_id", "" );
84
85 if( $FilterID != 0 ) // someone set us up the bomb
86 {
87 $t->set_var( "current_filter_id", $FilterID );
88 $filter = new eZMailFilterRule( $FilterID );
89 $t->set_var( "match_value", htmlspecialchars( $filter->match() ) );
90 $headerid = $filter->headerType();
91 $checkid = $filter->checkType();
92 $folderid = $filter->folderID();
93 }
94
95 $localINI = new eZINI( "kernel/ezmail/user/intl/" . $Language . "/filteredit.php.ini" );
96 foreach( array( 0, 1, 2, 3, 4, 5, 6, 7 ) as $headerID )
97 {
98 $headerName = "";
99 switch( $headerID )
100 {
101 case 0: $headerName = $localINI->variable( "strings", "message"); break;
102 case 1: $headerName = $localINI->variable( "strings", "body"); break;
103 case 2: $headerName = $localINI->variable( "strings", "any_header"); break;
104 case 3: $headerName = $localINI->variable( "strings", "tocc"); break;
105 case 4: $headerName = $localINI->variable( "strings", "subject"); break;
106 case 5: $headerName = $localINI->variable( "strings", "from"); break;
107 case 6: $headerName = $localINI->variable( "strings", "to"); break;
108 case 7: $headerName = $localINI->variable( "strings", "cc"); break;
109 }
110 $t->set_var( "header_id", $headerID );
111 $t->set_var( "header_name", $headerName );
112 if( isset( $headerid ) && $headerid == $headerID )
113 $t->set_var( "is_selected", "selected" );
114 else
115 $t->set_var( "is_selected", "" );
116
117 $t->parse( "header_item", "header_item_tpl", true );
118 }
119
120 foreach( array( 0, 1, 2, 3, 4 ) as $checkID )
121 {
122 $checkName = "";
123 switch( $checkID )
124 {
125 case 0: $checkName = $localINI->variable( "strings", "equals"); break;
126 case 1: $checkName = $localINI->variable( "strings", "nequals"); break;
127 case 2: $checkName = $localINI->variable( "strings", "contains"); break;
128 case 3: $checkName = $localINI->variable( "strings", "ncontains"); break;
129 case 4: $checkName = $localINI->variable( "strings", "regexp"); break;
130 }
131 $t->set_var( "check_id", $checkID );
132 $t->set_var( "check_name", $checkName );
133 if( isset( $checkid ) && $checkid == $checkID )
134 $t->set_var( "is_selected", "selected" );
135 else
136 $t->set_var( "is_selected", "" );
137 $t->parse( "check_item", "check_item_tpl", true );
138 }
139
140 $folders = eZMailFolder::getByUser();
141 $folders[] = eZMailFolder::getSpecialFolder( TRASH );
142 foreach( $folders as $folderItem )
143 {
144 $t->set_var( "folder_id", $folderItem->id() );
145 $t->set_var( "folder_name", $folderItem->name() );
146 if( isset( $folderid ) && $folderid == $folderItem->id() )
147 $t->set_var( "is_selected", "selected" );
148 else
149 $t->set_var( "is_selected", "" );
150 $t->parse( "folder_item", "folder_item_tpl", true );
151 }
152
153 $t->pparse( "output", "filter_edit_page_tpl" );
154
155 ?>
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZINI
Reads and writes .ini style configuration files.
eZMailFilterRule
Definition: ezmailfilterrule.php:61
eZMailFolder\getByUser
static getByUser( $user=false, $withSpecialFolders=false, $parentFolder=-1)
Definition: ezmailfolder.php:328
eZMailFolder\getSpecialFolder
static getSpecialFolder( $specialType, $user=false)
Definition: ezmailfolder.php:477
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
TRASH
const TRASH
Definition: ezmailfolder.php:46
$folders
foreach(array(0, 1, 2, 3, 4, 5, 6, 7) as $headerID) foreach(array(0, 1, 2, 3, 4) as $checkID) $folders
Definition: filteredit.php:140
$t
$t
Definition: filteredit.php:68
$localINI
if( $FilterID !=0) $localINI
Definition: filteredit.php:95
$ini
if(isset( $Ok)) if(isset( $Cancel)) $ini
Definition: filteredit.php:65
$Language
$Language
Definition: filteredit.php:66
exit
exit
Definition: folder.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.