Alternc
3.2
Alternc logiel libre pour l'hébergement
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
bro_editor.php
Go to the documentation of this file.
1
<?php
2
/*
3
$Id: bro_editor.php,v 1.5 2005/05/03 14:49:06 anarcat Exp $
4
----------------------------------------------------------------------
5
AlternC - Web Hosting System
6
Copyright (C) 2002 by the AlternC Development Team.
7
http://alternc.org/
8
----------------------------------------------------------------------
9
Based on:
10
Valentin Lacambre's web hosting softwares: http://altern.org/
11
----------------------------------------------------------------------
12
LICENSE
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 (GPL)
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
To read the license please visit http://www.gnu.org/copyleft/gpl.html
25
----------------------------------------------------------------------
26
Original Author of file: Benjamin Sonntag
27
Purpose of file: Editor of the browser
28
----------------------------------------------------------------------
29
*/
30
require_once(
"../class/config.php"
);
31
32
$fields
= array (
33
"editfile"
=> array (
"request"
,
"string"
,
""
),
34
"texte"
=> array (
"post"
,
"string"
,
""
),
35
"save"
=> array (
"post"
,
"string"
,
""
),
36
"saveret"
=> array (
"post"
,
"string"
,
""
),
37
"cancel"
=> array (
"post"
,
"string"
,
""
),
38
"R"
=> array (
"request"
,
"string"
,
""
),
39
);
40
getFields
(
$fields
);
41
42
$editfile
=
ssla
(
$editfile
);
43
$texte
=
ssla
(
$texte
);
44
45
$R
=$bro->convertabsolute(
$R
,1);
46
$p
=$bro->GetPrefs();
47
48
if
(
isset
($cancel) && $cancel) {
49
include(
"bro_main.php"
);
50
exit
();
51
}
52
53
if
(
isset
($saveret) && $saveret) {
54
if
($bro->save(
$editfile
,
$R
,
$texte
)) {
55
$error
=sprintf(_(
"Your file %s has been saved"
),
$editfile
).
" ("
.
format_date
(_(
'%3$d-%2$d-%1$d %4$d:%5$d'
),date(
"Y-m-d H:i:s"
)).
")"
;
56
}
else
{
57
$error
=
$err
->errstr();
58
}
59
include(
"bro_main.php"
);
60
exit
();
61
}
62
if
(
isset
($save) && $save) {
63
if
($bro->save(
$editfile
,
$R
,
$texte
)) {
64
$error
=sprintf(_(
"Your file %s has been saved"
),
$editfile
).
" ("
.
format_date
(_(
'%3$d-%2$d-%1$d %4$d:%5$d'
),date(
"Y-m-d H:i:s"
)).
")"
;
65
}
else
{
66
$error
=
$err
->errstr();
67
}
68
}
69
70
include_once(
"head.php"
);
71
72
?>
73
<p>
74
<?php
if
(
isset
(
$error
) &&
$error
) echo
"<p class=\"alert alert-danger\">$error</p>"
; ?>
75
<h3><?php echo _(
"File editing"
).
" <code>$R/<b>$editfile</b></code><br />"
; ?></h3>
76
</p>
77
78
<?php
79
$content
=$bro->content(
$R
,
$editfile
);
80
?>
81
82
<form action=
"bro_editor.php"
method=
"post"
><br />
83
<div
id
=
"tabsfile"
>
84
<ul>
85
<li
class
=
"view"
><a href=
"#tabsfile-view"
><?php
__
(
"View"
); ?></a></li>
86
<li
class
=
"edit"
><a href=
"#tabsfile-edit"
><?php
__
(
"Edit"
); ?></a></li>
87
</ul>
88
89
<div
id
=
"tabsfile-view"
>
90
<?php
91
echo
"<pre class='prettyprint' id='file_content_view' >$content</pre>"
;
92
?>
93
</div>
94
95
<div
id
=
"tabsfile-edit"
>
96
<textarea
id
=
'file_content_editor'
class
=
"int"
style
=
"font-family: <?php echo $p["
editor_font
"]; ?>; font-size: <?php echo $p["
editor_size
"]; ?>; width: 90%; height: 400px;"
name=
"texte"
><?php
97
if
(empty(
$content
)) {
98
$error
=_(
"This file is empty"
);
99
}
else
{
100
echo
$content
;
101
}
102
?></textarea>
103
</div>
104
</div><!-- tabsfile -->
105
<br/>
106
<?php
if
(!empty(
$error
)) echo
"<p class=\"alert alert-danger\">"
.$error.
"</p>"
; ?>
107
<input type=
"hidden"
name=
"editfile"
value=
"<?php echo str_replace("
\
""
,
"""
,
$editfile
); ?>
" />
108
<input type="
hidden
" name="
R
" value="
<?php echo str_replace(
"\""
,
"""
,
$R
); ?>
" />
109
110
<input type="
submit
" class="
inb
" value="
<?php
__
(
"Save"
); ?>
" name="
save
" />
111
<input type="
submit
" class="
inb
" value="
<?php
__
(
"Save & Quit"
); ?>
" name="
saveret
" />
112
<input type="
submit
" class="
inb
" value="
<?php
__
(
"Quit"
); ?>
" name="
cancel
" />
113
<br />
114
</form>
115
116
<script type="
text/javascript
">
117
$(function() {$( "
#tabsfile
" ).tabs();});
118
119
$('#tabsfile').on('tabsbeforeactivate', function(event, ui){
120
var b = $('#file_content_editor').val();
121
$('#file_content_view').text( b );
122
$('#file_content_view').removeClass('prettyprinted');
123
PR.prettyPrint();
124
});
125
</script>
126
127
128
<?php include_once("
foot.php
"); ?>
code
alternc
bureau
admin
bro_editor.php
Generated on Mon Mar 24 2014 17:14:20 for Alternc by
1.8.1.2