Revision 643
Added by thorn almost 17 years ago
trunk/CHANGELOG | ||
---|---|---|
12 | 12 |
|
13 | 13 |
------------------------------------- 2.7.0 ------------------------------------- |
14 | 14 |
29-Jan-2008 Thomas Hornik |
15 |
# strtotime()'s behavior differ in PHP4 and PHP5. |
|
16 |
Had to fix some issues in admin/pages/sections and module news. |
|
15 | 17 |
# Security bugfix: Text file for text-captcha was world-readable. Moved to database. |
16 |
# Text-captcha: empty line in test file, following a question, was accepted as answer. Fixed.
|
|
18 |
# Text-captcha: empty line in text file, following a question, was accepted as answer. Fixed.
|
|
17 | 19 |
28-Jan-2008 Matthias Gallas |
18 | 20 |
# Replaced all special chars in language files with htmlentities or unicode |
19 | 21 |
+ Added some missing lines in language files |
trunk/wb/include/jscalendar/jscalendar-functions.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2008, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
if(!defined('WB_URL')) { exit(header('Location: ../index.php')); } |
|
27 |
|
|
28 |
// convert string from jscalendar to timestamp. |
|
29 |
// converts dd.mm.yyyy and mm/dd/yyyy, with or without time. |
|
30 |
// strtotime() may fails with e.g. "dd.mm.yyyy" and PHP4 |
|
31 |
function jscalendar_to_timestamp($str, $offset='') { |
|
32 |
$str = trim($str); |
|
33 |
// convert to yyyy-mm-dd |
|
34 |
// "dd.mm.yyyy"? |
|
35 |
if(preg_match('/^\d{1,2}\.\d{1,2}\.\d{2}(\d{2})?/', $str)) { |
|
36 |
$str = preg_replace('/^(\d{1,2})\.(\d{1,2})\.(\d{2}(\d{2})?)/', '$3-$2-$1', $str); |
|
37 |
} |
|
38 |
// "mm/dd/yyyy"? |
|
39 |
if(preg_match('#^\d{1,2}/\d{1,2}/(\d{2}(\d{2})?)#', $str)) { |
|
40 |
$str = preg_replace('#^(\d{1,2})/(\d{1,2})/(\d{2}(\d{2})?)#', '$3-$1-$2', $str); |
|
41 |
} |
|
42 |
// use strtotime() |
|
43 |
if($offset!='') |
|
44 |
return(strtotime($str, $offset)); |
|
45 |
else |
|
46 |
return(strtotime($str)); |
|
47 |
} |
|
48 |
|
|
49 |
?> |
|
0 | 50 |
trunk/wb/include/jscalendar/wb-setup.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 |
// $Id:$
|
|
3 |
// $Id$ |
|
4 | 4 |
|
5 | 5 |
/* |
6 | 6 |
|
... | ... | |
53 | 53 |
if(LANGUAGE=='EN') |
54 | 54 |
$jscal_firstday = '0'; // sunday |
55 | 55 |
// date and time format for the text-field and for jscal's "ifFormat". We offer dd.mm.yyyy or yyyy-mm-dd or mm/dd/yyyy |
56 |
// ATTN: strtotime() fails with "dd.mm.yyyy" and PHP4. So the string has to be converted to e.g. "yyyy-mm-dd", which will work. |
|
56 | 57 |
switch(DATE_FORMAT) { |
57 | 58 |
case 'd.m.Y': |
58 | 59 |
case 'd M Y': |
trunk/wb/admin/pages/sections_save.php | ||
---|---|---|
32 | 32 |
exit(0); |
33 | 33 |
} |
34 | 34 |
|
35 |
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php"); |
|
36 |
|
|
35 | 37 |
// Get page id |
36 | 38 |
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) { |
37 | 39 |
header("Location: index.php"); |
... | ... | |
95 | 97 |
if(trim($_POST['start_date'.$section_id]) == '0' OR trim($_POST['start_date'.$section_id]) == '') { |
96 | 98 |
$publ_start = 0; |
97 | 99 |
} else { |
98 |
$publ_start = strtotime($_POST['start_date'.$section_id]);
|
|
100 |
$publ_start = jscalendar_to_timestamp($_POST['start_date'.$section_id]);
|
|
99 | 101 |
} |
100 | 102 |
if(trim($_POST['end_date'.$section_id]) == '0' OR trim($_POST['end_date'.$section_id]) == '') { |
101 | 103 |
$publ_end = 0; |
102 | 104 |
} else { |
103 |
$publ_end = strtotime($_POST['end_date'.$section_id], $publ_start);
|
|
105 |
$publ_end = jscalendar_to_timestamp($_POST['end_date'.$section_id], $publ_start);
|
|
104 | 106 |
} |
105 | 107 |
if($sql != '') |
106 | 108 |
$sql .= ","; |
trunk/wb/admin/pages/sections.php | ||
---|---|---|
140 | 140 |
<?php // include jscalendar-setup |
141 | 141 |
$jscal_use_time = true; // whether to use a clock, too |
142 | 142 |
require_once(WB_PATH."/include/jscalendar/wb-setup.php"); |
143 |
// override some vars: (normally, there is no need to change this) |
|
144 |
//$jscal_lang = "en"; //- calendar-language (default: wb-backend-language) |
|
145 |
//$jscal_today = ""; // - date the calendar offers if the text-field is empty (default: today) |
|
146 |
//$jscal_firstday = "0"; // - first-day-of-week (0-sunday, 1-monday, ...) (default: 0(EN) or 1(everything else)) |
|
147 |
//$jscal_format = "Y-m-d"; // - initial-format used for the text-field (default: from wb-backend-date-format) |
|
148 |
//$jscal_ifformat = "%Y-%m-%d"; // - format for jscalendar (default: from wb-backend-date-format) |
|
149 | 143 |
?> |
150 | 144 |
<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%" height="50" style="margin-bottom: 10px;"> |
151 | 145 |
<tr style="background-color: #F0F0F0;"> |
trunk/wb/modules/news/modify_post.php | ||
---|---|---|
52 | 52 |
// include jscalendar-setup |
53 | 53 |
$jscal_use_time = true; // whether to use a clock, too |
54 | 54 |
require_once(WB_PATH."/include/jscalendar/wb-setup.php"); |
55 |
// override some vars: (normally, there is no need to change this) |
|
56 |
//$jscal_lang = "en"; //- calendar-language (default: wb-backend-language) |
|
57 |
//$jscal_today = ""; // - date the calendar offers if the text-field is empty (default: today) |
|
58 |
//$jscal_firstday = "0"; // - first-day-of-week (0-sunday, 1-monday, ...) (default: 0(EN) or 1(everything else)) |
|
59 |
//$jscal_format = "Y-m-d"; // - initial-format used for the text-field (default: from wb-backend-date-format) |
|
60 |
//$jscal_ifformat = "%Y-%m-%d"; // - format for jscalendar (default: from wb-backend-date-format) |
|
61 |
|
|
62 | 55 |
?> |
63 |
|
|
64 | 56 |
<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['POST']; ?></h2> |
65 | 57 |
|
66 | 58 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;"> |
... | ... | |
123 | 115 |
<tr> |
124 | 116 |
<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td> |
125 | 117 |
<td> |
126 |
<input type="text" id="publishdate" name="publishdate" value="<?php if($fetch_content['published_when']==0) print date($jscal_format, time()); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
|
|
118 |
<input type="text" id="publishdate" name="publishdate" value="<?php if($fetch_content['published_when']==0) print date($jscal_format, strtotime((date('Y-m-d')))); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
|
|
127 | 119 |
<img src="<?php echo ADMIN_URL ?>/images/clock_16.png" id="publishdate_trigger" style="cursor: pointer;" title="Calendar" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" /> |
128 | 120 |
<img src="<?php echo ADMIN_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="delete date" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.publishdate.value=''" /> |
129 | 121 |
</td> |
trunk/wb/modules/news/save_post.php | ||
---|---|---|
25 | 25 |
|
26 | 26 |
require('../../config.php'); |
27 | 27 |
|
28 |
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php"); |
|
29 |
|
|
28 | 30 |
// Get id |
29 | 31 |
if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) { |
30 | 32 |
header("Location: ".ADMIN_URL."/pages/index.php"); |
... | ... | |
45 | 47 |
$title = $admin->add_slashes($admin->get_post('title')); |
46 | 48 |
$short = $admin->add_slashes($admin->get_post('short')); |
47 | 49 |
$long = $admin->add_slashes($admin->get_post('long')); |
48 |
$publishedwhen = strtotime($admin->get_post('publishdate')); |
|
49 |
$publisheduntil = strtotime($admin->get_post('enddate')); |
|
50 | 50 |
$commenting = $admin->get_post('commenting'); |
51 | 51 |
$active = $admin->get_post('active'); |
52 | 52 |
$old_link = $admin->get_post('link'); |
... | ... | |
102 | 102 |
change_mode($filename); |
103 | 103 |
} |
104 | 104 |
|
105 |
// get publisedwhen and publisheduntil |
|
106 |
$publishedwhen = jscalendar_to_timestamp($admin->get_post('publishdate')); |
|
107 |
if($publishedwhen == '' || $publishedwhen < 1) |
|
108 |
$publishedwhen=0; |
|
109 |
$publisheduntil = jscalendar_to_timestamp($admin->get_post('enddate'), $publishedwhen); |
|
110 |
if($publisheduntil == '' || $publisheduntil < 1) |
|
111 |
$publisheduntil=0; |
|
112 |
|
|
105 | 113 |
// Update row |
106 | 114 |
$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', published_until = '$publisheduntil', posted_when = '".mktime()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'"); |
107 | 115 |
|
Also available in: Unified diff
Had to fix some strtotime()-related issues in admin/pages/sections and module news to use with PHP4.