Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

admin/message.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: message.php 7788 2001-10-11 12:00:35Z jhe $
5 //
6 // Created on: <11-Sep-2000 22:10:06 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
29 $ini =& eZINI::instance( 'site.ini' );
30
31 $AllowHTML = $ini->variable( "eZForumMain", "AllowHTML" );
32 $Language = $ini->variable( "eZForumMain", "Language" );
33
34 // include_once( "classes/ezlocale.php" );
35 // include_once( "classes/eztemplate.php" );
36
37 // include_once( "ezforum/classes/ezforummessage.php" );
38 // include_once( "ezforum/classes/ezforumcategory.php" );
39 // include_once( "ezforum/classes/ezforum.php" );
40
41 require( "kernel/ezuser/admin/admincheck.php" );
42
43 $t = new eZTemplate( "kernel/ezforum/admin/" . $ini->variable( "eZForumMain", "AdminTemplateDir" ),
44 "kernel/ezforum/admin/intl", $Language, "message.php" );
45 $t->setAllStrings();
46
47 $t->set_file( "message_tpl", "message.tpl" );
48 $t->set_block( "message_tpl", "message_item_tpl", "message_item" );
49 $t->set_var( "site_style", $SiteDesign );
50
51 $message = new eZForumMessage( $MessageID );
52 $forum = new eZForum( $message->forumID() );
53
54 $categories = $forum->categories();
55
56 if ( is_object( $categories[0] ) )
57 {
58 $category = new eZForumCategory( $categories[0]->id() );
59 $t->set_var( "category_id", $category->id( ) );
60 $t->set_var( "category_name", $category->name( ) );
61 }
62
63 $t->set_var( "forum_id", $forum->id() );
64 $t->set_var( "forum_name", $forum->name() );
65 $t->set_var( "message_id", $message->id() );
66 $t->set_var( "message_topic", $message->topic() );
67
68 $author = $message->user();
69
70 if ( $message->userName() )
71 $anonymous = $message->userName();
72 else
73 $anonymous = $ini->variable( "eZForumMain", "AnonymousPoster" );
74
75 if ( $author->id() == 0 )
76 {
77 $MessageAuthor = $anonymous;
78 }
79 else
80 {
81 $MessageAuthor = $author->firstName() . " " . $author->lastName();
82 }
83
84 $t->set_var( "user", $MessageAuthor );
85 $t->set_var( "topic", $message->topic() );
86 $t->set_var( "postingtime", $message->postingTime() );
87
88 if ( $AllowHTML == "enabled" )
89 $t->set_var( "body", $message->body( true ) );
90 else
91 $t->set_var( "body", nl2br( $message->body( false ) ) );
92
93 $t->set_var( "reply_id", $message->id() );
94 $t->set_var( "forum_id", $forum->id() );
95
96 $topMessage = $message->threadTop( $message );
97
98 // print out the replies tree
99
100 $messages = $forum->messageThreadTree( $message->threadID() );
101
102 // $messages = $forum->messages();
103
104 $locale = new eZLocale( $Language );
105
106 $level = 0;
107
108 $i = 0;
109 foreach ( $messages as $message )
110 {
111 if ( ( $i % 2 ) == 0 )
112 $t->set_var( "td_class", "bglight" );
113 else
114 $t->set_var( "td_class", "bgdark" );
115
116 $level = $message->depth();
117
118 if ( $level > 0 )
119 $t->set_var( "spacer", str_repeat( "&nbsp;", $level ) );
120 else
121 $t->set_var( "spacer", "" );
122
123 $t->set_var( "reply_topic", $message->topic() );
124 $t->set_var( "postingtime", $locale->format( $message->postingTime() ) );
125 $t->set_var( "message_id", $message->id() );
126
127 $author = $message->user();
128
129 if ( $message->userName() )
130 $anonymous = $message->userName();
131 else
132 $anonymous = $ini->variable( "eZForumMain", "AnonymousPoster" );
133
134 if ( $author->id() == 0 )
135 {
136 $MessageAuthor = $anonymous;
137 }
138 else
139 {
140 $MessageAuthor = $author->firstName() . " " . $author->lastName();
141 }
142
143 $t->set_var( "user", $MessageAuthor );
144
145 $t->parse( "message_item", "message_item_tpl", true );
146 $i++;
147 }
148
149 $t->set_var( "message_id", $MessageID );
150 if ( isset( $GenerateStaticPage ) && $GenerateStaticPage == "true" )
151 {
152 $fp = eZPBFile::fopen( $cachedFile, "w+");
153
154 $output = $t->parse( "output", "message_tpl" );
155 // print the output the first time while printing the cache file.
156
157 print( $output );
158 fwrite ( $fp, $output );
159 fclose( $fp );
160 }
161 else
162 {
163 $t->pparse( "output", "message_tpl" );
164 }
165
166 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$AllowHTML
$AllowHTML
Definition: admin/message.php:31
$messages
$messages
Definition: admin/message.php:100
$locale
$locale
Definition: admin/message.php:104
$t
$t
Definition: admin/message.php:43
$forum
$forum
Definition: admin/message.php:52
$i
$i
Definition: admin/message.php:108
$Language
$Language
Definition: admin/message.php:32
$ini
$ini
Definition: admin/message.php:29
$level
$level
Definition: admin/message.php:106
$message
$message
Definition: admin/message.php:51
$author
$author
Definition: admin/message.php:68
$anonymous
else $anonymous
Definition: admin/message.php:73
$categories
$categories
Definition: admin/message.php:54
$topMessage
$topMessage
Definition: admin/message.php:96
eZForumCategory
Definition: ezforumcategory.php:44
eZForumMessage
Definition: ezforummessage.php:42
eZForum
Definition: ezforum.php:44
eZLocale
Definition: ezlocale.php:119
eZPBFile\fopen
static fopen( $filename, $options)
Definition: ezpbfile.php:326
eZTemplate
Definition: eztemplate.php:107
$fp
$fp
Definition: export.php:97
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$cachedFile
$cachedFile
Definition: eznewsfeed/user/headlines.php:109
$output
$output
Definition: formpreview.php:81
$GenerateStaticPage
$GenerateStaticPage
Definition: quizscores.php:95
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.