Project

General

Profile

« Previous | Next » 

Revision 1918

Added by Dietmar over 11 years ago

! /modules/news/ beginning beginning recoding
replacing absolute MediaUrl with place holder

View differences:

branches/2.8.x/CHANGELOG
12 12
===============================================================================
13 13

  
14 14

  
15
07 Jun-2013 Build 1918 Dietmar Woellbrink (Luisehahne)
16
! /modules/news/ beginning beginning recoding
17
  replacing absolute MediaUrl with place holder
15 18
07 Jun-2013 Build 1917 Dietmar Woellbrink (Luisehahne)
16 19
! /modules/show_menu2/  set to version 4.9.7
17 20
  DEBUG == true show query counts
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1917');
54
if(!defined('REVISION')) define('REVISION', '1918');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/news/add_post.php
4 4
 * @category        modules
5 5
 * @package         news
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
......
25 25
// Get new order
26 26
$order = new order(TABLE_PREFIX.'mod_news_posts', 'position', 'post_id', 'section_id');
27 27
$position = $order->get_new($section_id);
28
$post_id = 0;
28 29

  
30
try {
29 31
// Get default commenting
30
$query_settings = $database->query("SELECT commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
31
$fetch_settings = $query_settings->fetchRow();
32
$commenting = $fetch_settings['commenting'];
33

  
32
	$sql = 'SELECT `commenting` FROM `'.TABLE_PREFIX.'mod_news_settings` '
33
	     . 'WHERE `section_id`='.(int)$section_id;
34
	$query_settings = $database->query($sql);
35
	$fetch_settings = $query_settings->fetchRow(MYSQL_ASSOC);
36
	$commenting = $fetch_settings['commenting'];
34 37
// Insert new row into database
35
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id,position,commenting,active) VALUES ('$section_id','$page_id','$position','$commenting','1')");
36

  
37
// Get the id
38
$post_id = $admin->getIDKEY($database->get_one("SELECT LAST_INSERT_ID()"));
39

  
40
// Say that a new record has been added, then redirect to modify page
41
if($database->is_error()) {
42
	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
43
} else {
44
	$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id);
38
	$sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_news_posts` '
39
	     . 'SET `section_id`='.$section_id.', '
40
	     .     '`page_id`='.$page_id.', '
41
	     .     '`position`='.$position.', '
42
	     .     '`commenting`=\''.$commenting.'\', '
43
	     .     '`created_when`='.time().', '
44
	     .     '`created_by`='.(int)$admin->get_user_id().', '
45
	     .     '`posted_when`='.time().', '
46
	     .     '`posted_by`='.(int)$admin->get_user_id().', '
47
	     .     '`active`=1';
48
	$database->query($sql);
49
	$post_id = $admin->getIDKEY($database->LastInsertId);
50
} catch(WbDatabaseException $e) {
51
	$sSectionIdPrefix = ( defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? SEC_ANCHOR : 'Sec' );
52
	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'#'.$sSectionIdPrefix.$section_id );
45 53
}
46

  
47
// Print admin footer
54
$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'&section_id='.$section_id.'&post_id='.$post_id );
48 55
$admin->print_footer();
branches/2.8.x/wb/modules/news/view.php
23 23
}
24 24
/* -------------------------------------------------------- */
25 25
global $post_id, $post_section,$TEXT,$MESSAGE;
26
$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
26 27

  
27 28
// load module language file
28 29
$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
......
54 55
$groups[0]['image'] = '';
55 56

  
56 57
$query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
57
if($query_users->numRows() > 0)
58
{
58
if($query_users->numRows() > 0){
59 59

  
60 60
	while( false != ($group = $query_users->fetchRow()) )
61 61
	{
......
73 73

  
74 74
// Check if we should show the main page or a post itself
75 75
// if(!defined('POST_ID') OR !is_numeric(POST_ID))
76
if(!isset($post_id) || !is_numeric($post_id))
77
{
76
if(!isset($post_id) || !is_numeric($post_id)){
78 77

  
79 78
	// Check if we should only list posts from a certain group
80 79
	if(isset($_GET['g']) AND is_numeric($_GET['g'])) {
......
192 191
			</div>
193 192
			<?php
194 193
		}
195
		while( false != ($post = $query_posts->fetchRow()) )
194
		while( false != ($post = $query_posts->fetchRow(MYSQL_ASSOC)) )
196 195
		{
197 196
			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false)
198 197
			{ // Make sure parent group is active
......
224 223
					$post_link .= 'g='.$_GET['g'];
225 224
					}
226 225
				}
227

  
228 226
				// Get group id, title, and image
229 227
				$group_id = $post['group_id'];
230 228
				$group_title = $groups[$group_id]['title'];
......
266 264

  
267 265
}
268 266
//elseif(defined('POST_ID') AND is_numeric(POST_ID))
269
elseif(isset($post_id) && is_numeric($post_id))
270
{
267
elseif(isset($post_id) && is_numeric($post_id)){
271 268
// print '<h2>'.POST_ID.'/'.PAGE_ID.'/'.POST_SECTION.'</h2>';
272 269
//  if(defined('POST_SECTION') AND POST_SECTION == $section_id)
273
	if(isset($post_section) && ($post_section == $section_id))
274
	{
270
	if(isset($post_section) && ($post_section == $section_id)){
275 271
		// Get settings
276 272
		$setting_post_header = $setting_post_footer = $setting_comments_header
277 273
		                     = $setting_comments_loop = $setting_comments_footer = '';
......
301 297
			exit($MESSAGE['PAGES_NOT_FOUND']);
302 298
		}
303 299

  
304
		// Get post info
300
// Get post info
305 301
		$t = time();
306 302
		$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
307 303
			WHERE post_id = '".$post_id."' AND active = '1'
......
332 328
				$post_link_path = str_replace(WB_URL, WB_PATH,$post_link);
333 329
				$create_date = date(DATE_FORMAT, $post['created_when']+TIMEZONE);
334 330
				$create_time = date(TIME_FORMAT, $post['created_when']+TIMEZONE);
335
				// Get group id, title, and image
331
// Get group id, title, and image
336 332
				$group_id = $post['group_id'];
337 333
				$group_title = $groups[$group_id]['title'];
338 334
				$group_image = $groups[$group_id]['image'];
......
372 368
			$values = array(WB_URL.'/modules/news/comment.php?post_id='.$post_id.'&amp;section_id='.$section_id, $MOD_NEWS['TEXT_COMMENTS']);
373 369
			print str_replace($vars, $values, $setting_comments_header);
374 370

  
375
			// Query for comments
371
// Query for comments
376 372
			$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".$post_id."' ORDER BY commented_when ASC");
377 373
			if($query_comments->numRows() > 0)
378 374
			{
branches/2.8.x/wb/modules/news/upgrade.php
20 20
 * upgrade.php
21 21
 * 
22 22
 * @category     Module
23
 * @package      Module_news
23
 * @package      news
24 24
 * @subpackage   upgrade
25 25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websitebaker.org>
26 26
 * @author       Werner v.d.Decken <wkl@isteam.de>
......
92 92

  
93 93
			$sPagesPath = WB_PATH.PAGES_DIRECTORY;
94 94
			$sPostsPath = $sPagesPath.'/posts';
95
	// create /posts/ - directory if not exists
95
// create /posts/ - directory if not exists
96 96
			if(is_writable($sPagesPath)) {
97 97
				if(!($bRetval = is_dir($sPostsPath))) {
98 98
					$iOldUmask = umask(0) ;
......
133 133
				$msg[] = 'TABLE `'.$database->TablePrefix.'mod_news_posts` Datafield `created_by` already exists.'." $OK";
134 134
				$doImportDate = false; 
135 135
			}
136
 	// preset new fields `created_by` and `created_by` from existing values
136
// preset new fields `created_by` and `created_by` from existing values
137 137
			if($doImportDate) {
138 138
				$sql  = 'UPDATE `'.$database->TablePrefix.'mod_news_posts` ';
139 139
				$sql .= 'SET `created_by`=`posted_by`, `created_when`=`posted_when`';
140 140
				$database->query($sql);
141 141
			}
142

  
142
	if($doImportDate) {
143 143
	/**
144 144
	 * rebuild news post folder
145 145
	 */
......
176 176
			if($count > 0) {
177 177
				$msg[] = 'Save date of creation from '.$count.' old accessfiles and delete these files.'." $OK";
178 178
			}
179
	}
179 180
// ************************************************
180
		// Check the validity of 'create-file-timestamp' and balance against 'posted-timestamp'
181
// Check the validity of 'create-file-timestamp' and balance against 'posted-timestamp'
181 182
			$sql  = 'UPDATE `'.$database->TablePrefix.'mod_news_posts` ';
182 183
			$sql .= 'SET `created_when`=`published_when` ';
183 184
			$sql .= 'WHERE `published_when`<`created_when`';
branches/2.8.x/wb/modules/news/add.php
4 4
 * @category        modules
5 5
 * @package         news
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
17 17

  
18
// Must include code to stop this file being access directly
19
/* -------------------------------------------------------- */
20
if(defined('WB_PATH') == false)
21
{
22
	// Stop this file being access directly
23
		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
18
if(!defined('WB_PATH')) {
19
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
20
	throw new IllegalFileException();
24 21
}
25
/* -------------------------------------------------------- */
26 22

  
27
$header = '<table class=\"loop-header\">'."\n";
28
$post_loop = '<tr class=\"post-top\">
29
<td class=\"post-title\"><a href=\"[LINK]\">[TITLE]</a></td>
30
<td class=\"post-date\">[PUBLISHED_DATE], [PUBLISHED_TIME]</td>
31
</tr>
32
<tr>
33
<td class=\"post-short\" colspan=\"2\">
34
[SHORT]
35
<span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>
36
</td>
37
</tr>';
38
$footer = '</table>
39
<table class="page-header" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
40
<tr>
41
<td class="page-left">[PREVIOUS_PAGE_LINK]</td>
42
<td class="page-center">[OF]</td>
43
<td class="page-right">[NEXT_PAGE_LINK]</td>
44
</tr>
45
</table>';
46
$post_header = addslashes('<table cellpadding="0" cellspacing="0" class="post-header">
47
<tr>
48
<td><h1>[TITLE]</h1></td>
49
<td rowspan="3" style="display: [DISPLAY_IMAGE]">[GROUP_IMAGE]</td>
50
</tr>
51
<tr>
52
<td class="public-info"><b>[TEXT_POSTED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [PUBLISHED_DATE]</b></td>
53
</tr>
54
<tr style="display: [DISPLAY_GROUP]">
55
<td class="group-page"><a href="[BACK]">[PAGE_TITLE]</a> &gt;&gt; <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
56
</tr>
57
</table>');
58
$post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>
59
<a href=\"[BACK]\">[TEXT_BACK]</a>';
60
$comments_header = addslashes('<br /><br />
61
<h2>[TEXT_COMMENTS]</h2>
62
<table class="comment-header">');
63
$comments_loop = addslashes('<tr>
64
<td class="comment_title">[TITLE]</td>
65
<td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>
66
</tr>
67
<tr>
68
<td colspan="2" class="comment-text">[COMMENT]</td>
69
</tr>');
70
$comments_footer = '</table>
71
<br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';
72
$comments_page = '<h1>[TEXT_COMMENT]</h1>
73
<h2>[POST_TITLE]</h2>
74
<br />';
23
	$header      = '<table class="loop-header"'.PHP_EOL
24
	             . '  <tbody>'.PHP_EOL;
25
	$post_loop   = '    <tr class="post-top">'.PHP_EOL
26
	             . '      <td class="post-title"><a href="[LINK]">[TITLE]</a></td>'.PHP_EOL
27
	             . '      <td class=\"post-date\">[CREATED_DATE], [CREATED_TIME]</td>'.PHP_EOL
28
	             . '    </tr>'.PHP_EOL
29
	             . '    <tr>'.PHP_EOL
30
	             . '      <td class="post-short" colspan="2">'.PHP_EOL
31
	             . '        <span style="visibility:[SHOW_READ_MORE];">'.PHP_EOL
32
	             . '         <a href="[LINK]">[TEXT_READ_MORE]</a>'.PHP_EOL
33
	             . '        </span>'.PHP_EOL
34
	             . '      </td>'.PHP_EOL
35
	             . '    </tr>';
36
	$footer      = '  </tbody>'.PHP_EOL
37
	             . '</table>'.PHP_EOL
38
	             . '<table class="page-header" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]'.PHP_EOL
39
	             . '  <tbody>'.PHP_EOL
40
	             . '    <tr>'.PHP_EOL
41
	             . '      <td class="page-left">[PREVIOUS_PAGE_LINK]</td>'.PHP_EOL
42
	             . '      <td class="page-center">[OF]</td>'.PHP_EOL
43
	             . '      <td class="page-right">[NEXT_PAGE_LINK]</td>'.PHP_EOL
44
	             . '    </tr>'.PHP_EOL
45
	             . '  </tbody>'.PHP_EOL
46
	             . '</table>'.PHP_EOL;
47
	$post_header = '<table class="post-header"'.PHP_EOL
48
	             . '  <tbody>'.PHP_EOL
49
	             . '    <tr>'.PHP_EOL
50
	             . '      <td><h1>[TITLE]</h1></td>'.PHP_EOL
51
	             . '      <td rowspan="3" style="display: [DISPLAY_IMAGE]">[GROUP_IMAGE]</td>'.PHP_EOL
52
	             . '    </tr>'.PHP_EOL
53
	             . '    <tr>'.PHP_EOL
54
	             . '      <td class="public-info"><b>[TEXT_POSTED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [PUBLISHED_DATE]</b></td>'.PHP_EOL
55
	             . '    </tr>'.PHP_EOL
56
	             . '    <tr style="display: [DISPLAY_GROUP]">'.PHP_EOL
57
	             . '      <td class="group-page"><a href="[BACK]">[PAGE_TITLE]</a> &gt;&gt; <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>'.PHP_EOL
58
	             . '    </tr>'.PHP_EOL
59
	             . '  </tbody>'.PHP_EOL
60
	             . '</table>'.PHP_EOL;
61
	$post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>'.PHP_EOL
62
	             . '<a href=\"[BACK]\">[TEXT_BACK]</a>'.PHP_EOL;
63

  
64
	$comments_header  = ''.PHP_EOL
65
	                  . '<h3>[TEXT_COMMENTS]</h3>'.PHP_EOL
66
	                  . '<table class="comment-header">'.PHP_EOL
67
	                  . '  <tbody>'.PHP_EOL;
68
	$comments_loop    = ''.PHP_EOL
69
	                  . '    <tr>'.PHP_EOL
70
	                  . '      <td class="comment_title">[TITLE]</td>'.PHP_EOL
71
	                  . '      <td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>'.PHP_EOL
72
	                  . '    </tr>'.PHP_EOL
73
	                  . '    <tr>'.PHP_EOL
74
	                  . '      <td colspan="2" class="comment-text">[COMMENT]</td>'.PHP_EOL
75
	                  . '    </tr>'.PHP_EOL
76
	                  . ''.PHP_EOL;
77
	$comments_footer  = ''.PHP_EOL
78
	                  . '  </tbody>'.PHP_EOL
79
	                  . '</table>'.PHP_EOL
80
	                  . '<br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>'.PHP_EOL
81
	                  . ''.PHP_EOL;
82
	$comments_page    = ''.PHP_EOL
83
	                  . '<h2>[TEXT_COMMENT]</h2>'.PHP_EOL
84
	                  . '<h3>[POST_TITLE]</h3><br />'.PHP_EOL
85
	                  . ''.PHP_EOL;
86

  
75 87
$commenting = 'none';
76 88
$use_captcha = true;
77 89

  
78
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id,header,post_loop,footer,post_header,post_footer,comments_header,comments_loop,comments_footer,comments_page,commenting,use_captcha) VALUES ('$section_id','$page_id','$header','$post_loop','$footer','$post_header','$post_footer','$comments_header','$comments_loop','$comments_footer','$comments_page','$commenting','$use_captcha')");
90
$sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_news_settings` '
91
     . 'SET `section_id`='.$section_id.', '
92
     .     '`page_id`='.$page_id.', '
93
     .     '`header`=\''.$header.'\', '
94
     .     '`post_loop`=\''.$post_loop.'\', '
95
     .     '`footer`=\''.$footer.'\', '
96
     .     '`post_header`=\''.$post_header.'\', '
97
     .     '`post_footer`=\''.$post_footer.'\', '
98
     .     '`comments_header`=\''.$comments_header.'\', '
99
     .     '`comments_loop`=\''.$comments_loop.'\', '
100
     .     '`comments_footer`=\''.$comments_footer.'\', '
101
     .     '`comments_page`=\''.$comments_page.'\', '
102
     .     '`commenting`=\'none\', '
103
     .     '`use_captcha`=1 ';
104
$database->query($sql);
branches/2.8.x/wb/modules/news/modify_post.php
4 4
 * @category        modules
5 5
 * @package         news
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
......
30 30
if (!$post_id) {
31 31
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $backlink);
32 32
}
33

  
33
$aPostRec = array(
34
'post_id' => 0,
35
'section_id' => 0,
36
'page_id' => 0,
37
'group_id' => 0,
38
'active' => 0,
39
'position' => 0,
40
'title' => '',
41
'link' => '',
42
'content_short' => '',
43
'content_long' => '',
44
'commenting' => '',
45
'created_when' => 0,
46
'created_by' => 0,
47
'published_when' => 0,
48
'published_until' => 0,
49
'posted_when' => 0,
50
'posted_by' => 0
51
);
52
$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
34 53
// Get header and footer
35
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
36
$fetch_content = $query_content->fetchRow();
54
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_news_posts` WHERE `post_id`='.(int)$post_id;
55
if($oPostRes = $database->query($sql)){
56
	$aPostRec = $oPostRes->fetchRow(MYSQL_ASSOC);
57
	$aPostRec['content_short'] = str_replace('{SYSVAR:MEDIA_REL}', $sMediaUrl,$aPostRec['content_short']);
58
	$aPostRec['content_long']  = str_replace('{SYSVAR:MEDIA_REL}', $sMediaUrl,$aPostRec['content_long']);
59
}
60
//$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
37 61

  
62
//print '<pre style="text-align:left;color:#000;padding:1em;"><strong>function '.__FUNCTION__.'( '.$post_id.' );</strong>  basename: '.basename(__FILE__).'  line: '.__LINE__.' -> <br />'; 
63
//print_r( $fetch_content['content_short'] ); print '</pre>'; // flush ();sleep(10); die();
38 64
if(!isset($wysiwyg_editor_loaded)) {
39 65
    $wysiwyg_editor_loaded=true;
40 66
	if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
......
58 84
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
59 85
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
60 86
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
61
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>" />
87
<input type="hidden" name="link" value="<?php echo $aPostRec['link']; ?>" />
62 88
<?php echo $admin->getFTAN(); ?>
63 89

  
64 90
<table class="row_a" cellpadding="2" cellspacing="0" width="100%">
65 91
<tr>
66 92
	<td><?php echo $TEXT['TITLE']; ?>:</td>
67 93
	<td width="80%">
68
		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
94
		<input type="text" name="title" value="<?php echo (htmlspecialchars($aPostRec['title'])); ?>" style="width: 98%;" maxlength="255" />
69 95
	</td>
70 96
</tr>
71 97
<tr>
......
77 103
			$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
78 104
			if($query->numRows() > 0) {
79 105
				// Loop through groups
80
				while($group = $query->fetchRow()) {
106
				while($group = $query->fetchRow(MYSQL_ASSOC)) {
81 107
					?>
82
					<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected="selected"'; } ?>><?php echo $group['title']; ?></option>
108
					<option value="<?php echo $group['group_id']; ?>"<?php if($aPostRec['group_id'] == $group['group_id']) { echo ' selected="selected"'; } ?>><?php echo $group['title']; ?></option>
83 109
					<?php
84 110
				}
85 111
			}
......
92 118
	<td>
93 119
		<select name="commenting" style="width: 100%;">
94 120
			<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
95
			<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
96
			<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
121
			<option value="public" <?php if($aPostRec['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
122
			<option value="private" <?php if($aPostRec['commenting'] == 'private') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
97 123
		</select>
98 124
	</td>
99 125
</tr>
100 126
<tr>
101 127
	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
102 128
	<td>
103
		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked="checked"'; } ?> />
129
		<input type="radio" name="active" id="active_true" value="1" <?php if($aPostRec['active'] == 1) { echo ' checked="checked"'; } ?> />
104 130
		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
105 131
		<?php echo $TEXT['YES']; ?>
106 132
		</a>
107 133
		&nbsp;
108
		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked="checked"'; } ?> />
134
		<input type="radio" name="active" id="active_false" value="0" <?php if($aPostRec['active'] == 0) { echo ' checked="checked"'; } ?> />
109 135
		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
110 136
		<?php echo $TEXT['NO']; ?>
111 137
		</a>
......
114 140
<tr>
115 141
	<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
116 142
	<td>
117
	<input type="text" id="publishdate" name="publishdate" value="<?php if($fetch_content['published_when']==0) print date($jscal_format, strtotime((date('Y-m-d H:i')))); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
143
	<input type="text" id="publishdate" name="publishdate" value="<?php if($aPostRec['published_when']==0) print date($jscal_format, strtotime((date('Y-m-d H:i')))); else print date($jscal_format, $aPostRec['published_when']);?>" style="width: 120px;" />
118 144
	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="publishdate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" alt="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
119 145
	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" alt="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.publishdate.value=''" />
120 146
	</td>
......
122 148
<tr>
123 149
	<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
124 150
	<td>
125
	<input type="text" id="enddate" name="enddate" value="<?php if($fetch_content['published_until']==0) print ""; else print date($jscal_format, $fetch_content['published_until'])?>" style="width: 120px;" />
151
	<input type="text" id="enddate" name="enddate" value="<?php if($aPostRec['published_until']==0) print ""; else print date($jscal_format, $aPostRec['published_until'])?>" style="width: 120px;" />
126 152
	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="enddate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" alt="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
127 153
	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" alt="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.enddate.value=''" />
128 154
	</td>
......
136 162
<tr>
137 163
	<td>
138 164
	<?php
139
	show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","200px");
165
	show_wysiwyg_editor("short","short",htmlspecialchars($aPostRec['content_short']),"100%","200px");
140 166
	?>
141 167
	</td>
142 168
</tr>
......
146 172
<tr>
147 173
	<td>
148 174
	<?php
149
	show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","650px");
175
	show_wysiwyg_editor("long","long",htmlspecialchars($aPostRec['content_long']),"100%","650px");
150 176
	?>
151 177
	</td>
152 178
</tr>
......
215 241
	?>
216 242
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
217 243
	<?php
218
	while($comment = $query_comments->fetchRow()) {
244
	while($comment = $query_comments->fetchRow(MYSQL_ASSOC)) {
219 245
		$cid = $admin->getIDKEY($comment['comment_id']);
220 246
		?>
221 247
		<tr class="row_<?php echo $row; ?>" >
branches/2.8.x/wb/modules/news/save_post.php
4 4
 * @category        modules
5 5
 * @package         news
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
......
65 65
	}
66 66
	$admin->print_header();
67 67

  
68
//	$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
69
//	$searchfor = '@(<[^>]*=\s*")('.preg_quote($sMediaUrl).')([^">]*".*>)@siU';
68 70
// Validate all fields
71
	$title      = $admin->StripCodeFromText($admin->get_post('title'));
72
	$commenting = $admin->StripCodeFromText($admin->get_post('commenting'));
73
	$active     = intval($admin->get_post('active'));
74
	$old_link   = $admin->StripCodeFromText($admin->get_post('link'));
75
	$group_id   = intval($admin->get_post('group'));
76

  
69 77
	if($admin->get_post('title') == '' AND $admin->get_post('url') == '') {
70
        $recallUrl = WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.
78
		$recallUrl = WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.
71 79
		             '&section_id='.$section_id.'&post_id='.$admin->getIDKEY($post_id);
72 80
		$admin->print_error($MESSAGE['GENERIC_FILL_IN_ALL'], $recallUrl);
73
	}else {
74
		$title      = $admin->get_post_escaped('title');
75
		$short      = $admin->get_post_escaped('short');
76
		$long       = $admin->get_post_escaped('long');
77
		$commenting = $admin->get_post_escaped('commenting');
78
		$active     = $admin->get_post_escaped('active');
79
		$old_link   = $admin->get_post_escaped('link');
80
		$group_id   = $admin->get_post_escaped('group');
81
	} else {
82
		$short      = $admin->get_post('short');
83
		$long       = $admin->get_post('long');
84
//		if(ini_get('magic_quotes_gpc')==true)
85
//		{
86
//			$short = $admin->strip_slashes($short);
87
//			$long = $admin->strip_slashes($long);
88
//		}
89
//		$short = preg_replace($searchfor, '$1{SYSVAR:MEDIA_REL}$3', $short );
90
//		$long = preg_replace($searchfor, '$1{SYSVAR:MEDIA_REL}$3', $long );
91
		$short = $admin->ReplaceAbsoluteMediaUrl($short);
92
		$long = $admin->ReplaceAbsoluteMediaUrl($long);
81 93
	}
94

  
82 95
// Get page link URL
83 96
	$sql = 'SELECT `link` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.(int)$page_id;
84 97
	$oldLink = $database->get_one($sql);

Also available in: Unified diff