Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezarticletool.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezarticletool.php 9861 2003-07-10 08:30:01Z br $
5 //
6 // Definition of eZArticleTool class
7 //
8 // Created on: <27-Apr-2001 14:08:05 amos>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
35 // include_once( "classes/ezcachefile.php" );
36 // include_once( "classes/INIFile.php" );
37 // include_once( "classes/eztemplate.php" );
38 // include_once( "classes/eztexttool.php" );
39
40 // include_once( "ezarticle/classes/ezarticlerenderer.php" );
41 // include_once( "ezuser/classes/ezuser.php" );
42
43 // include_once( "ezbulkmail/classes/ezbulkmail.php" );
44 // include_once( "ezbulkmail/classes/ezbulkmailcategory.php" );
45
46 class eZArticleTool
47 {
52 static public function deleteCache( $ArticleID, $CategoryID, $CategoryArray )
53 {
54 $user =& eZUser::currentUser();
55
56 $files = eZCacheFile::files( "kernel/ezarticle/cache/",
57 array( array( "articleprint", "articleview", "articlestatic", "static", "view", "print" ),
58 $ArticleID, NULL, NULL ), "cache", "," );
59 foreach ( $files as $file )
60 {
61 $file->delete();
62 }
63
64 $files = eZCacheFile::files( "kernel/ezarticle/cache/",
65 array( array( "articlelist", "list" ),
66 array_merge( $CategoryArray, array( $CategoryID ), array( 0 ) ),
67 NULL, array( "", NULL ) ),
68 "cache", "," );
69 foreach ( $files as $file )
70 {
71 $file->delete();
72 }
73
74
75 $files = eZCacheFile::files( "kernel/ezarticle/cache/",
76 array( "articlelinklist",
77 array_merge( $CategoryArray, array( $CategoryID ), array( 0 ) ),
78 $ArticleID,
79 NULL ),
80 "cache", "," );
81 foreach ( $files as $file )
82 {
83 $file->delete();
84 }
85
86 $files =& eZCacheFile::files( "kernel/ezarticle/cache/",
87 array( "articleindex",
88 NULL ),
89 "cache", "," );
90 foreach ( $files as $file )
91 {
92 $file->delete();
93 }
94
95 $files =& eZCacheFile::files( "kernel/ezarticle/cache/",
96 array( "menubox",
97 NULL,
98 NULL,
99 NULL ),
100 "cache", "," );
101 foreach ( $files as $file )
102 {
103 $file->delete();
104 }
105
106 $files =& eZCacheFile::files( "kernel/ezarticle/cache/",
107 array( "menubox_headlines",
108 NULL,
109 NULL ),
110 "cache", "," );
111 foreach ( $files as $file )
112 {
113 $file->delete();
114 }
115
116 $files =& eZCacheFile::files( "kernel/ezarticle/cache/",
117 array( "smallarticlelist",
118 NULL ),
119 "cache", "," );
120 foreach ( $files as $file )
121 {
122 $file->delete();
123 }
124
125 $files =& eZCacheFile::files( "kernel/ezarticle/cache/",
126 array( "articlefrontpage",
127 NULL,
128 NULL),
129 "cache", "," );
130 foreach ( $files as $file )
131 {
132 $file->delete();
133 }
134 }
135
136 static public function notificationMessage( &$article )
137 {
138 // include_once( "classes/eztexttool.php" );
139 $ini =& eZINI::instance( 'site.ini' );
140
141 $PublishNoticeReceiver = $ini->variable( "eZArticleMain", "PublishNoticeReceiver" );
142 $PublishNoticeSender = $ini->variable( "eZArticleMain", "PublishNoticeSender" );
143 $PublishNoticePadding = $ini->variable( "eZArticleMain", "PublishNoticePadding" );
144 $PublishSite = $ini->variable( "site", "SiteTitle" );
145 $SiteURL = $ini->variable( "site", "UserSiteURL" );
146 $UserSiteURL = $ini->variable( "site", "UserSiteURL" );
147
148 //EP - different charsets for the MIME mail ----------------------------
149 global $GlobalSectionID;
150
151 // include_once("ezsitemanager/classes/ezsection.php");
152
153 $category = $article->categoryDefinition();
154 $GlobalSectionID = $category->sectionID();
155
156 // Set the global nVH variables.
157 $wwwDir = $ini->WWWDir;
158 $indexFile = $ini->Index;
159
160 // init the section ???
161 //$sectionObject =& eZSection::globalSectionObject( $GlobalSectionID );
162 //$sectionObject->setOverrideVariables();
163
164 //EP -------------------------------------------------------------------
165
166 $mailTemplate = new eZTemplate( "kernel/ezarticle/admin/" . $ini->variable( "eZArticleMain", "AdminTemplateDir" ),
167 "kernel/ezarticle/admin/intl", $ini->variable( "eZArticleMain", "Language" ), "mailtemplate.php" );
168
169 $mailTemplate->set_file( "mailtemplate", "mailtemplate.tpl" );
170 $mailTemplate->setAllStrings();
171
172 $renderer = new eZArticleRenderer( $article );
173
174 $subjectLine = $mailTemplate->Ini->variable( "strings", "subject" );
175 $subjectLine = $subjectLine . " " . $PublishSite;
176
177 $intro = eZTextTool::linesplit( strip_tags( $renderer->renderIntro() ), $PublishNoticePadding, 76 );
178
179 $mailTemplate->set_var( "body", $intro );
180 $mailTemplate->set_var( "site", $PublishSite );
181 $mailTemplate->set_var( "title", $article->name( false ) );
182 $mailTemplate->set_var( "author", $article->authorText( false ) );
183
184 // the index should be index.php for the usersite.
185 if ( $index == "/index_admin.php" )
186 {
187 $index = "/index.php";
188 }
189
190 $mailTemplate->set_var( "link", "https://" . $SiteURL . $wwwDir . $index . "/article/articleview/" . $article->id() );
191
192 $bodyText = $mailTemplate->parse( "dummy", "mailtemplate" );
193
194 // send a notice mail
195 $noticeMail = new eZMail();
196
197 $noticeMail->setFrom( $PublishNoticeSender );
198 $noticeMail->setTo( $PublishNoticeReceiver );
199
200 $noticeMail->setSubject( $subjectLine );
201 $noticeMail->setBodyText( $bodyText );
202
203 $noticeMail->send();
204
205 // Send bulkmail also
206 $articleCategory = $article->categoryDefinition();
207 $articleCategories = $article->categories();
208 $bulkMailCategories = array();
209
210 $bulkMailCategory =& $articleCategory->bulkMailCategory();
211 if ( $bulkMailCategory != false )
212 $bulkMailCategories[] =& $bulkMailCategory;
213
214 foreach ( $articleCategories as $articleCategory )
215 {
216 $bulkMailCategory = $articleCategory->bulkMailCategory();
217 if ( $bulkMailCategory != false )
218 $bulkMailCategories[] = $bulkMailCategory;
219 }
220
221
222 if ( count( $bulkMailCategories ) > 0 ) // send a mail to this group
223 {
224 $bulkmail = new eZBulkMail();
225 $bulkmail->setOwner( eZUser::currentUser() );
226
227 $bulkmail->setSender( $PublishNoticeSender ); // from NAME
228 $bulkmail->setSubject( $subjectLine );
229 $bulkmail->setBodyText( $bodyText );
230 $bulkmail->setIsDraft( false );
231 $bulkmail->store();
232
233 $bulkmail->addToCategory( false );
234 foreach ( $bulkMailCategories as $bulkMailCategory )
235 $bulkmail->addToCategory( $bulkMailCategory );
236
237 $bulkmail->send( $article );
238 }
239 }
240 }
241
242 ?>
$UserSiteURL
$UserSiteURL
Definition: account_static.php:6
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$article
$article
Definition: articlelog.php:45
$files
$files
Definition: articlepreview.php:91
$renderer
if(! $article->get( $ArticleID)) $renderer
Definition: articlepreview.php:76
$SiteURL
if( $listImageHeightOverride) $SiteURL
Definition: articleview.php:183
eZArticleRenderer
Definition: ezarticlerenderer.php:36
eZArticleTool
Definition: ezarticletool.php:47
eZArticleTool\notificationMessage
static notificationMessage(&$article)
Definition: ezarticletool.php:136
eZArticleTool\deleteCache
static deleteCache( $ArticleID, $CategoryID, $CategoryArray)
Definition: ezarticletool.php:52
eZBulkMail
Definition: ezbulkmail.php:46
eZMail
Definition: ezmail.php:57
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$ini
$ini
Definition: classes/admin/linklist.php:64
$ArticleID
$ArticleID
Definition: export.php:48
$GlobalSectionID
$GlobalSectionID
Definition: ezad/user/datasupplier.php:28
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$index
$index
Definition: ezforum/user/messageedit.php:36
$indexFile
$indexFile
Definition: singlelist.php:34
$wwwDir
$wwwDir
Definition: singlelist.php:33
$user
$user
Definition: user/adlist.php:39
$PublishNoticeSender
$PublishNoticeSender
Definition: user/articleedit.php:50
$PublishNoticeReceiver
$PublishNoticeReceiver
Definition: user/articleedit.php:49
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.