Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
fdl_method.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Anakeen
4
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5
* @package FDL
6
*/
7
/**
8
* Apply document methods
9
*
10
* @author Anakeen 2000
11
* @version $Id: fdl_method.php,v 1.8 2008/12/12 14:38:29 marc Exp $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage
15
*/
16
/**
17
*/
18
19
include_once (
"FDL/Class.Doc.php"
);
20
function
fdl_method
(&
$action
)
21
{
22
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
23
$docid
=
GetHttpVars
(
"id"
, 0);
24
$method
=
GetHttpVars
(
"method"
);
25
$zone =
GetHttpVars
(
"zone"
);
26
$noredirect = (strtolower(substr(
GetHttpVars
(
"redirect"
) , 0, 1)) ==
"n"
);
27
28
$doc
=
new_Doc
(
$dbaccess
,
$docid
);
29
30
if
(
$doc
&&
$doc
->isAlive()) {
31
32
$err
=
$doc
->control(
"view"
);
33
if
(
$err
!=
""
)
$action
->exitError(
$err
);
34
if
(!strpos(
$method
,
'('
))
$method
.=
'()'
;
35
if
(!strpos(
$method
,
'::'
))
$method
=
'::'
.
$method
;
36
$err
=
$doc
->ApplyMethod(
$method
);
37
}
38
39
if
(
$err
!=
""
)
$action
->AddWarningMsg(
$err
);
40
$action
->AddLogMsg(sprintf(_(
"method %s executed for %s "
) ,
$method
,
$doc
->title));
41
42
if
(!$noredirect) {
43
if
($zone) $opt =
"&zone=$zone"
;
44
if
(
$location
=
$_SERVER
[
"HTTP_REFERER"
]) {
45
Header(
"Location: $location"
);
46
exit
;
47
}
else
{
48
redirect(
$action
,
"FDL"
, sprintf(
"FDL_CARD%s&id=%d"
, $opt,
$doc
->id));
49
}
50
}
else
$action
->lay->template = sprintf(_(
"method %s applied to document %s #%d"
) ,
$method
,
$doc
->title,
$doc
->id);
51
}
52
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase