Revision 242
Added by stefan about 19 years ago
trunk/wb/admin/pages/index.php | ||
---|---|---|
223 | 223 |
</td> |
224 | 224 |
<td width="20"> |
225 | 225 |
<?php if($page['visibility'] != 'deleted' AND $page['visibility'] != 'none') { ?> |
226 |
<a href="<?php echo page_link($page['link']); ?>" target="_blank"> |
|
226 |
<a href="<?php echo $admin->page_link($page['link']); ?>" target="_blank">
|
|
227 | 227 |
<img src="<?php echo ADMIN_URL; ?>/images/view_16.png" border="0" alt="<?php echo $TEXT['VIEW']; ?>" /> |
228 | 228 |
</a> |
229 | 229 |
<?php } ?> |
trunk/wb/modules/news/submit_comment.php | ||
---|---|---|
26 | 26 |
// Include config file |
27 | 27 |
require('../../config.php'); |
28 | 28 |
|
29 |
// Include admin class |
|
30 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
31 |
$admin = new admin('Start', 'start', false, false); |
|
32 |
|
|
33 |
// Include WB functions file |
|
34 |
if(!defined('FUNCTIONS_CLASS_LOADED')) { |
|
35 |
require(WB_PATH.'/framework/functions.php'); |
|
36 |
} |
|
37 |
|
|
38 | 29 |
// Check if we should show the form or add a comment |
39 | 30 |
if(is_numeric($_GET['page_id']) AND is_numeric($_GET['section_id']) AND isset($_GET['post_id']) AND is_numeric($_GET['post_id']) AND isset($_POST['comment']) AND $_POST['comment'] != '') { |
40 | 31 |
|
... | ... | |
42 | 33 |
$page_id = $_GET['page_id']; |
43 | 34 |
$section_id = $_GET['section_id']; |
44 | 35 |
$post_id = $_GET['post_id']; |
45 |
$title = $admin->add_slashes(strip_tags($_POST['title']));
|
|
46 |
$comment = $admin->add_slashes(strip_tags($_POST['comment']));
|
|
36 |
$title = $wb->add_slashes(strip_tags($_POST['title']));
|
|
37 |
$comment = $wb->add_slashes(strip_tags($_POST['comment']));
|
|
47 | 38 |
$commented_when = mktime(); |
48 |
if(isset($admin) AND $admin->is_authenticated() == true) {
|
|
49 |
$commented_by = $admin->get_user_id();
|
|
39 |
if($wb->is_authenticated() == true) {
|
|
40 |
$commented_by = $wb->get_user_id();
|
|
50 | 41 |
} else { |
51 | 42 |
$commented_by = ''; |
52 | 43 |
} |
... | ... | |
54 | 45 |
// Get page link |
55 | 46 |
$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'"); |
56 | 47 |
$page = $query_page->fetchRow(); |
57 |
header('Location: '.page_link($page['link']).'?id='.$post_id); |
|
48 |
header('Location: '.$wb->page_link($page['link']).'?id='.$post_id);
|
|
58 | 49 |
|
59 | 50 |
} else { |
60 | 51 |
header('Location: '.WB_URL.'/pages/'); |
trunk/wb/framework/class.wb.php | ||
---|---|---|
95 | 95 |
return str_replace("\\","\\\\",$input); |
96 | 96 |
} |
97 | 97 |
|
98 |
function page_link($link){ |
|
99 |
// Check for :// in the link (used in URL's) as well as mailto: |
|
100 |
if(strstr($link, '://') == '' AND substr($link, 0, 7) != 'mailto:') { |
|
101 |
return WB_URL.PAGES_DIRECTORY.$link.PAGE_EXTENSION; |
|
102 |
} else { |
|
103 |
return $link; |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
98 | 107 |
// Get POST data |
99 | 108 |
function get_post($field) { |
100 | 109 |
if(isset($_POST[$field])) { |
... | ... | |
186 | 195 |
|
187 | 196 |
|
188 | 197 |
} |
189 |
?>
|
|
198 |
?> |
trunk/wb/framework/class.frontend.php | ||
---|---|---|
131 | 131 |
$this->page = $get_page->fetchRow(); |
132 | 132 |
// Check if the page language is also the selected language. If not, send headers again. |
133 | 133 |
if ($this->page['language']!=LANGUAGE) { |
134 |
require_once(WB_PATH.'/framework/functions.php'); |
|
135 | 134 |
header('Location: '.$this->page_link($this->page['link']).'?lang='.$this->page['language']); |
136 | 135 |
exit(); |
137 | 136 |
} |
... | ... | |
249 | 248 |
} |
250 | 249 |
} |
251 | 250 |
|
252 |
function page_link($link){ |
|
253 |
// Check for :// in the link (used in URL's) as well as mailto: |
|
254 |
if(strstr($link, '://') == '' AND substr($link, 0, 7) != 'mailto:') { |
|
255 |
return WB_URL.PAGES_DIRECTORY.$link.PAGE_EXTENSION; |
|
256 |
} else { |
|
257 |
return $link; |
|
258 |
} |
|
259 |
} |
|
260 |
|
|
261 | 251 |
function preprocess(&$content) { |
262 | 252 |
global $database; |
263 | 253 |
// Replace [wblink--PAGE_ID--] with real link |
trunk/wb/framework/functions.php | ||
---|---|---|
405 | 405 |
// Function to work out a page link |
406 | 406 |
if(!function_exists('page_link')) { |
407 | 407 |
function page_link($link) { |
408 |
// Check for :// in the link (used in URL's) as well as mailto: |
|
409 |
if(strstr($link, '://') == '' AND substr($link, 0, 7) != 'mailto:') { |
|
410 |
return WB_URL.PAGES_DIRECTORY.$link.PAGE_EXTENSION; |
|
411 |
} else { |
|
412 |
return $link; |
|
413 |
} |
|
408 |
global $admin; |
|
409 |
return $admin->page_link($link); |
|
414 | 410 |
} |
415 | 411 |
} |
416 | 412 |
|
Also available in: Unified diff
Moved page_link function to class wb and changed page_link() in functions.php to use the wb class method