Revision 562
Added by Matthias almost 18 years ago
| trunk/CHANGELOG | ||
|---|---|---|
| 13 | 13 |
------------------------------------- 2.7.0 ------------------------------------- |
| 14 | 14 |
|
| 15 | 15 |
18-Jan-2008 Matthias Gallas |
| 16 |
! Updated news modul with features from the advanced news modul |
|
| 16 | 17 |
! Updated form modul with features from the advanced form modul |
| 17 | 18 |
# Fixed hardcoded /pages issue in intro page feature |
| 18 | 19 |
+ Added example .htaccess to parse .html files, fixed bug in changeset 555 |
| trunk/wb/upgrade-script.php | ||
|---|---|---|
| 198 | 198 |
} |
| 199 | 199 |
|
| 200 | 200 |
|
| 201 |
$database = new database(DB_URL); |
|
| 202 |
|
|
| 201 | 203 |
//****************************************************************************** |
| 202 |
//The following lines upgrades the form modul from 2.6.x to the andvanced version from 2.7.x
|
|
| 204 |
//Start of upgrade script for the form modul
|
|
| 203 | 205 |
//****************************************************************************** |
| 204 | 206 |
|
| 205 |
$database = new database(DB_URL); |
|
| 206 |
|
|
| 207 | 207 |
echo "<BR><B>Adding new field to database table mod_form_settings</B><BR>"; |
| 208 | 208 |
|
| 209 | 209 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_subject` VARCHAR(255) NOT NULL AFTER `success_message`")) {
|
| ... | ... | |
| 296 | 296 |
//End of upgrade script for the form modul |
| 297 | 297 |
//****************************************************************************** |
| 298 | 298 |
|
| 299 |
//****************************************************************************** |
|
| 300 |
//Start of upgrade script for the news modul |
|
| 301 |
//****************************************************************************** |
|
| 302 |
|
|
| 303 |
echo "<BR><B>Adding new field to database table mod_news_posts</B><BR>"; |
|
| 304 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_news_posts` ADD `published_when` INT NOT NULL AFTER `commenting`")) {
|
|
| 305 |
echo 'Database Field published_when added successfully<br />'; |
|
| 306 |
} |
|
| 307 |
echo mysql_error().'<br />'; |
|
| 308 |
|
|
| 309 |
// UPDATING DATA INTO FIELDS |
|
| 310 |
echo "<BR>"; |
|
| 311 |
|
|
| 312 |
// These are the default setting |
|
| 313 |
$header = '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"98%\">'; |
|
| 314 |
$post_loop = '<tr class=\"post_top\"> |
|
| 315 |
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td> |
|
| 316 |
<td class=\"post_date\">[MODI_TIME], [MODI_DATE]</td> |
|
| 317 |
</tr> |
|
| 318 |
<tr> |
|
| 319 |
<td class=\"post_short\" colspan=\"2\"> |
|
| 320 |
[SHORT] |
|
| 321 |
<a href=\"[LINK]\">[TEXT_READ_MORE]</a> |
|
| 322 |
</td> |
|
| 323 |
</tr>'; |
|
| 324 |
$post_header = addslashes('<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
|
| 325 |
<tr> |
|
| 326 |
<td height="30"><h1>[TITLE]</h1></td> |
|
| 327 |
<td rowspan="3" style="display: [DISPLAY_IMAGE]"><img src="[GROUP_IMAGE]" alt="[GROUP_TITLE]" /></td> |
|
| 328 |
</tr> |
|
| 329 |
<tr> |
|
| 330 |
<td valign="top"><b>Posted by [DISPLAY_NAME] ([USERNAME]) on [PUBL_DATE]</b></td> |
|
| 331 |
</tr> |
|
| 332 |
<tr style="display: [DISPLAY_GROUP]"> |
|
| 333 |
<td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td> |
|
| 334 |
</tr> |
|
| 335 |
</table> |
|
| 336 |
<p style="text-align: justify;">'); |
|
| 337 |
$post_footer = '</p><p>Last changed: [MODI_DATE] at [MODI_TIME]</p> |
|
| 338 |
<a href=\"[BACK]\">Back</a>'; |
|
| 339 |
$comments_header = addslashes('<br /><br />
|
|
| 340 |
<h2>Comments</h2> |
|
| 341 |
<table cellpadding="2" cellspacing="0" border="0" width="98%">'); |
|
| 342 |
|
|
| 343 |
// Insert default settings into database |
|
| 344 |
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
|
|
| 345 |
while($result = $query_dates->fetchRow()) {
|
|
| 346 |
|
|
| 347 |
echo "<B>Add default settings data to database for news section_id= ".$result['section_id']."</b><BR>"; |
|
| 348 |
$section_id = $result['section_id']; |
|
| 349 |
|
|
| 350 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
|
|
| 351 |
echo 'Database data header added successfully<br>'; |
|
| 352 |
} |
|
| 353 |
echo mysql_error().'<br />'; |
|
| 354 |
|
|
| 355 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
|
|
| 356 |
echo 'Database data post_loop added successfully<br>'; |
|
| 357 |
} |
|
| 358 |
echo mysql_error().'<br />'; |
|
| 359 |
|
|
| 360 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
|
|
| 361 |
echo 'Database data post_header added successfully<br>'; |
|
| 362 |
} |
|
| 363 |
echo mysql_error().'<br />'; |
|
| 364 |
|
|
| 365 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
|
|
| 366 |
echo 'Database data post_footer added successfully<br>'; |
|
| 367 |
} |
|
| 368 |
echo mysql_error().'<br />'; |
|
| 369 |
|
|
| 370 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
|
|
| 371 |
echo 'Database data comments_header added successfully<br>'; |
|
| 372 |
} |
|
| 373 |
echo mysql_error().'<br />'; |
|
| 374 |
|
|
| 375 |
} |
|
| 376 |
|
|
| 377 |
// MIGRATING FIELD DATES to POSTED_WHEN |
|
| 378 |
echo "<B>Copying field posted_when value to published_when</B><BR>"; |
|
| 379 |
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts where section_id != 0 and page_id != 0");
|
|
| 380 |
|
|
| 381 |
while($result = $query_dates->fetchRow()) {
|
|
| 382 |
$pid = $result['post_id']; |
|
| 383 |
$NEW_DATE = $result['posted_when']; |
|
| 384 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_posts` SET `published_when` = '$NEW_DATE' WHERE `post_id` = $pid")) {
|
|
| 385 |
echo 'Copying posted_when value to published_when successfully<br>'; |
|
| 386 |
} |
|
| 387 |
echo mysql_error().'<br />'; |
|
| 388 |
} |
|
| 389 |
|
|
| 390 |
//****************************************************************************** |
|
| 391 |
//End of upgrade script for the news modul |
|
| 392 |
//****************************************************************************** |
|
| 393 |
|
|
| 299 | 394 |
echo "<br /><br />Done<br />"; |
| 300 | 395 |
|
| 301 | 396 |
?> |
| 302 | 397 |
|
| 303 | 398 |
</body> |
| 304 |
</html> |
|
| 399 |
</html> |
|
| trunk/wb/modules/news/info.php | ||
|---|---|---|
| 26 | 26 |
$module_directory = 'news'; |
| 27 | 27 |
$module_name = 'News'; |
| 28 | 28 |
$module_function = 'page'; |
| 29 |
$module_version = '2.6';
|
|
| 29 |
$module_version = '2.7';
|
|
| 30 | 30 |
$module_platform = '2.6.x'; |
| 31 |
$module_author = 'Ryan Djurovich'; |
|
| 31 |
$module_author = 'Ryan Djurovich, Rob Smith';
|
|
| 32 | 32 |
$module_license = 'GNU General Public License'; |
| 33 | 33 |
$module_description = 'This page type is designed for making a news page.'; |
| 34 | 34 |
|
| 35 | 35 | |
| trunk/wb/modules/news/edit_css.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
###################################################################################################################### |
|
| 6 |
# |
|
| 7 |
# PURPOSE OF THIS FILE: |
|
| 8 |
# This file contains the routines required to edit the optional module files: frontend.css and backend.css. |
|
| 9 |
# Nothing needs to be changed in this file. Keep it as is. |
|
| 10 |
# |
|
| 11 |
# INVOKED BY: |
|
| 12 |
# This file should be invoked by clicking on a text link shown in modify.php. |
|
| 13 |
# |
|
| 14 |
###################################################################################################################### |
|
| 15 |
|
|
| 16 |
/** |
|
| 17 |
Module developed for the Open Source Content Management System Website Baker (http://websitebaker.org) |
|
| 18 |
Copyright (C) year, Authors name |
|
| 19 |
Contact me: author(at)domain.xxx, http://authorwebsite.xxx |
|
| 20 |
|
|
| 21 |
This module is free software. You can redistribute it and/or modify it |
|
| 22 |
under the terms of the GNU General Public License - version 2 or later, |
|
| 23 |
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html. |
|
| 24 |
|
|
| 25 |
This module is distributed in the hope that it will be useful, |
|
| 26 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 27 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 28 |
GNU General Public License for more details. |
|
| 29 |
**/ |
|
| 30 |
|
|
| 31 |
// include configuration file and admin wrapper script |
|
| 32 |
require('../../config.php');
|
|
| 33 |
require(WB_PATH.'/modules/admin.php'); |
|
| 34 |
|
|
| 35 |
// include functions to edit the optional module CSS files (frontend.css, backend.css) |
|
| 36 |
require_once('css.functions.php');
|
|
| 37 |
|
|
| 38 |
// check if action is: save or edit |
|
| 39 |
if(isset($_GET['action']) && $_GET['action'] == 'save' && isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) {
|
|
| 40 |
/** |
|
| 41 |
SAVE THE UPDATED CONTENTS TO THE CSS FILE |
|
| 42 |
*/ |
|
| 43 |
$css_content = ''; |
|
| 44 |
if(isset($_POST['css_codepress']) && strlen($_POST['css_codepress']) > 0) {
|
|
| 45 |
// if Javascript is enabled, take contents from hidden field: css_codepress |
|
| 46 |
$css_content = stripslashes($_POST['css_codepress']); |
|
| 47 |
} elseif(isset($_POST['css_data']) && strlen($_POST['css_data']) > 0) {
|
|
| 48 |
// if Javascript is disabled, take contens from textarea: css_data |
|
| 49 |
$css_content = stripslashes($_POST['css_data']); |
|
| 50 |
} |
|
| 51 |
|
|
| 52 |
$bytes = 0; |
|
| 53 |
if ($css_content != '') {
|
|
| 54 |
// open the module CSS file for writting |
|
| 55 |
$mod_file = @fopen(dirname(__FILE__) .'/' .$_POST['edit_file'], "wb"); |
|
| 56 |
// write new content to the module CSS file |
|
| 57 |
$bytes = @fwrite($mod_file, $css_content); |
|
| 58 |
// close the file |
|
| 59 |
@fclose($mod_file); |
|
| 60 |
} |
|
| 61 |
|
|
| 62 |
// write out status message |
|
| 63 |
if($bytes == 0 ) {
|
|
| 64 |
$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
| 65 |
} else {
|
|
| 66 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
} else {
|
|
| 70 |
/** |
|
| 71 |
MODIFY CONTENTS OF THE CSS FILE VIA TEXT AREA |
|
| 72 |
*/ |
|
| 73 |
|
|
| 74 |
// check which module file to edit (frontend.css, backend.css or '') |
|
| 75 |
$css_file = ''; |
|
| 76 |
if(isset($_GET['edit_file'])) $css_file = edit_mod_file($_GET['edit_file']); |
|
| 77 |
|
|
| 78 |
// display output |
|
| 79 |
if($css_file == '') {
|
|
| 80 |
// no valid module file to edit; display error message and backlink to modify.php |
|
| 81 |
echo "<h2>Nothing to edit</h2>"; |
|
| 82 |
echo "<p>No valid module file exists for this module.</p>"; |
|
| 83 |
$output = "<a href=\"#\" onclick=\"javascript: window.location = '"; |
|
| 84 |
$output .= ADMIN_URL ."/pages/modify.php?page_id=" .$page_id ."'\">back</a>"; |
|
| 85 |
echo $output; |
|
| 86 |
} else {
|
|
| 87 |
// store content of the module file in variable |
|
| 88 |
$css_content = @file_get_contents(dirname(__FILE__) .'/' .$css_file); |
|
| 89 |
// output content of module file to textareas |
|
| 90 |
?> |
|
| 91 |
|
|
| 92 |
<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'] .'?action=save';?>" method="post" style="margin: 0;"> |
|
| 93 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
|
| 94 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
|
| 95 |
<input type="hidden" name="css_codepress" value="" /> |
|
| 96 |
<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" /> |
|
| 97 |
|
|
| 98 |
<h2><?php echo $HEADING_CSS_FILE .'"' .$css_file; ?>"</h2> |
|
| 99 |
<?php |
|
| 100 |
// include the toggle button to switch between frontend.css and backend.css (if both files exists) |
|
| 101 |
toggle_css_file($css_file); |
|
| 102 |
?> |
|
| 103 |
|
|
| 104 |
<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> |
|
| 105 |
|
|
| 106 |
<textarea name="css_data" id="css_data" class="codepress css" cols="115" rows="25" wrap="VIRTUAL" style="margin:2px;"><?php echo $css_content; ?></textarea> |
|
| 107 |
|
|
| 108 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
| 109 |
<tr> |
|
| 110 |
<td align="left"> |
|
| 111 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE'];?>" onclick="javascript: css_codepress.value = css_data.getCode();" style="width: 100px; margin-top: 5px;" /> |
|
| 112 |
</td> |
|
| 113 |
<td align="right"> |
|
| 114 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL;?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
| 115 |
</td> |
|
| 116 |
</tr> |
|
| 117 |
</table> |
|
| 118 |
</form> |
|
| 119 |
<?php |
|
| 120 |
} |
|
| 121 |
} |
|
| 122 |
|
|
| 123 |
// Print admin footer |
|
| 124 |
$admin->print_footer(); |
|
| 125 |
|
|
| 126 |
?> |
|
| 0 | 127 | |
| trunk/wb/modules/news/css.functions.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
###################################################################################################################### |
|
| 6 |
# |
|
| 7 |
# PURPOSE OF THIS FILE: |
|
| 8 |
# This file contains functions to edit the module CSS files (frontend.css and backend.css) |
|
| 9 |
# |
|
| 10 |
# INVOKED BY: |
|
| 11 |
# This file is invoked when a user clicks on the edit CSS button in the modify.php file |
|
| 12 |
# |
|
| 13 |
###################################################################################################################### |
|
| 14 |
|
|
| 15 |
/** |
|
| 16 |
Module developed for the Open Source Content Management System Website Baker (http://websitebaker.org) |
|
| 17 |
Copyright (C) year, Authors name |
|
| 18 |
Contact me: author(at)domain.xxx, http://authorwebsite.xxx |
|
| 19 |
|
|
| 20 |
This module is free software. You can redistribute it and/or modify it |
|
| 21 |
under the terms of the GNU General Public License - version 2 or later, |
|
| 22 |
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html. |
|
| 23 |
|
|
| 24 |
This module is distributed in the hope that it will be useful, |
|
| 25 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 26 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 27 |
GNU General Public License for more details. |
|
| 28 |
**/ |
|
| 29 |
|
|
| 30 |
// prevent this file from being accesses directly |
|
| 31 |
if(defined('WB_PATH') == false) {
|
|
| 32 |
exit("Cannot access this file directly");
|
|
| 33 |
} |
|
| 34 |
|
|
| 35 |
/** |
|
| 36 |
DEFINE LANGUAGE DEPENDING OUTPUTS FOR THE EDIT CSS PART |
|
| 37 |
*/ |
|
| 38 |
$lang_dir = WB_PATH .'/modules/' .basename(dirname(__FILE__)) .'/languages/'; |
|
| 39 |
if(file_exists($lang_dir .LANGUAGE .'.php')) {
|
|
| 40 |
// try to include custom language file if exists |
|
| 41 |
require_once($lang_dir .LANGUAGE .'.php'); |
|
| 42 |
} elseif(file_exists($lang_dir .'EN.php')) {
|
|
| 43 |
// try to include default module language file |
|
| 44 |
require_once($lang_dir .'EN.php'); |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
// set defaults if output varibles are not set in the languages files |
|
| 48 |
if(!isset($CAP_EDIT_CSS)) $CAP_EDIT_CSS = 'Edit CSS'; |
|
| 49 |
if(!isset($CAP_TOGGLE_CSS)) $CAP_TOGGLE_CSS = 'Switch to '; |
|
| 50 |
if(!isset($HEADING_CSS_FILE)) $HEADING_CSS_FILE = 'Actual module file: '; |
|
| 51 |
if(!isset($TXT_EDIT_CSS_FILE)) $TXT_EDIT_CSS_FILE = 'Edit the CSS definitions in the textarea below.'; |
|
| 52 |
|
|
| 53 |
// this function checks if the specified optional module file exists |
|
| 54 |
if (!function_exists('mod_file_exists')) {
|
|
| 55 |
function mod_file_exists($mod_file='frontend.css') {
|
|
| 56 |
// extract the module directory |
|
| 57 |
$mod_dir = basename(dirname(__FILE__)) .'/' .$mod_file; |
|
| 58 |
return file_exists(WB_PATH .'/modules/' .$mod_dir); |
|
| 59 |
} |
|
| 60 |
} |
|
| 61 |
|
|
| 62 |
// this function displays a "Edit CSS" button in modify.php |
|
| 63 |
// if the optional module files (module.css, module.js) if exists |
|
| 64 |
if (!function_exists('css_edit')) {
|
|
| 65 |
function css_edit() {
|
|
| 66 |
global $page_id, $section_id, $CAP_EDIT_CSS; |
|
| 67 |
// extract the module directory |
|
| 68 |
$mod_dir = basename(dirname(__FILE__)); |
|
| 69 |
$frontend_css = mod_file_exists('frontend.css');
|
|
| 70 |
$backend_css = mod_file_exists('backend.css');
|
|
| 71 |
if($frontend_css || $backend_css) {
|
|
| 72 |
// display link to edit the optional CSS module files |
|
| 73 |
$file = $frontend_css ? 'frontend.css' : 'backend.css'; |
|
| 74 |
$output = '<div class="mod_' .$mod_dir .'_edit_css"><a href="' .WB_URL .'/modules/' .$mod_dir .'/edit_css.php'; |
|
| 75 |
$output .= '?page_id=' .$page_id .'§ion_id=' .$section_id .'&edit_file=' .$file .'">'; |
|
| 76 |
$output .= $CAP_EDIT_CSS .'</a></div>'; |
|
| 77 |
echo $output; |
|
| 78 |
} |
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
|
|
| 82 |
// this function returns a secure module file from $_GET['edit_file'] |
|
| 83 |
if (!function_exists('edit_mod_file')) {
|
|
| 84 |
function edit_mod_file() {
|
|
| 85 |
$allowed_files = array('frontend.css', 'backend.css');
|
|
| 86 |
if(isset($_GET['edit_file']) && in_array($_GET['edit_file'], $allowed_files)) {
|
|
| 87 |
return $_GET['edit_file']; |
|
| 88 |
} elseif(mod_file_exists('frontend.css')) {
|
|
| 89 |
return 'frontend.css'; |
|
| 90 |
} elseif(mod_file_exists('backend_css')) {
|
|
| 91 |
return 'backend.css'; |
|
| 92 |
} else {
|
|
| 93 |
return ''; |
|
| 94 |
} |
|
| 95 |
} |
|
| 96 |
} |
|
| 97 |
|
|
| 98 |
// this function displays a button to toggle between the optional module CSS files |
|
| 99 |
// function is invoked from edit_css.php file |
|
| 100 |
if (!function_exists('toggle_css_file')) {
|
|
| 101 |
function toggle_css_file($base_css_file = 'frontend.css') {
|
|
| 102 |
$allowed_mod_files = array('frontend.css', 'backend.css');
|
|
| 103 |
if(!in_array($base_css_file, $allowed_mod_files)) return; |
|
| 104 |
global $page_id, $section_id, $CAP_TOGGLE_CSS; |
|
| 105 |
// extract the module directory |
|
| 106 |
$mod_dir = basename(dirname(__FILE__)); |
|
| 107 |
$toggle_file = ($base_css_file == 'frontend.css') ? 'backend.css' : 'frontend.css'; |
|
| 108 |
if(mod_file_exists($toggle_file)) {
|
|
| 109 |
// display button to toggle between the two CSS files: frontend.css, backend.css |
|
| 110 |
$output = '<div class="mod_' .$mod_dir .'_edit_css"><a href="' .WB_URL .'/modules/' .$mod_dir .'/edit_css.php'; |
|
| 111 |
$output .= '?page_id=' .$page_id .'§ion_id=' .$section_id .'&edit_file=' .$toggle_file .'">'; |
|
| 112 |
$output .= $CAP_TOGGLE_CSS .$toggle_file .'</a></div>'; |
|
| 113 |
echo $output; |
|
| 114 |
} |
|
| 115 |
} |
|
| 116 |
} |
|
| 117 |
|
|
| 118 |
?> |
|
| 0 | 119 | |
| trunk/wb/modules/news/delete_post.php | ||
|---|---|---|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
// Unlink post access file |
| 49 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$get_details['link'].'.php')) {
|
|
| 50 |
unlink(WB_PATH.PAGES_DIRECTORY.$get_details['link'].'.php');
|
|
| 49 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$get_details['link'].PAGE_EXTENSION)) {
|
|
| 50 |
unlink(WB_PATH.PAGES_DIRECTORY.$get_details['link'].PAGE_EXTENSION);
|
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
// Delete post |
| 54 | 54 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id' LIMIT 1");
|
| 55 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '$post_id'");
|
|
| 55 | 56 |
|
| 56 | 57 |
// Clean up ordering |
| 57 | 58 |
require(WB_PATH.'/framework/class.order.php'); |
| 58 | 59 | |
| trunk/wb/modules/news/modify_settings.php | ||
|---|---|---|
| 28 | 28 |
// Include WB admin wrapper script |
| 29 | 29 |
require(WB_PATH.'/modules/admin.php'); |
| 30 | 30 |
|
| 31 |
// include functions to edit the optional module CSS files (frontend.css, backend.css) |
|
| 32 |
require_once('css.functions.php');
|
|
| 33 |
|
|
| 34 |
// check if module language file exists for the language set by the user (e.g. DE, EN) |
|
| 35 |
if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
|
|
| 36 |
// no module language file exists for the language set by the user, include default module language file EN.php |
|
| 37 |
require_once(WB_PATH .'/modules/news/languages/EN.php'); |
|
| 38 |
} else {
|
|
| 39 |
// a module language file exists for the language defined by the user, load it |
|
| 40 |
require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php'); |
|
| 41 |
} |
|
| 42 |
|
|
| 31 | 43 |
// Get header and footer |
| 32 | 44 |
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
|
| 33 | 45 |
$fetch_content = $query_content->fetchRow(); |
| ... | ... | |
| 36 | 48 |
$raw = array('<', '>');
|
| 37 | 49 |
$friendly = array('<', '>');
|
| 38 | 50 |
|
| 51 |
// check if backend.css file needs to be included into the <body></body> of modify.php |
|
| 52 |
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
|
|
| 53 |
echo '<style type="text/css">'; |
|
| 54 |
include(WB_PATH .'/modules/form/backend.css'); |
|
| 55 |
echo "\n</style>\n"; |
|
| 56 |
} |
|
| 57 |
|
|
| 39 | 58 |
?> |
| 59 |
<h2><?php echo $MOD_NEWS['SETTINGS']; ?></h2> |
|
| 60 |
<?php |
|
| 61 |
// include the button to edit the optionla module CSS files |
|
| 62 |
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css") |
|
| 63 |
css_edit(); |
|
| 64 |
?> |
|
| 40 | 65 |
|
| 41 |
<style type="text/css"> |
|
| 42 |
.setting_name {
|
|
| 43 |
vertical-align: top; |
|
| 44 |
} |
|
| 45 |
</style> |
|
| 46 |
|
|
| 47 | 66 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_settings.php" method="post" style="margin: 0;"> |
| 48 | 67 |
|
| 49 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
|
| 50 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
|
| 68 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
|
|
| 69 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
|
|
| 51 | 70 |
|
| 52 |
<table cellpadding="2" cellspacing="0" border="0" width="100%"> |
|
| 53 |
<tr> |
|
| 54 |
<td class="setting_name" width="100"><?php echo $TEXT['HEADER']; ?>:</td> |
|
| 55 |
<td class="setting_name"> |
|
| 56 |
<textarea name="header" style="width: 100%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea> |
|
| 57 |
</td> |
|
| 58 |
</tr> |
|
| 59 |
<tr> |
|
| 60 |
<td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td> |
|
| 61 |
<td class="setting_name"> |
|
| 62 |
<textarea name="post_loop" style="width: 100%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea> |
|
| 63 |
</td> |
|
| 64 |
</tr> |
|
| 65 |
<tr> |
|
| 66 |
<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td> |
|
| 67 |
<td class="setting_name"> |
|
| 68 |
<textarea name="footer" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea> |
|
| 69 |
</td> |
|
| 70 |
</tr> |
|
| 71 |
<tr> |
|
| 72 |
<td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td> |
|
| 73 |
<td class="setting_name"> |
|
| 74 |
<textarea name="post_header" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea> |
|
| 75 |
</td> |
|
| 76 |
</tr> |
|
| 77 |
<tr> |
|
| 78 |
<td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td> |
|
| 79 |
<td class="setting_name"> |
|
| 80 |
<textarea name="post_footer" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea> |
|
| 81 |
</td> |
|
| 82 |
</tr> |
|
| 83 |
<tr> |
|
| 84 |
<td class="setting_name"><?php echo $TEXT['POSTS_PER_PAGE']; ?>:</td> |
|
| 85 |
<td class="setting_name"> |
|
| 86 |
<select name="posts_per_page" style="width: 100%;"> |
|
| 87 |
<option value=""><?php echo $TEXT['UNLIMITED']; ?></option> |
|
| 88 |
<?php |
|
| 89 |
for($i = 1; $i <= 20; $i++) {
|
|
| 90 |
if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected'; } else { $selected = ''; }
|
|
| 91 |
echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>'; |
|
| 92 |
} |
|
| 93 |
?> |
|
| 94 |
</select> |
|
| 95 |
</td> |
|
| 96 |
</tr> |
|
| 97 |
<tr> |
|
| 98 |
<td><?php echo $TEXT['COMMENTING']; ?>:</td> |
|
| 99 |
<td> |
|
| 100 |
<select name="commenting" style="width: 100%;"> |
|
| 101 |
<option value="none"><?php echo $TEXT['DISABLED']; ?></option> |
|
| 102 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
|
| 103 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
|
|
| 104 |
</select> |
|
| 105 |
</td> |
|
| 106 |
</tr> |
|
| 107 |
<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
|
|
| 108 |
<tr> |
|
| 109 |
<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td> |
|
| 110 |
<td> |
|
| 111 |
<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($fetch_content['use_captcha'] == true) { echo ' checked'; } ?> />
|
|
| 112 |
<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label> |
|
| 113 |
<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($fetch_content['use_captcha'] == false) { echo ' checked'; } ?> />
|
|
| 114 |
<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label> |
|
| 115 |
</td> |
|
| 116 |
</tr> |
|
| 117 |
<tr> |
|
| 118 |
<td> |
|
| 119 |
<?php echo $TEXT['RESIZE_IMAGE_TO']; ?>: |
|
| 120 |
</td> |
|
| 121 |
<td> |
|
| 122 |
<select name="resize" style="width: 100%;"> |
|
| 123 |
<option value=""><?php echo $TEXT['NONE']; ?></option> |
|
| 124 |
<?php |
|
| 125 |
$SIZES['50'] = '50x50px'; |
|
| 126 |
$SIZES['75'] = '75x75px'; |
|
| 127 |
$SIZES['100'] = '100x100px'; |
|
| 128 |
$SIZES['125'] = '125x125px'; |
|
| 129 |
$SIZES['150'] = '150x150px'; |
|
| 130 |
foreach($SIZES AS $size => $size_name) {
|
|
| 131 |
if($fetch_content['resize'] == $size) { $selected = ' selected'; } else { $selected = ''; }
|
|
| 132 |
echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>'; |
|
| 133 |
} |
|
| 134 |
?> |
|
| 135 |
</select> |
|
| 136 |
</td> |
|
| 137 |
</tr> |
|
| 138 |
<?php } ?> |
|
| 139 |
<tr> |
|
| 140 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td> |
|
| 141 |
<td class="setting_name"> |
|
| 142 |
<textarea name="comments_header" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea> |
|
| 143 |
</td> |
|
| 144 |
</tr> |
|
| 145 |
<tr> |
|
| 146 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td> |
|
| 147 |
<td class="setting_name"> |
|
| 148 |
<textarea name="comments_loop" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea> |
|
| 149 |
</td> |
|
| 150 |
</tr> |
|
| 151 |
<tr> |
|
| 152 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td> |
|
| 153 |
<td class="setting_name"> |
|
| 154 |
<textarea name="comments_footer" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea> |
|
| 155 |
</td> |
|
| 156 |
</tr> |
|
| 157 |
<tr> |
|
| 158 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td> |
|
| 159 |
<td class="setting_name"> |
|
| 160 |
<textarea name="comments_page" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea> |
|
| 161 |
</td> |
|
| 162 |
</tr> |
|
| 163 |
</table> |
|
| 164 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
| 165 |
<tr> |
|
| 166 |
<td width="105"> </td> |
|
| 167 |
<td align="left"> |
|
| 168 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE'].' '.$TEXT['SETTINGS']; ?>" style="width: 200px; margin-top: 5px;"></form> |
|
| 169 |
</td> |
|
| 170 |
<td align="right"> |
|
| 171 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
| 172 |
</td> |
|
| 173 |
</tr> |
|
| 174 |
</table> |
|
| 71 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%"> |
|
| 72 |
<tr> |
|
| 73 |
<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td> |
|
| 74 |
<tr> |
|
| 75 |
<td class="setting_name" width="20%"><?php echo $TEXT['HEADER']; ?>:</td> |
|
| 76 |
<td class="setting_name"> |
|
| 77 |
<textarea name="header" style="width: 98%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea> |
|
| 78 |
</td> |
|
| 79 |
</tr> |
|
| 80 |
<tr> |
|
| 81 |
<td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td> |
|
| 82 |
<td class="setting_name"> |
|
| 83 |
<textarea name="post_loop" style="width: 98%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea> |
|
| 84 |
</td> |
|
| 85 |
</tr> |
|
| 86 |
<tr> |
|
| 87 |
<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td> |
|
| 88 |
<td class="setting_name"> |
|
| 89 |
<textarea name="footer" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea> |
|
| 90 |
</td> |
|
| 91 |
</tr> |
|
| 92 |
<tr> |
|
| 93 |
<td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td> |
|
| 94 |
<td class="setting_name"> |
|
| 95 |
<textarea name="post_header" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea> |
|
| 96 |
</td> |
|
| 97 |
</tr> |
|
| 98 |
<tr> |
|
| 99 |
<td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td> |
|
| 100 |
<td class="setting_name"> |
|
| 101 |
<textarea name="post_footer" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea> |
|
| 102 |
</td> |
|
| 103 |
</tr> |
|
| 104 |
<tr> |
|
| 105 |
<td class="setting_name"><?php echo $TEXT['POSTS_PER_PAGE']; ?>:</td> |
|
| 106 |
<td class="setting_name"> |
|
| 107 |
<select name="posts_per_page" style="width: 98%;"> |
|
| 108 |
<option value=""><?php echo $TEXT['UNLIMITED']; ?></option> |
|
| 109 |
<?php |
|
| 110 |
for($i = 1; $i <= 20; $i++) {
|
|
| 111 |
if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected'; } else { $selected = ''; }
|
|
| 112 |
echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>'; |
|
| 113 |
} |
|
| 114 |
?> |
|
| 115 |
</select> |
|
| 116 |
</td> |
|
| 117 |
</tr> |
|
| 118 |
</table> |
|
| 119 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;"> |
|
| 120 |
<tr> |
|
| 121 |
<td colspan="2"><strong><?php echo $TEXT['COMMENTS']; ?></strong></td> |
|
| 122 |
</tr> |
|
| 123 |
<tr> |
|
| 124 |
<td width="20%"><?php echo $TEXT['COMMENTING']; ?>:</td> |
|
| 125 |
<td> |
|
| 126 |
<select name="commenting" style="width: 98%;"> |
|
| 127 |
<option value="none"><?php echo $TEXT['DISABLED']; ?></option> |
|
| 128 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
|
| 129 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
|
|
| 130 |
</select> |
|
| 131 |
</td> |
|
| 132 |
</tr> |
|
| 133 |
<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
|
|
| 134 |
<tr> |
|
| 135 |
<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td> |
|
| 136 |
<td> |
|
| 137 |
<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($fetch_content['use_captcha'] == true) { echo ' checked'; } ?> />
|
|
| 138 |
<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label> |
|
| 139 |
<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($fetch_content['use_captcha'] == false) { echo ' checked'; } ?> />
|
|
| 140 |
<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label> |
|
| 141 |
</td> |
|
| 142 |
</tr> |
|
| 143 |
<tr> |
|
| 144 |
<td> |
|
| 145 |
<?php echo $TEXT['RESIZE_IMAGE_TO']; ?>: |
|
| 146 |
</td> |
|
| 147 |
<td> |
|
| 148 |
<select name="resize" style="width: 98%;"> |
|
| 149 |
<option value=""><?php echo $TEXT['NONE']; ?></option> |
|
| 150 |
<?php |
|
| 151 |
$SIZES['50'] = '50x50px'; |
|
| 152 |
$SIZES['75'] = '75x75px'; |
|
| 153 |
$SIZES['100'] = '100x100px'; |
|
| 154 |
$SIZES['125'] = '125x125px'; |
|
| 155 |
$SIZES['150'] = '150x150px'; |
|
| 156 |
foreach($SIZES AS $size => $size_name) {
|
|
| 157 |
if($fetch_content['resize'] == $size) { $selected = ' selected'; } else { $selected = ''; }
|
|
| 158 |
echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>'; |
|
| 159 |
} |
|
| 160 |
?> |
|
| 161 |
</select> |
|
| 162 |
</td> |
|
| 163 |
</tr> |
|
| 164 |
<?php } ?> |
|
| 165 |
<tr> |
|
| 166 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td> |
|
| 167 |
<td class="setting_name"> |
|
| 168 |
<textarea name="comments_header" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea> |
|
| 169 |
</td> |
|
| 170 |
</tr> |
|
| 171 |
<tr> |
|
| 172 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td> |
|
| 173 |
<td class="setting_name"> |
|
| 174 |
<textarea name="comments_loop" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea> |
|
| 175 |
</td> |
|
| 176 |
</tr> |
|
| 177 |
<tr> |
|
| 178 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td> |
|
| 179 |
<td class="setting_name"> |
|
| 180 |
<textarea name="comments_footer" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea> |
|
| 181 |
</td> |
|
| 182 |
</tr> |
|
| 183 |
<tr> |
|
| 184 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td> |
|
| 185 |
<td class="setting_name"> |
|
| 186 |
<textarea name="comments_page" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea> |
|
| 187 |
</td> |
|
| 188 |
</tr> |
|
| 189 |
</table> |
|
| 190 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
| 191 |
<tr> |
|
| 192 |
<td align="left"> |
|
| 193 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form> |
|
| 194 |
</td> |
|
| 195 |
<td align="right"> |
|
| 196 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
| 197 |
</td> |
|
| 198 |
</tr> |
|
| 199 |
</table> |
|
| 175 | 200 |
|
| 176 | 201 |
|
| 177 | 202 |
<?php |
| 178 | 203 | |
| trunk/wb/modules/news/modify_comment.php | ||
|---|---|---|
| 42 | 42 |
|
| 43 | 43 |
?> |
| 44 | 44 |
|
| 45 |
<h2><?php echo $TEXT['MODIFY'].' '.$TEXT['COMMENT']; ?></h2> |
|
| 46 |
|
|
| 45 | 47 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_comment.php" method="post" style="margin: 0;"> |
| 46 | 48 |
|
| 47 | 49 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
| ... | ... | |
| 49 | 51 |
<input type="hidden" name="post_id" value="<?php echo $fetch_content['post_id']; ?>"> |
| 50 | 52 |
<input type="hidden" name="comment_id" value="<?php echo $comment_id; ?>"> |
| 51 | 53 |
|
| 52 |
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
|
| 54 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
|
| 53 | 55 |
<tr> |
| 54 | 56 |
<td width="80"><?php echo $TEXT['TITLE']; ?>:</td> |
| 55 | 57 |
<td> |
| 56 |
<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 100%;" maxlength="255" />
|
|
| 58 |
<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
|
|
| 57 | 59 |
</td> |
| 58 | 60 |
</tr> |
| 59 | 61 |
<tr> |
| 60 | 62 |
<td valign="top"><?php echo $TEXT['COMMENT']; ?>:</td> |
| 61 | 63 |
<td> |
| 62 |
<textarea name="comment" style="width: 100%; height: 150px;"><?php echo (htmlspecialchars($fetch_content['comment'])); ?></textarea>
|
|
| 64 |
<textarea name="comment" style="width: 98%; height: 150px;"><?php echo (htmlspecialchars($fetch_content['comment'])); ?></textarea>
|
|
| 63 | 65 |
</td> |
| 64 | 66 |
</tr> |
| 65 | 67 |
</table> |
| 66 | 68 |
|
| 67 |
<br /> |
|
| 68 |
|
|
| 69 | 69 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
| 70 | 70 |
<tr> |
| 71 | 71 |
<td align="left"> |
| 72 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 200px; margin-top: 5px;"></form>
|
|
| 72 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
|
|
| 73 | 73 |
</td> |
| 74 | 74 |
<td align="right"> |
| 75 | 75 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&post_id=<?php echo $fetch_content['post_id']; ?>';" style="width: 100px; margin-top: 5px;" /> |
| 76 | 76 | |
| trunk/wb/modules/news/view.php | ||
|---|---|---|
| 26 | 26 |
// Must include code to stop this file being access directly |
| 27 | 27 |
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
|
| 28 | 28 |
|
| 29 |
// check if frontend.css file needs to be included into the <body></body> of view.php |
|
| 30 |
if((!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) {
|
|
| 31 |
echo '<style type="text/css">'; |
|
| 32 |
include(WB_PATH .'/modules/news/frontend.css'); |
|
| 33 |
echo "\n</style>\n"; |
|
| 34 |
} |
|
| 35 |
|
|
| 29 | 36 |
// Check if there is a start point defined |
| 30 | 37 |
if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0) {
|
| 31 | 38 |
$position = $_GET['p']; |
| ... | ... | |
| 71 | 78 |
// Check if we should only list posts from a certain group |
| 72 | 79 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
|
| 73 | 80 |
$query_extra = " AND group_id = '".$_GET['g']."'"; |
| 74 |
?> |
|
| 75 |
<style type="text/css">.selected_group_title { font-size: 14px; text-align: center; }</style>
|
|
| 76 |
<?php |
|
| 77 | 81 |
} else {
|
| 78 | 82 |
$query_extra = ''; |
| 79 | 83 |
} |
| ... | ... | |
| 169 | 173 |
// Workout date and time of last modified post |
| 170 | 174 |
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE); |
| 171 | 175 |
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE); |
| 176 |
$publ_date = date(DATE_FORMAT,$post['published_when']); |
|
| 172 | 177 |
// Work-out the post link |
| 173 | 178 |
$post_link = page_link($post['link']); |
| 174 | 179 |
if(isset($_GET['p']) AND $position > 0) {
|
| ... | ... | |
| 189 | 194 |
$wb->preprocess($short); |
| 190 | 195 |
// Replace vars with values |
| 191 | 196 |
$post_long_len = strlen($post['content_long']); |
| 192 |
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[DATE]', '[TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]');
|
|
| 197 |
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[MODI_DATE]', '[MODI_TIME]', '[PUBLISHED_DATE]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]');
|
|
| 193 | 198 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
|
| 194 | 199 |
if($post_long_len < 9) {
|
| 195 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], ''); |
|
| 200 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '');
|
|
| 196 | 201 |
} else {
|
| 197 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']); |
|
| 202 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']);
|
|
| 198 | 203 |
} |
| 199 | 204 |
} else {
|
| 200 | 205 |
if($post_long_len < 9) {
|
| 201 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, '', '', '', '', ''); |
|
| 206 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, '', '', '', '', '');
|
|
| 202 | 207 |
} else {
|
| 203 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, '', '', '', '', $TEXT['READ_MORE']); |
|
| 208 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $publ_date, '', '', '', '', $TEXT['READ_MORE']);
|
|
| 204 | 209 |
} |
| 205 | 210 |
} |
| 206 | 211 |
echo str_replace($vars, $values, $setting_post_loop); |
| ... | ... | |
| 259 | 264 |
// Workout date and time of last modified post |
| 260 | 265 |
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE); |
| 261 | 266 |
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE); |
| 267 |
$publ_date = date(DATE_FORMAT,$post['published_when']); |
|
| 262 | 268 |
// Get group id, title, and image |
| 263 | 269 |
$group_id = $post['group_id']; |
| 264 | 270 |
$group_title = $groups[$group_id]['title']; |
| 265 | 271 |
$group_image = $groups[$group_id]['image']; |
| 266 | 272 |
if($group_image == '') { $display_image = 'none'; } else { $display_image = ''; }
|
| 267 | 273 |
if($group_id == 0) { $display_group = 'none'; } else { $display_group = ''; }
|
| 268 |
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[DATE]', '[TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
|
|
| 274 |
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[MODI_DATE]', '[MODI_TIME]', '[PUBL_DATE]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]');
|
|
| 269 | 275 |
$post_short=$post['content_short']; |
| 270 | 276 |
$wb->preprocess($post_short); |
| 271 | 277 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
|
| 272 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']); |
|
| 278 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $post_date, $post_time, $publ_date, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']);
|
|
| 273 | 279 |
} else {
|
| 274 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $post_date, $post_time, '', '', '', ''); |
|
| 280 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $post_short, $page_link, $post_date, $post_time, $publ_date, '', '', '', '');
|
|
| 275 | 281 |
} |
| 276 | 282 |
$post_long = ($post['content_long']); |
| 277 | 283 |
} |
| 278 | 284 |
} else {
|
| 279 |
header('Location: '.WB_URL.'/pages/');
|
|
| 285 |
header("Location: ".WB_URL.PAGES_DIRECTORY."");
|
|
| 280 | 286 |
exit(0); |
| 281 | 287 |
} |
| 282 | 288 |
|
| 283 | 289 | |
| trunk/wb/modules/news/frontend.css | ||
|---|---|---|
| 1 |
.post_title, .post_date {
|
|
| 2 |
border-bottom: 1px solid #DDDDDD; |
|
| 3 |
} |
|
| 4 |
|
|
| 5 |
.post_title {
|
|
| 6 |
font-weight: bold; |
|
| 7 |
font-size: 12px; |
|
| 8 |
color: #000000; |
|
| 9 |
} |
|
| 10 |
|
|
| 11 |
.post_date {
|
|
| 12 |
text-align: right; |
|
| 13 |
font-weight: bold; |
|
| 14 |
} |
|
| 15 |
|
|
| 16 |
.post_short {
|
|
| 17 |
text-align: justify; |
|
| 18 |
padding-bottom: 5px; |
|
| 19 |
} |
|
| 20 |
|
|
| 21 |
.comment_title {
|
|
| 22 |
font-weight: bold; |
|
| 23 |
} |
|
| 24 |
|
|
| 25 |
.comment_text {
|
|
| 26 |
font-weight: bold; |
|
| 27 |
background-color: #FDFDFD; |
|
| 28 |
border-bottom: 1px solid #DDDDDD; |
|
| 29 |
padding-bottom: 15px; |
|
| 30 |
} |
|
| 31 |
|
|
| 32 |
.comment_title, .comment_text {
|
|
| 33 |
border-left: 1px solid #DDDDDD; |
|
| 34 |
} |
|
| 35 |
|
|
| 36 |
.comment_info {
|
|
| 37 |
text-align: right; |
|
| 38 |
border-right: 1px solid #DDDDDD; |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
.comment_title, .comment_info {
|
|
| 42 |
border-top: 1px solid #DDDDDD; |
|
| 43 |
background-color: #EEEEEE; |
|
| 44 |
} |
|
| 45 |
|
|
| 46 |
.selected_group_title {
|
|
| 47 |
font-size: 14px; |
|
| 48 |
text-align: center; |
|
| 49 |
} |
|
| 0 | 50 | |
| trunk/wb/modules/news/add.php | ||
|---|---|---|
| 26 | 26 |
// Must include code to stop this file being access directly |
| 27 | 27 |
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
|
| 28 | 28 |
|
| 29 |
$header = '<style type=\"text/css\"> |
|
| 30 |
.post_title, .post_date { border-bottom: 1px solid #DDDDDD; }
|
|
| 31 |
.post_title { font-weight: bold; font-size: 12px; color: #000000; }
|
|
| 32 |
.post_date { text-align: right; font-weight: bold; }
|
|
| 33 |
.post_short { text-align: justify; padding-bottom: 5px; }
|
|
| 34 |
</style> |
|
| 35 |
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"98%\">'; |
|
| 29 |
$header = '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"98%\">'; |
|
| 36 | 30 |
$post_loop = '<tr class=\"post_top\"> |
| 37 | 31 |
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td> |
| 38 |
<td class=\"post_date\">[TIME], [DATE]</td>
|
|
| 32 |
<td class=\"post_date\">[MODI_TIME], [MODI_DATE]</td>
|
|
| 39 | 33 |
</tr> |
| 40 | 34 |
<tr> |
| 41 | 35 |
<td class=\"post_short\" colspan=\"2\"> |
| ... | ... | |
| 57 | 51 |
<td rowspan="3" style="display: [DISPLAY_IMAGE]"><img src="[GROUP_IMAGE]" alt="[GROUP_TITLE]" /></td> |
| 58 | 52 |
</tr> |
| 59 | 53 |
<tr> |
| 60 |
<td valign="top"><b>Posted by [DISPLAY_NAME] ([USERNAME]) on [DATE] at [TIME]</b></td>
|
|
| 54 |
<td valign="top"><b>Posted by [DISPLAY_NAME] ([USERNAME]) on [PUBL_DATE]</b></td>
|
|
| 61 | 55 |
</tr> |
| 62 | 56 |
<tr style="display: [DISPLAY_GROUP]"> |
| 63 | 57 |
<td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td> |
| 64 | 58 |
</tr> |
| 65 | 59 |
</table> |
| 66 | 60 |
<p style="text-align: justify;">'); |
| 67 |
$post_footer = '</p> |
|
| 61 |
$post_footer = '</p><p>Last changed: [MODI_DATE] at [MODI_TIME]</p>
|
|
| 68 | 62 |
<a href=\"[BACK]\">Back</a>'; |
| 69 | 63 |
$comments_header = addslashes('<br /><br />
|
| 70 |
<style type="text/css"> |
|
| 71 |
.comment_title { font-weight: bold; }
|
|
| 72 |
.comment_text { font-weight: bold; background-color: #FDFDFD; border-bottom: 1px solid #DDDDDD; padding-bottom: 15px; }
|
|
| 73 |
.comment_title, .comment_text { border-left: 1px solid #DDDDDD; }
|
|
| 74 |
.comment_info { text-align: right; border-right: 1px solid #DDDDDD; }
|
|
| 75 |
.comment_title, .comment_info { border-top: 1px solid #DDDDDD; background-color: #EEEEEE; }
|
|
| 76 |
</style> |
|
| 77 | 64 |
<h2>Comments</h2> |
| 78 | 65 |
<table cellpadding="2" cellspacing="0" border="0" width="98%">'); |
| 79 | 66 |
$comments_loop = addslashes('<tr>
|
| 80 | 67 | |
| trunk/wb/modules/news/backend.css | ||
|---|---|---|
| 1 |
.setting_name {
|
|
| 2 |
vertical-align: top; |
|
| 3 |
} |
|
| 4 |
|
|
| 5 |
div.mod_news_edit_css {
|
|
| 6 |
width: 100%; |
|
| 7 |
margin-top: -20px; |
|
| 8 |
margin-bottom: 15px; |
|
| 9 |
text-align: right; |
|
| 10 |
} |
|
| 11 |
|
|
| 12 |
div.mod_news_edit_css a {
|
|
| 13 |
width: 100px; |
|
| 14 |
padding: 5px; |
|
| 15 |
border: 1px solid; |
|
| 16 |
background-color: #F0F0F0; |
|
| 17 |
} |
|
| 0 | 18 | |
| trunk/wb/modules/news/modify_post.php | ||
|---|---|---|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
?> |
| 53 |
<script type="text/javascript" src="calendar/calendarDateInput.js"></script> |
|
| 54 |
|
|
| 55 |
<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['POST']; ?></h2> |
|
| 56 |
|
|
| 53 | 57 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;"> |
| 54 | 58 |
|
| 55 | 59 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
| ... | ... | |
| 57 | 61 |
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>"> |
| 58 | 62 |
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>"> |
| 59 | 63 |
|
| 60 |
<table cellpadding="4" cellspacing="0" border="0" width="100%">
|
|
| 64 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
|
| 61 | 65 |
<tr> |
| 62 |
<td width="80"><?php echo $TEXT['TITLE']; ?>:</td>
|
|
| 63 |
<td width="100%">
|
|
| 64 |
<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 100%;" maxlength="255" />
|
|
| 66 |
<td><?php echo $TEXT['TITLE']; ?>:</td> |
|
| 67 |
<td width="80%">
|
|
| 68 |
<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
|
|
| 65 | 69 |
</td> |
| 66 | 70 |
</tr> |
| 67 | 71 |
<tr> |
| ... | ... | |
| 108 | 112 |
</td> |
| 109 | 113 |
</tr> |
| 110 | 114 |
<tr> |
| 115 |
<td><?php echo $TEXT['DATE']; ?>:</td> |
|
| 116 |
<td><script>DateInput('publishdate', true, 'YYYY-MM-DD'<?php if($fetch_content['published_when'] != 0) { echo ",'" . date("Y-m-d",$fetch_content['published_when']) . "'"; } ?>)</script></td>
|
|
| 117 |
</tr> |
|
| 118 |
</table> |
|
| 119 |
|
|
| 120 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%"> |
|
| 121 |
<tr> |
|
| 111 | 122 |
<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td> |
| 123 |
</tr> |
|
| 124 |
<tr> |
|
| 112 | 125 |
<td> |
| 113 | 126 |
<?php |
| 114 | 127 |
show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","135px");
|
| ... | ... | |
| 117 | 130 |
</tr> |
| 118 | 131 |
<tr> |
| 119 | 132 |
<td valign="top"><?php echo $TEXT['LONG']; ?>:</td> |
| 133 |
</tr> |
|
| 134 |
<tr> |
|
| 120 | 135 |
<td> |
| 121 | 136 |
<?php |
| 122 | 137 |
show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","300px");
|
| ... | ... | |
| 125 | 140 |
</tr> |
| 126 | 141 |
</table> |
| 127 | 142 |
|
| 128 |
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
|
| 143 |
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
|
| 129 | 144 |
<tr> |
| 130 |
<td width="90"> |
|
| 131 |
|
|
| 132 |
</td> |
|
| 133 | 145 |
<td align="left"> |
| 134 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 200px; margin-top: 5px;"></form>
|
|
| 146 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
|
|
| 135 | 147 |
</td> |
| 136 | 148 |
<td align="right"> |
| 137 | 149 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
| 138 | 150 | |
| trunk/wb/modules/news/comment_page.php | ||
|---|---|---|
| 32 | 32 |
// Get comments page template details from db |
| 33 | 33 |
$query_settings = $database->query("SELECT comments_page,use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
|
| 34 | 34 |
if($query_settings->numRows() == 0) {
|
| 35 |
header('Location: '.WB_URL.'/pages/');
|
|
| 35 |
header("Location: ".WB_URL.PAGES_DIRECTORY."");
|
|
| 36 | 36 |
exit(0); |
| 37 | 37 |
} else {
|
| 38 | 38 |
$settings = $query_settings->fetchRow(); |
| 39 | 39 | |
| trunk/wb/modules/news/comment.php | ||
|---|---|---|
| 29 | 29 |
// Check if there is a post id |
| 30 | 30 |
if(!isset($_GET['id']) OR !is_numeric($_GET['id'])) {
|
| 31 | 31 |
if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) {
|
| 32 |
header('Location: '.WB_URL.'/pages/');
|
|
| 32 |
header("Location: ".WB_URL.PAGES_DIRECTORY."");
|
|
| 33 | 33 |
exit(0); |
| 34 | 34 |
} else {
|
| 35 | 35 |
$post_id = $_POST['post_id']; |
| ... | ... | |
| 54 | 54 |
// Query post for page id |
| 55 | 55 |
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
|
| 56 | 56 |
if($query_post->numRows() == 0) {
|
| 57 |
header('Location: '.WB_URL.'/pages/');
|
|
| 57 |
header("Location: ".WB_URL.PAGES_DIRECTORY."");
|
|
| 58 | 58 |
exit(0); |
| 59 | 59 |
} else {
|
| 60 | 60 |
$fetch_post = $query_post->fetchRow(); |
| ... | ... | |
| 68 | 68 |
// Get page details |
| 69 | 69 |
$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
|
| 70 | 70 |
if($query_page->numRows() == 0) {
|
| 71 |
header('Location: '.WB_URL.'/pages/');
|
|
| 71 |
header("Location: ".WB_URL.PAGES_DIRECTORY."");
|
|
| 72 | 72 |
exit(0); |
| 73 | 73 |
} else {
|
| 74 | 74 |
$page = $query_page->fetchRow(); |
| 75 | 75 | |
| trunk/wb/modules/news/delete.php | ||
|---|---|---|
| 26 | 26 |
// Must include code to stop this file being access directly |
| 27 | 27 |
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
|
| 28 | 28 |
|
| 29 |
//get and remove all php files created for the news section |
|
| 30 |
$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'");
|
|
| 31 |
if($query_details->numRows() > 0) {
|
|
| 32 |
while($link = $query_details->fetchRow()) {
|
|
| 33 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) {
|
|
| 34 |
unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION); |
|
| 35 |
} |
|
| 36 |
} |
|
| 37 |
} |
|
| 38 |
//check to see if any other sections are part of the news page, if only 1 news is there delete it |
|
| 39 |
$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id'");
|
|
| 40 |
if($query_details->numRows() == 1) {
|
|
| 41 |
$query_details2 = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
|
|
| 42 |
$link = $query_details2->fetchRow(); |
|
| 43 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) {
|
|
| 44 |
unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION); |
|
| 45 |
} |
|
| 46 |
} |
|
| 47 |
|
|
| 29 | 48 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'");
|
| 30 | 49 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id'");
|
| 31 | 50 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE section_id = '$section_id'");
|
| 32 | 51 | |
| trunk/wb/modules/news/save_post.php | ||
|---|---|---|
| 45 | 45 |
$title = $admin->add_slashes($admin->get_post('title'));
|
| 46 | 46 |
$short = $admin->add_slashes($admin->get_post('short'));
|
| 47 | 47 |
$long = $admin->add_slashes($admin->get_post('long'));
|
| 48 |
$publishedwhen = strtotime($admin->get_post('publishdate'));
|
|
| 48 | 49 |
$commenting = $admin->get_post('commenting');
|
| 49 | 50 |
$active = $admin->get_post('active');
|
| 50 | 51 |
$old_link = $admin->get_post('link');
|
| ... | ... | |
| 68 | 69 |
make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/'); |
| 69 | 70 |
if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/posts/')) {
|
| 70 | 71 |
$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']); |
| 71 |
} elseif($old_link != $post_link OR !file_exists(WB_PATH.PAGES_DIRECTORY.$post_link.'.php')) {
|
|
| 72 |
} elseif($old_link != $post_link OR !file_exists(WB_PATH.PAGES_DIRECTORY.$post_link.PAGE_EXTENSION)) {
|
|
| 72 | 73 |
// We need to create a new file |
| 73 | 74 |
// First, delete old file if it exists |
| 74 |
if(file_exists(WB_PATH.$old_link.'.php')) {
|
|
| 75 |
unlink(WB_PATH.$old_link.'.php');
|
|
| 75 |
if(file_exists(WB_PATH.$old_link.PAGE_EXTENSION)) {
|
|
| 76 |
unlink(WB_PATH.$old_link.PAGE_EXTENSION);
|
|
| 76 | 77 |
} |
| 77 | 78 |
// Specify the filename |
| 78 |
$filename = WB_PATH.PAGES_DIRECTORY.'/'.$post_link.'.php';
|
|
| 79 |
$filename = WB_PATH.PAGES_DIRECTORY.'/'.$post_link.PAGE_EXTENSION;
|
|
| 79 | 80 |
// The depth of the page directory in the directory hierarchy |
| 80 | 81 |
// '/pages' is at depth 1 |
| 81 | 82 |
$pages_dir_depth=count(explode('/',PAGES_DIRECTORY))-1;
|
| ... | ... | |
| 101 | 102 |
} |
| 102 | 103 |
|
| 103 | 104 |
// Update row |
| 104 |
$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', posted_when = '".mktime()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'");
|
|
| 105 |
$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', published_when = '$publishedwhen', posted_when = '".mktime()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'");
|
|
| 105 | 106 |
|
| 106 | 107 |
// Check if there is a db error, otherwise say successful |
| 107 | 108 |
if($database->is_error()) {
|
| 108 | 109 | |
| trunk/wb/modules/news/modify_group.php | ||
|---|---|---|
| 42 | 42 |
|
| 43 | 43 |
?> |
| 44 | 44 |
|
| 45 |
<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['GROUP']; ?></h2> |
|
Also available in: Unified diff
Updated news modul with features from the advanced news modul