Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

messagesimplelist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: messagesimplelist.php 9858 2003-06-17 14:17:04Z vl $
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 // include_once( "classes/eztexttool.php" );
29
30
31 // include_once( "classes/eztemplate.php" );
32 // include_once( "classes/ezlocale.php" );
33 // include_once( "classes/ezlist.php" );
34 // include_once( "ezuser/classes/ezuser.php" );
35
36 // include_once( "ezforum/classes/ezforummessage.php" );
37 // include_once( "ezforum/classes/ezforumcategory.php" );
38 // include_once( "ezforum/classes/ezforum.php" );
39
40 $ini =& eZINI::instance( 'site.ini' );
41
42 $Language = $ini->variable( "eZForumMain", "Language" );
43 $SimpleUserList = $ini->variable( "eZForumMain", "SimpleUserList" );
44 $anonymous = $ini->variable( "eZForumMain", "AnonymousPoster" );
45
46 if ( isset( $ProductID ) )
47 { $ListTemplate = "reviewsimplelist.php"; }
48 else
49 { $ListTemplate = "messagesimplelist.php"; }
50
51 $t = new eZTemplate( "kernel/ezforum/user/" . $ini->variable( "eZForumMain", "TemplateDir" ),
52 "kernel/ezforum/user/intl", $Language, "messagesimplelist.php" );
53
54 $t->set_file( "messagelist", "messagesimplelist.tpl" );
55
56 $t->set_block( "messagelist", "message_list_tpl", "message_list" );
57 $t->set_block( "message_list_tpl", "message_item_tpl", "message_item" );
58 $t->set_block( "message_item_tpl", "private_message_tpl", "private_message" );
59
60 $t->setAllStrings();
61
62 $forum = new eZForum( $ForumID );
63
64 $locale = new eZLocale( $Language );
65
66 if ( !isset($Offset) )
67 $Offset = 0;
68
69 $messageList =& $forum->messageTree( $Offset, $SimpleUserList );
70 $messageCount =& $forum->messageCount();
71 $t->set_var( "total_posts", $messageCount );
72
73 if ( !$messageList )
74 {
75 $errorIni = new eZINI( "kernel/ezforum/user/intl/" . $Language . "/messagesimplelist.php.ini", false );
76 $noitem =& $errorIni->variable( "strings", "noitem" );
77
78 $t->set_var( "message_list", $noitem );
79 }
80 else
81 {
82 $level = 0;
83 $i = 0;
84 foreach ( $messageList as $message )
85 {
86 if ( ( $i % 2 ) == 0 )
87 $t->set_var( "td_class", "bglight" );
88 else
89 $t->set_var( "td_class", "bgdark" );
90
91 $level = $message->depth();
92
93 if ( $level > 0 )
94 $t->set_var( "spacer", str_repeat( "&nbsp;", $level ) );
95 else
96 $t->set_var( "spacer", "" );
97
98 $t->set_var( "topic", htmlspecialchars( $message->topic() ) );
99 $t->set_var( "body", eZTextTool::nl2br( $message->body() ) );
100 $time =& $message->postingTime();
101 $t->set_var( "postingtime", $locale->format( $time ) );
102 $t->set_var( "message_id", $message->id() );
103
104 $muser =& $message->user();
105 /*
106 echo "<pre>";
107 print_r ($muser);
108 echo "</pre>";
109 */
110 if ( $muser->id() == 0 )
111 $t->set_var( "user", $message->userName() );
112 else
113 $t->set_var( "user", $muser->firstName() . " " . $muser->lastName() );
114
115 if ( $muser->id() == 0 )
116 {
117 $MessageAuthor = $anonymous;
118 }
119 else
120 {
121 $MessageAuthor = $muser->firstName() . " " . $muser->lastName();
122 }
123
124 if ( $muser->firstName()== "" && $muser->lastName()=="" )
125 $MessageAuthor = $anonymous;
126
127 $t->set_var( "user", $MessageAuthor );
128
129
130 $user =& eZUser::currentUser();
131 $t->set_var( "private_message", "" );
132
133
134 if ( ( $MessageAuthor != $anonymous) and ($user) )
135 {
136 // $user = new eZUser( $muser->id() );
137
138 // $toUser = eZUser::getUser( $user );
139 $t->set_var( "username", $muser->login() );
140 $t->set_var( "PM_topic", urlencode (": ".$message->topic() ) );
141 // $t->set_var( "topic", $message->topic() );
142 $t->parse( "private_message", "private_message_tpl" );
143 }
144
145 // $t->set_var( "username", $muser->id() );
146 // $t->set_var( "PM_topic", urlencode (": ".$message->topic() ) );
147 $t->parse( "message_item", "message_item_tpl", true );
148 $i++;
149 }
150 $t->parse( "message_list", "message_list_tpl", true );
151 }
152 eZList::drawNavigator( $t, $messageCount, $SimpleUserList, $Offset, "messagelist" );
153
154 $t->set_var( "redirect_url", eZTextTool::htmlspecialchars( $RedirectURL ) );
155
156 $t->set_var( "newmessage", isset( $newmessage ) ? $newmessage : false );
157
158 $url = explode( "parent", $_SERVER['REQUEST_URI'] );
159 $t->set_var( "url", $url[0] );
160 $t->set_var( "forum_id", $forum->id() );
161 $t->set_var( "forum_name", $forum->name() );
162
163 $t->pparse( "output", "messagelist" );
164
165 ?>
$level
$level
Definition: admin/message.php:106
$message
$message
Definition: admin/message.php:51
$errorIni
$errorIni
Definition: admin/unhandledbugs.php:38
eZForum
Definition: ezforum.php:44
eZINI
Reads and writes .ini style configuration files.
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZLocale
Definition: ezlocale.php:119
eZTemplate
Definition: eztemplate.php:107
eZTextTool\htmlspecialchars
static htmlspecialchars( $string)
Definition: eztexttool.php:144
eZTextTool\nl2br
static nl2br( $string, $xhtml=true)
Definition: eztexttool.php:65
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$RedirectURL
$RedirectURL
Definition: ezforum/user/userlogin.php:91
$time
$time
Definition: homepage.php:327
$SimpleUserList
$SimpleUserList
Definition: messagesimplelist.php:43
$locale
$locale
Definition: messagesimplelist.php:64
$t
$t
Definition: messagesimplelist.php:51
$forum
$forum
Definition: messagesimplelist.php:62
$anonymous
$anonymous
Definition: messagesimplelist.php:44
$i
$i
Definition: messagesimplelist.php:83
$Language
$Language
Definition: messagesimplelist.php:42
$ini
$ini
Definition: messagesimplelist.php:40
$url
$url
Definition: messagesimplelist.php:158
$messageCount
$messageCount
Definition: messagesimplelist.php:70
$messageList
$messageList
Definition: messagesimplelist.php:69
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.