1- <?php
2- /**
3- * iForum - a bulletin Board (Forum) for ImpressCMS
4- *
5- * Based upon CBB 3.08
6- *
7- * @copyright http://www.xoops.org/ The XOOPS Project
8- * @copyright http://xoopsforge.com The XOOPS FORGE Project
9- * @copyright http://xoops.org.cn The XOOPS CHINESE Project
10- * @copyright XOOPS_copyrights.txt
11- * @copyright readme.txt
12- * @copyright http://www.impresscms.org/ The ImpressCMS Project
13- * @license GNU General Public License (GPL)
14- * a copy of the GNU license is enclosed.
15- * ----------------------------------------------------------------------------------------------------------
16- * @package CBB - XOOPS Community Bulletin Board
17- * @since 3.08
18- * @author phppp
19- * ----------------------------------------------------------------------------------------------------------
20- * iForum - a bulletin Board (Forum) for ImpressCMS
21- * @since 1.00
22- * @author modified by stranger
23- * @version $Id$
24- */
25-
26- die ('Sorry, this feature is not ready yet!<br /> ' );
27- include "header.php " ;
28-
29- $ forum = intval (empty ($ _GET ["forum " ])?(empty ($ _POST ["forum " ])?0 :$ _POST ["forum " ]):$ _GET ["forum " ] );
30- $ topic_id = intval (empty ($ _GET ["topic_id " ])?(empty ($ _POST ["topic_id " ])?0 :$ _POST ["topic_id " ]):$ _GET ["topic_id " ] );
31- $ post_id = intval (empty ($ _GET ["post_id " ])?(empty ($ _POST ["post_id " ])?0 :$ _POST ["post_id " ]):$ _GET ["post_id " ] );
32-
33- if (empty ($ post_id ) )
34- {
35- if (empty ($ _SERVER ['HTTP_REFERER ' ]))
36- {
37- include ICMS_ROOT_PATH ."/header.php " ;
38- icms_core_Message::error (_NOPERM );
39- $ xoopsOption ['output_type ' ] = "plain " ;
40- include ICMS_ROOT_PATH ."/footer.php " ;
41- exit ();
42- }
43- else
44- {
45- $ ref_parser = parse_url ($ _SERVER ['HTTP_REFERER ' ]);
46- $ uri_parser = parse_url ($ _SERVER ['REQUEST_URI ' ]);
47- if (
48- (!empty ($ ref_parser ['host ' ]) && !empty ($ uri_parser ['host ' ]) && $ uri_parser ['host ' ] != $ ref_parser ['host ' ])
49- || ($ ref_parser ["path " ] != $ uri_parser ["path " ])
50- )
51- {
52- include ICMS_ROOT_PATH ."/header.php " ;
53- xoops_confirm (array (), "javascript: window.close(); " , sprintf (_MD_TRANSFER_DONE , "" ), _CLOSE , $ _SERVER ['HTTP_REFERER ' ]);
54- $ xoopsOption ['output_type ' ] = "plain " ;
55- include ICMS_ROOT_PATH ."/footer.php " ;
56- exit ();
57- }
58- else
59- {
60- include ICMS_ROOT_PATH ."/header.php " ;
61- icms_core_Message::error (_NOPERM );
62- $ xoopsOption ['output_type ' ] = "plain " ;
63- include ICMS_ROOT_PATH ."/footer.php " ;
64- exit ();
65- }
66- }
67- }
68-
69- $ post_handler = icms_getmodulehandler ('post ' , basename (__DIR__ ), 'iforum ' );
70- $ post = $ post_handler ->get ($ post_id );
71- if (!$ approved = $ post ->getVar ('approved ' )) die (_NOPERM );
72-
73- $ topic_handler = icms_getmodulehandler ('topic ' , basename (__DIR__ ), 'iforum ' );
74- $ forumtopic = $ topic_handler ->getByPost ($ post_id );
75- $ topic_id = $ forumtopic ->getVar ('topic_id ' );
76- if (!$ approved = $ forumtopic ->getVar ('approved ' )) die (_NOPERM );
77-
78- $ forum_handler = icms_getmodulehandler ('forum ' , basename (__DIR__ ), 'iforum ' );
79- $ forum = ($ forum )?$ forum :
80- $ forumtopic ->getVar ('forum_id ' );
81- $ viewtopic_forum = $ forum_handler ->get ($ forum );
82- if (!$ forum_handler ->getPermission ($ viewtopic_forum )) die (_NOPERM );
83- if (!$ topic_handler ->getPermission ($ viewtopic_forum , $ forumtopic ->getVar ('topic_status ' ), "view " )) die (_NOPERM );
84- //if ( !$forumdata = $topic_handler->getViewData($topic_id, $forum) )die(_NOPERM);
85-
86- $ op = empty ($ _POST ["op " ])?"" :
87- $ _POST ["op " ];
88- $ op = strtolower (trim ($ op ));
89-
90- $ transfer_handler = icms_getmodulehandler ("transfer " , basename (__DIR__ ), 'iforum ' );
91- $ op_options = $ transfer_handler ->getList ();
92-
93- // Display option form
94- if (empty ($ _POST ["op " ]))
95- {
96- include ICMS_ROOT_PATH ."/header.php " ;
97- echo "<div class= \"confirmMsg \" style= \"width: 80%; padding:20px;margin:10px auto; text-align:left !important; \"><h2> " ._MD_TRANSFER_DESC ."</h2><br /> " ;
98- echo "<form name= \"opform \" id= \"opform \" action= \"" .xoops_getenv ("PHP_SELF " )."\" method= \"post \"><ul> \n" ;
99- foreach ($ op_options as $ value => $ title )
100- {
101- echo "<li><a href= \"### \" onclick= \"document.forms.opform.op.value=' " .$ value ."'; document.forms.opform.submit(); \"> " .$ title ."</a></li> \n" ;
102- }
103- echo "<input type= \"hidden \" name= \"forum \" id= \"forum \" value= \"" .$ forum ."\"> " ;
104- echo "<input type= \"hidden \" name= \"topic_id \" id= \"topic_id \" value= \"" .$ topic_id ."\"> " ;
105- echo "<input type= \"hidden \" name= \"post_id \" id= \"post_id \" value= \"" .$ post_id ."\"> " ;
106- echo "<input type= \"hidden \" name= \"op \" id= \"op \" value= \"\"> " ;
107- echo "</url></form></div> " ;
108- $ xoopsOption ['output_type ' ] = "plain " ;
109- include ICMS_ROOT_PATH ."/footer.php " ;
110- exit ();
111- }
112- else
113- {
114- $ data = array ();
115- $ data ["id " ] = $ post_id ;
116- $ data ["uid " ] = $ post ->getVar ("uid " );
117- $ data ["url " ] = ICMS_URL ."/modules/ " .basename (__DIR__ )."/viewtopic.php?topic_id= " .$ topic_id ."&post_id= " .$ post_id ;
118- $ post_data = $ post ->getPostBody ();
119- $ data ["author " ] = $ post_data ["author " ];
120- $ data ["title " ] = $ post_data ["subject " ];
121- $ data ["content " ] = $ post_data ["text " ];
122- $ data ["time " ] = formatTimestamp ($ post_data ["date " ]);
123-
124- switch ($ op )
125- {
126- case "pdf " :
127- $ data ['subtitle ' ] = $ forumtopic ->getVar ('topic_title ' );
128- break ;
129-
130- // Use regular content
131- default :
132- break ;
133- }
134-
135- $ ret = $ transfer_handler ->do_transfer ($ _POST ["op " ], $ data );
136-
137- include ICMS_ROOT_PATH ."/header.php " ;
138- $ ret = empty ($ ret )?"javascript: window.close(); " :
139- $ ret ;
140- xoops_confirm (array (), "javascript: window.close(); " , sprintf (_MD_TRANSFER_DONE , $ op_options [$ op ]), _CLOSE , $ ret );
141- include ICMS_ROOT_PATH ."/footer.php " ;
1+ <?php
2+ /**
3+ * iForum - a bulletin Board (Forum) for ImpressCMS
4+ *
5+ * Based upon CBB 3.08
6+ *
7+ * @copyright http://www.xoops.org/ The XOOPS Project
8+ * @copyright http://xoopsforge.com The XOOPS FORGE Project
9+ * @copyright http://xoops.org.cn The XOOPS CHINESE Project
10+ * @copyright XOOPS_copyrights.txt
11+ * @copyright readme.txt
12+ * @copyright http://www.impresscms.org/ The ImpressCMS Project
13+ * @license GNU General Public License (GPL)
14+ * a copy of the GNU license is enclosed.
15+ * ----------------------------------------------------------------------------------------------------------
16+ * @package CBB - XOOPS Community Bulletin Board
17+ * @since 3.08
18+ * @author phppp
19+ * ----------------------------------------------------------------------------------------------------------
20+ * iForum - a bulletin Board (Forum) for ImpressCMS
21+ * @since 1.00
22+ * @author modified by stranger
23+ * @version $Id$
24+ */
25+
26+ die ('Sorry, this feature is not ready yet!<br /> ' );
27+ include "header.php " ;
28+
29+ $ forum = intval (empty ($ _GET ["forum " ])?(empty ($ _POST ["forum " ])?0 :$ _POST ["forum " ]):$ _GET ["forum " ] );
30+ $ topic_id = intval (empty ($ _GET ["topic_id " ])?(empty ($ _POST ["topic_id " ])?0 :$ _POST ["topic_id " ]):$ _GET ["topic_id " ] );
31+ $ post_id = intval (empty ($ _GET ["post_id " ])?(empty ($ _POST ["post_id " ])?0 :$ _POST ["post_id " ]):$ _GET ["post_id " ] );
32+
33+ if (empty ($ post_id ) )
34+ {
35+ if (empty ($ _SERVER ['HTTP_REFERER ' ]))
36+ {
37+ include ICMS_ROOT_PATH ."/header.php " ;
38+ icms_core_Message::error (_NOPERM );
39+ $ xoopsOption ['output_type ' ] = "plain " ;
40+ include ICMS_ROOT_PATH ."/footer.php " ;
41+ exit ();
42+ }
43+ else
44+ {
45+ $ ref_parser = parse_url ($ _SERVER ['HTTP_REFERER ' ]);
46+ $ uri_parser = parse_url ($ _SERVER ['REQUEST_URI ' ]);
47+ if (
48+ (!empty ($ ref_parser ['host ' ]) && !empty ($ uri_parser ['host ' ]) && $ uri_parser ['host ' ] != $ ref_parser ['host ' ])
49+ || ($ ref_parser ["path " ] != $ uri_parser ["path " ])
50+ )
51+ {
52+ include ICMS_ROOT_PATH ."/header.php " ;
53+ xoops_confirm (array (), "javascript: window.close(); " , sprintf (_MD_TRANSFER_DONE , "" ), _CLOSE , $ _SERVER ['HTTP_REFERER ' ]);
54+ $ xoopsOption ['output_type ' ] = "plain " ;
55+ include ICMS_ROOT_PATH ."/footer.php " ;
56+ exit ();
57+ }
58+ else
59+ {
60+ include ICMS_ROOT_PATH ."/header.php " ;
61+ icms_core_Message::error (_NOPERM );
62+ $ xoopsOption ['output_type ' ] = "plain " ;
63+ include ICMS_ROOT_PATH ."/footer.php " ;
64+ exit ();
65+ }
66+ }
67+ }
68+
69+ $ post_handler = icms_getmodulehandler ('post ' , basename (__DIR__ ), 'iforum ' );
70+ $ post = $ post_handler ->get ($ post_id );
71+ if (!$ approved = $ post ->getVar ('approved ' )) die (_NOPERM );
72+
73+ $ topic_handler = icms_getmodulehandler ('topic ' , basename (__DIR__ ), 'iforum ' );
74+ $ forumtopic = $ topic_handler ->getByPost ($ post_id );
75+ $ topic_id = $ forumtopic ->getVar ('topic_id ' );
76+ if (!$ approved = $ forumtopic ->getVar ('approved ' )) die (_NOPERM );
77+
78+ $ forum_handler = icms_getmodulehandler ('forum ' , basename (__DIR__ ), 'iforum ' );
79+ $ forum = ($ forum )?$ forum :
80+ $ forumtopic ->getVar ('forum_id ' );
81+ $ viewtopic_forum = $ forum_handler ->get ($ forum );
82+ if (!$ forum_handler ->getPermission ($ viewtopic_forum )) die (_NOPERM );
83+ if (!$ topic_handler ->getPermission ($ viewtopic_forum , $ forumtopic ->getVar ('topic_status ' ), "view " )) die (_NOPERM );
84+ //if ( !$forumdata = $topic_handler->getViewData($topic_id, $forum) )die(_NOPERM);
85+
86+ $ op = empty ($ _POST ["op " ])?"" :
87+ $ _POST ["op " ];
88+ $ op = strtolower (trim ($ op ));
89+
90+ $ transfer_handler = icms_getmodulehandler ("transfer " , basename (__DIR__ ), 'iforum ' );
91+ $ op_options = $ transfer_handler ->getList ();
92+
93+ // Display option form
94+ if (empty ($ _POST ["op " ]))
95+ {
96+ include ICMS_ROOT_PATH ."/header.php " ;
97+ echo "<div class= \"confirmMsg \" style= \"width: 80%; padding:20px;margin:10px auto; text-align:left !important; \"><h2> " ._MD_TRANSFER_DESC ."</h2><br /> " ;
98+ echo "<form name= \"opform \" id= \"opform \" action= \"" .xoops_getenv ("PHP_SELF " )."\" method= \"post \"><ul> \n" ;
99+ foreach ($ op_options as $ value => $ title )
100+ {
101+ echo "<li><a href= \"### \" onclick= \"document.forms.opform.op.value=' " .$ value ."'; document.forms.opform.submit(); \"> " .$ title ."</a></li> \n" ;
102+ }
103+ echo "<input type= \"hidden \" name= \"forum \" id= \"forum \" value= \"" .$ forum ."\"> " ;
104+ echo "<input type= \"hidden \" name= \"topic_id \" id= \"topic_id \" value= \"" .$ topic_id ."\"> " ;
105+ echo "<input type= \"hidden \" name= \"post_id \" id= \"post_id \" value= \"" .$ post_id ."\"> " ;
106+ echo "<input type= \"hidden \" name= \"op \" id= \"op \" value= \"\"> " ;
107+ echo "</url></form></div> " ;
108+ $ xoopsOption ['output_type ' ] = "plain " ;
109+ include ICMS_ROOT_PATH ."/footer.php " ;
110+ exit ();
111+ }
112+ else
113+ {
114+ $ data = array ();
115+ $ data ["id " ] = $ post_id ;
116+ $ data ["uid " ] = $ post ->getVar ("uid " );
117+ $ data ["url " ] = ICMS_URL ."/modules/ " .basename (__DIR__ )."/viewtopic.php?topic_id= " .$ topic_id ."&post_id= " .$ post_id ;
118+ $ post_data = $ post ->getPostBody ();
119+ $ data ["author " ] = $ post_data ["author " ];
120+ $ data ["title " ] = $ post_data ["subject " ];
121+ $ data ["content " ] = $ post_data ["text " ];
122+ $ data ["time " ] = formatTimestamp ($ post_data ["date " ]);
123+
124+ switch ($ op )
125+ {
126+ case "pdf " :
127+ $ data ['subtitle ' ] = $ forumtopic ->getVar ('topic_title ' );
128+ break ;
129+
130+ // Use regular content
131+ default :
132+ break ;
133+ }
134+
135+ $ ret = $ transfer_handler ->do_transfer ($ _POST ["op " ], $ data );
136+
137+ include ICMS_ROOT_PATH ."/header.php " ;
138+ $ ret = empty ($ ret )?"javascript: window.close(); " :
139+ $ ret ;
140+ xoops_confirm (array (), "javascript: window.close(); " , sprintf (_MD_TRANSFER_DONE , $ op_options [$ op ]), _CLOSE , $ ret );
141+ include ICMS_ROOT_PATH ."/footer.php " ;
142142}
0 commit comments