Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
439 ddelon 1
<?php
2
/*
3
show.php
4
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
5
Copyright 2002, 2003 David DELON
6
Copyright 2002, 2003 Charles NEPOTE
7
Copyright  2003  Eric DELORD
8
Copyright  2003  Eric FELDSTEIN
9
All rights reserved.
10
Redistribution and use in source and binary forms, with or without
11
modification, are permitted provided that the following conditions
12
are met:
13
1. Redistributions of source code must retain the above copyright
14
notice, this list of conditions and the following disclaimer.
15
2. Redistributions in binary form must reproduce the above copyright
16
notice, this list of conditions and the following disclaimer in the
17
documentation and/or other materials provided with the distribution.
18
3. The name of the author may not be used to endorse or promote products
19
derived from this software without specific prior written permission.
20
 
21
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32
//vérification de sécurité
33
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
34
    die ("acc&egrave;s direct interdit");
35
}
36
echo $this->Header();
37
?>
38
<div class="page">
39
<?php
40
if ($HasAccessRead=$this->HasAccess("read"))
41
{
42
	if (!$this->page)
43
	{
44
		echo "Cette page n'existe pas encore, voulez vous la <a href=\"".$this->href("edit")."\">cr&eacute;er</a> ?" ;
45
	}
46
	else
47
	{
48
		// comment header?
49
		if ($this->page["comment_on"])
50
		{
51
			echo "<div class=\"commentinfo\">Ceci est un commentaire sur ",$this->ComposeLinkToPage($this->page["comment_on"], "", "", 0),", post&eacute; par ",$this->Format($this->page["user"])," &agrave; ",$this->page["time"],"</div>";
52
		}
53
 
54
		if ($this->page["latest"] == "N")
55
		{
56
			echo "<div class=\"revisioninfo\">Ceci est une version archiv&eacute;e de <a href=\"",$this->href(),"\">",$this->GetPageTag(),"</a> &agrave; ",$this->page["time"],".</div>";
57
		}
58
 
59
 
60
		// display page
61
		echo $this->Format($this->page["body"], "wakka");
62
 
63
		// if this is an old revision, display some buttons
64
		if (($this->page["latest"] == "N") && $this->HasAccess("write"))
65
		{
66
			$latest = $this->LoadPage($this->tag);
67
			?>
68
			<br />
69
			<?php echo  $this->FormOpen("edit") ?>
70
			<input type="hidden" name="previous" value="<?php echo  $latest["id"] ?>">
71
			<input type="hidden" name="body" value="<?php echo  htmlentities($this->page["body"]) ?>">
72
			<input type="submit" value="R&eacute;&eacute;diter cette version archiv&eacute;e">
73
			<?php echo  $this->FormClose(); ?>
74
			<?php
75
		}
76
	}
77
}
78
else
79
{
80
	echo "<i>Vous n'&ecirc;tes pas autoris&eacute; &agrave; lire cette page</i>" ;
81
}
82
?>
83
<hr class="hr_clear" />
84
</div>
85
 
86
 
87
<?php
88
if ($HasAccessRead)
89
{
90
	// load comments for this page
91
	$comments = $this->LoadComments($this->tag);
92
 
93
	// store comments display in session
94
	$tag = $this->GetPageTag();
95
	if (!isset($_SESSION["show_comments"][$tag]))
96
		$_SESSION["show_comments"][$tag] = ($this->UserWantsComments() ? "1" : "0");
97
	if (isset($_REQUEST["show_comments"])){
98
	switch($_REQUEST["show_comments"])
99
	{
100
	case "0":
101
		$_SESSION["show_comments"][$tag] = 0;
102
		break;
103
	case "1":
104
		$_SESSION["show_comments"][$tag] = 1;
105
		break;
106
	}
107
	}
108
	// display comments!
109
	if ($this->page && $_SESSION["show_comments"][$tag])
110
	{
111
		// display comments header
112
		?>
113
		<div class="commentsheader">
114
			Commentaires [<a href="<?php echo  $this->href("", "", "show_comments=0") ?>">Cacher commentaires/formulaire</a>]
115
		</div>
116
		<?php
117
 
118
		// display comments themselves
119
		if ($comments)
120
		{
121
			foreach ($comments as $comment)
122
			{
123
				echo "<a name=\"",$comment["tag"],"\"></a>\n" ;
124
				echo "<div class=\"comment\">\n" ;
125
				echo $this->Format($comment["body"]),"\n" ;
126
				echo "<div class=\"commentinfo\">\n-- ",$this->Format($comment["user"])," (".$comment["time"],")\n</div>\n" ;
127
				echo "</div>\n" ;
128
			}
129
		}
130
 
131
		// display comment form
132
		echo "<div class=\"commentform\">\n" ;
133
		if ($this->HasAccess("comment"))
134
		{
135
			?>
136
				Ajouter un commentaire &agrave; cette page:<br />
137
				<?php echo  $this->FormOpen("addcomment"); ?>
138
					<textarea name="body" rows="6" style="width: 100%"></textarea><br />
139
					<input type="submit" value="Ajouter Commentaire" accesskey="s">
140
				<?php echo  $this->FormClose(); ?>
141
			<?php
142
		}
143
		echo "</div>\n" ;
144
	}
145
	else
146
	{
147
		?>
148
		<div class="commentsheader">
149
		<?php
150
			switch (count($comments))
151
			{
152
			case 0:
153
				echo "Il n'y a pas de commentaire sur cette page." ;
154
				break;
155
			case 1:
156
				echo "Il y a un commentaire sur cette page." ;
157
				break;
158
			default:
159
				echo "Il y a ",count($comments)," commentaires sur cette page." ;
160
			}
161
		?>
162
 
163
		[<a href="<?php echo  $this->href("", "", "show_comments=1") ?>">Afficher commentaires/formulaire</a>]
164
 
165
		</div>
166
		<?php
167
	}
168
}
169
echo $this->Footer();
170
?>