46 |
jpm |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
$Id: deletepage.php 858 2007-11-22 00:46:30Z nepote $
|
|
|
4 |
Copyright 2002 David DELON
|
|
|
5 |
Copyright 2003 Eric FELDSTEIN
|
|
|
6 |
Copyright 2004 Jean Christophe ANDRÉ
|
|
|
7 |
Copyright 2006 Didier Loiseau
|
|
|
8 |
Copyright 2007 Charles NÉPOTE
|
|
|
9 |
Copyright 2013 Jean-Pascal MILCENT
|
|
|
10 |
This program is free software; you can redistribute it and/or modify
|
|
|
11 |
it under the terms of the GNU General Public License as published by
|
|
|
12 |
the Free Software Foundation; either version 2 of the License, or
|
|
|
13 |
(at your option) any later version.
|
|
|
14 |
|
|
|
15 |
This program is distributed in the hope that it will be useful,
|
|
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
18 |
GNU General Public License for more details.
|
|
|
19 |
|
|
|
20 |
You should have received a copy of the GNU General Public License
|
|
|
21 |
along with this program; if not, write to the Free Software
|
|
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
// Vérification de sécurité
|
|
|
26 |
if (!defined('WIKINI_VERSION'))
|
|
|
27 |
{
|
|
|
28 |
die ('Accès direct interdit');
|
|
|
29 |
}
|
|
|
30 |
print_r($_POST);
|
|
|
31 |
if ($this->UserIsOwner() || $this->UserIsAdmin())
|
|
|
32 |
{
|
|
|
33 |
$deletePage = false;
|
|
|
34 |
$tag = $this->GetPageTag();
|
|
|
35 |
if ($this->IsOrphanedPage($this->GetPageTag()))
|
|
|
36 |
{
|
|
|
37 |
if ($_POST['confirme'] == 'Oui') {
|
|
|
38 |
$deletePage = true;
|
|
|
39 |
}
|
|
|
40 |
else
|
|
|
41 |
{
|
|
|
42 |
$pageLink = $this->Link($tag);
|
|
|
43 |
$actionLink = $this->Href('deletepage');
|
|
|
44 |
$cancelLink = $this->Href();
|
|
|
45 |
|
|
|
46 |
$msg .= '<form action="'.$actionLink.'" method="post" style="display: inline">'."\n".
|
|
|
47 |
'<p class="alert alert-warning">Voulez-vous supprimer définitivement la page '.$pageLink.' ?<br/>'."\n".
|
|
|
48 |
'<button class="btn btn-danger" name="confirme" value="Oui" type="submit">Oui</button>'."\n".
|
|
|
49 |
'<a class="btn" href="'.$cancelLink.'">Non</a>'."\n".
|
|
|
50 |
'</p>'."\n".
|
|
|
51 |
'</form>'."\n";
|
|
|
52 |
}
|
|
|
53 |
}
|
|
|
54 |
else
|
|
|
55 |
{
|
|
|
56 |
if ($_POST['confirme'] == 'Oui') {
|
|
|
57 |
$deletePage = true;
|
|
|
58 |
}
|
|
|
59 |
else
|
|
|
60 |
{
|
|
|
61 |
$pageTag = $this->GetPageTag();
|
|
|
62 |
$tablePrefix = $this->config["table_prefix"];
|
|
|
63 |
$query = "SELECT DISTINCT from_tag ".
|
|
|
64 |
"FROM {$tablePrefix}links ".
|
|
|
65 |
"WHERE to_tag = '$pageTag'";
|
|
|
66 |
$linkedFrom = $this->LoadAll($query);
|
|
|
67 |
$pageLink = $this->ComposeLinkToPage($this->tag, "", "", 0);
|
|
|
68 |
|
|
|
69 |
$msg = '<p><em>Cette page n\'est pas orpheline.</em></p>'."\n".
|
|
|
70 |
'<p>Pages ayant un lien vers '.$pageLink.' :</p>'."\n".
|
|
|
71 |
'<ul>'."\n";
|
|
|
72 |
foreach ($linkedFrom as $page)
|
|
|
73 |
{
|
|
|
74 |
$currentPageLink = $this->ComposeLinkToPage($page['from_tag'], '', '', 0);
|
|
|
75 |
$msg .= '<li>'.$currentPageLink.'</li>'."\n";
|
|
|
76 |
}
|
|
|
77 |
$msg .= '</ul>'."\n";
|
|
|
78 |
|
|
|
79 |
if ($this->UserIsAdmin()) {
|
|
|
80 |
$actionLink = $this->Href('deletepage');
|
|
|
81 |
$cancelLink = $this->Href();
|
|
|
82 |
$msg .= '<form action="'.$actionLink.'" method="post" style="display: inline">'."\n".
|
|
|
83 |
'<p class="alert alert-warning">En tant qu\'administrateur, vous pouvez supprimer malgré tout la page.<br/>'.
|
|
|
84 |
'Cela laissera des liens de type "page à créer" dans les pages listées ci-dessus.<br/>'.
|
|
|
85 |
'Voulez-vous supprimer définitivement la page '.$pageLink.' ?<br/>'."\n".
|
|
|
86 |
'<button class="btn btn-danger" name="confirme" value="Oui" type="submit">Oui</button>'."\n".
|
|
|
87 |
'<a class="btn" href="'.$cancelLink.'">Non</a>'."\n".
|
|
|
88 |
'</p>'."\n".
|
|
|
89 |
'</form>'."\n";
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
if ($deletePage == true) {
|
|
|
95 |
$this->DeleteOrphanedPage($tag);
|
|
|
96 |
$this->LogAdministrativeAction($this->GetUserName(), "Suppression de la page ->\"\"" . $tag . "\"\"");
|
|
|
97 |
$msg = '<p class="alert alert-info">'."La page ${tag} a été définitivement supprimée.".'</p>';
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
else
|
|
|
101 |
{
|
|
|
102 |
$msg = '<p class="alert alert-warning"><em>'."Vous n'êtes pas le propriétaire de cette page.".'</em></p>'."\n";
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
echo $this->Header();
|
|
|
106 |
echo '<div class="page">'."\n";
|
|
|
107 |
echo $msg;
|
|
|
108 |
echo '</div>'."\n";
|
|
|
109 |
echo $this->Footer();
|
|
|
110 |
?>
|