These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Transfer handler for XOOPS |
||
4 | * |
||
5 | * This is intended to handle content intercommunication between modules as well as components |
||
6 | * There might need to be a more explicit name for the handle since it is always confusing |
||
7 | * |
||
8 | * @copyright The XOOPS project http://www.xoops.org/ |
||
9 | * @license http://www.fsf.org/copyleft/gpl.html GNU public license |
||
10 | * @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
||
11 | * @since 3.00 |
||
12 | * @version $Id$ |
||
13 | * @package Frameworks::transfer ; module::planet |
||
14 | */ |
||
15 | |||
16 | include "header.php"; |
||
17 | |||
18 | View Code Duplication | if(planet_parse_args($args_num, $args, $args_str)){ |
|
19 | $args["article"] = @$args_num[0]; |
||
20 | $args["op"] = @$args_str[0]; |
||
21 | } |
||
22 | |||
23 | $article_id = intval( empty($_GET["article"]) ? ( empty($_POST["article"]) ? @$args["article"] : $_POST["article"] ) : $_GET["article"] ); |
||
24 | |||
25 | $op = empty($_GET["op"]) ? ( empty($_POST["op"])? @$args["op"] : $_POST["op"] ) : $_GET["op"]; |
||
26 | $op = strtolower(trim($op)); |
||
27 | |||
28 | if ( empty($article_id) ) { |
||
29 | if(empty($_SERVER['HTTP_REFERER'])){ |
||
30 | include XOOPS_ROOT_PATH."/header.php"; |
||
31 | xoops_error(_NOPERM); |
||
32 | $xoopsOption['output_type'] = "plain"; |
||
33 | include XOOPS_ROOT_PATH."/footer.php"; |
||
34 | exit(); |
||
35 | }else{ |
||
36 | $ref_parser = parse_url($_SERVER['HTTP_REFERER']); |
||
37 | $uri_parser = parse_url($_SERVER['REQUEST_URI']); |
||
38 | if( |
||
39 | (!empty($ref_parser['host']) && !empty($uri_parser['host']) && $uri_parser['host'] != $ref_parser['host']) |
||
40 | || |
||
41 | ($ref_parser["path"] != $uri_parser["path"]) |
||
42 | ){ |
||
43 | include XOOPS_ROOT_PATH."/header.php"; |
||
44 | include XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/vars.php"; |
||
45 | xoops_confirm(array(), "javascript: window.close();", sprintf(planet_constant("MD_TRANSFER_DONE"),""), _CLOSE, $_SERVER['HTTP_REFERER']); |
||
46 | $xoopsOption['output_type'] = "plain"; |
||
47 | include XOOPS_ROOT_PATH."/footer.php"; |
||
48 | exit(); |
||
49 | }else{ |
||
50 | include XOOPS_ROOT_PATH."/header.php"; |
||
51 | xoops_error(_NOPERM); |
||
52 | $xoopsOption['output_type'] = "plain"; |
||
53 | include XOOPS_ROOT_PATH."/footer.php"; |
||
54 | exit(); |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 | |||
59 | $article_handler =& xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
||
60 | $article_obj =& $article_handler->get($article_id); |
||
61 | |||
62 | // Display option form |
||
63 | if(empty($op)){ |
||
64 | $module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">"; |
||
65 | include XOOPS_ROOT_PATH."/Frameworks/transfer/option.transfer.php"; |
||
66 | exit(); |
||
67 | }else{ |
||
68 | $data = array(); |
||
69 | $data["id"] = $article_id; |
||
70 | $data["title"] = $article_obj->getVar("art_title"); |
||
71 | $data["time"] = $article_obj->getTime("l"); |
||
72 | $data["image"] = ""; |
||
73 | $data["source"] = $article_obj->getVar("art_link"); |
||
74 | $data["url"] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/view.article.php".URL_DELIMITER."".$article_obj->getVar("art_id"); |
||
75 | $data["author"] = $article_obj->getVar("art_author"); |
||
76 | |||
77 | switch($op){ |
||
78 | |||
79 | // Use title |
||
80 | case "bookmark"; |
||
81 | break; |
||
82 | |||
83 | case "print": |
||
84 | case "pdf": |
||
85 | ${"{$op}_data"} =& $data; |
||
86 | ${"{$op}_data"}["date"] = $pdf_data["time"]; |
||
87 | ${"{$op}_data"}["content"] = $article_obj->getVar("art_content"); |
||
88 | break; |
||
89 | |||
90 | case "newbb": |
||
91 | default: |
||
92 | $data["content"] = $article_obj->getSummary(); |
||
93 | break; |
||
94 | } |
||
95 | include XOOPS_ROOT_PATH."/Frameworks/transfer/action.transfer.php"; |
||
96 | exit(); |
||
97 | } |
||
98 | ?> |
||
0 ignored issues
–
show
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.