Project

General

Profile

« Previous | Next » 

Revision 1753

Added by Dietmar about 12 years ago

! remove summary="" in captcha tables frontend
! fixed calendar time, now all Calendar in WB shows right user TIMEZONE
please check module for saving timestamp minus TIMEZONE
  1. recoded sections in admin/pages/, now save all fields
    there was a problem, if blocks and menus are disabled

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
15 Sep-2012 Build 1753 Dietmar Woellbrink (Luisehahne)
17
! remove summary="" in captcha tables frontend
18
! fixed calendar time, now all Calendar in WB shows right user TIMEZONE
19
  please check module for saving timestamp minus TIMEZONE
20
# recoded sections in admin/pages/, now save all fields
21
  there was a problem, if blocks and menus are disabled
16 22
14 Sep-2012 Build 1752 Dietmar Woellbrink (Luisehahne)
17 23
! forgot to upload CHANGELOG and version.php
18 24
14 Sep-2012 Build 1751 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/include/captcha/captcha.php
1 1
<?php
2
/**
3
 *
4
 * @category        captcha
5
 * @package         include
6
 * @subpackage
7
 * @author          Ryan Djurovich,WebsiteBaker Project
8
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
9
 * @link            http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource      $HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
2 18

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, 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 19
// displays the image or text inside an <iframe>
27 20
if(!function_exists('display_captcha_real')) {
28 21
	function display_captcha_real($kind='image') {
......
142 135
		if($action=='all') {
143 136
			switch(CAPTCHA_TYPE) {
144 137
				case 'text': // text-captcha
145
					?><table class="captcha_table" summary="captcha control"><tr>
138
					?><table class="captcha_table"><tr>
146 139
					<td class="text_captcha">
147 140
						<?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?>
148 141
					</td>
......
152 145
					</tr></table><?php
153 146
					break;
154 147
				case 'calc_text': // calculation as text
155
					?><table class="captcha_table" summary="captcha control"><tr>
148
					?><table class="captcha_table"><tr>
156 149
					<td class="text_captcha">
157 150
						<?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?>
158 151
					</td>
......
163 156
					break;
164 157
				case 'calc_image': // calculation with image (old captcha)
165 158
				case 'calc_ttf_image': // calculation with varying background and ttf-font
166
				  ?><table class="captcha_table" summary="captcha control"><tr>
159
				  ?><table class="captcha_table"><tr>
167 160
					<td class="image_captcha">
168 161
						<?php echo "<iframe class=\"captcha_iframe\" width=\"$captcha_width\" height=\"$captcha_height\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" name=\"captcha_iframe_$sec_id\" src=\"". WB_URL ."/include/captcha/captcha.php?display_captcha_X986E21=1&amp;s=$sec_id"; ?>">
169 162
						<img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t&amp;s=$sec_id"; ?>" alt="Captcha" />
......
177 170
				// normal images
178 171
				case 'ttf_image': // captcha with varying background and ttf-font
179 172
				case 'old_image': // old captcha
180
					?><table class="captcha_table" summary="captcha control"><tr>
173
					?><table class="captcha_table"><tr>
181 174
					<td class="image_captcha">
182 175
						<?php echo "<iframe class=\"captcha_iframe\" width=\"$captcha_width\" height=\"$captcha_height\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" name=\"captcha_iframe_$sec_id\" src=\"". WB_URL ."/include/captcha/captcha.php?display_captcha_X986E21=1&amp;s=$sec_id"; ?>">
183 176
						<img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t&amp;s=$sec_id"; ?>" alt="Captcha" />
184 177

  
branches/2.8.x/wb/include/jscalendar/wb-setup.php
38 38
// require_once(WB_PATH.'/include/jscalendar/calendar-system.css');
39 39
?>
40 40
<!--</style>  -->
41
<script type="text/javascript" src="<?php echo WB_URL ?>/include/jscalendar/calendar.js"></script>
41
<script src="<?php echo WB_URL ?>/include/jscalendar/calendar.js" type="text/javascript"></script>
42 42
<?php // some stuff for jscalendar
43 43
	// language
44 44
	$jscal_lang = defined('LANGUAGE')?strtolower(LANGUAGE):'en';
......
47 47
		$jscal_lang = 'en';
48 48
	}
49 49
	// today
50
	$jscal_today = gmdate('Y/m/d H:i');
50
	$jscal_today = gmdate('Y/m/d H:i', time()+TIMEZONE);
51 51
	// first-day-of-week
52 52
	$jscal_firstday = '1'; // monday
53 53
	if(LANGUAGE=='EN')
......
77 77
			$jscal_ifformat = '%Y-%m-%d';
78 78
			break;
79 79
	}
80
	if(isset($jscal_use_time) && $jscal_use_time==TRUE) {
80
	if(isset($jscal_use_time) && $jscal_use_time==true) {
81 81
		$jscal_format .= ' H:i';
82 82
		$jscal_ifformat .= ' %H:%M';
83 83
	}
84 84

  
85 85
	// load scripts for jscalendar
86 86
?>
87
<script type="text/javascript" src="<?php echo WB_URL ?>/include/jscalendar/lang/calendar-<?php echo $jscal_lang ?>.js"></script>
88
<script type="text/javascript" src="<?php echo WB_URL ?>/include/jscalendar/calendar-setup.js"></script>
87
<script src="<?php echo WB_URL ?>/include/jscalendar/lang/calendar-<?php echo $jscal_lang ?>.js" type="text/javascript"></script>
88
<script src="<?php echo WB_URL ?>/include/jscalendar/calendar-setup.js" type="text/javascript"></script>
89 89

  
branches/2.8.x/wb/admin/pages/sections_save.php
1 1
<?php
2 2
/**
3 3
 *
4
 * @category        admin
5
 * @package         pages
6
 * @author          WebsiteBaker Project
4
 * @category        backend
5
 * @package         admin
6
 * @subpackage      pages
7
 * @author          Ryan Djurovich, WebsiteBaker Project
7 8
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @copyright       2009-2012, Website Baker Org. e.V.
9 10
 * @link			http://www.websitebaker2.org/
10 11
 * @license         http://www.gnu.org/licenses/gpl.html
11 12
 * @platform        WebsiteBaker 2.8.x
......
19 20
// Include config file
20 21
require('../../config.php');
21 22

  
22
// Make sure people are allowed to access this page
23
if(MANAGE_SECTIONS != 'enabled') {
24
	header('Location: '.ADMIN_URL.'/pages/index.php');
25
	exit(0);
26
}
27

  
28 23
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php");
29 24
/**/
30 25
// Create new admin object
......
32 27
// suppress to print the header, so no new FTAN will be set
33 28
$admin = new admin('Pages', 'pages_modify',false);
34 29

  
30
// Make sure people are allowed to access this page
31
if(MANAGE_SECTIONS == false) {
32
	$admin->send_header('Location: '.ADMIN_URL.'/pages/index.php');
33
	exit(0);
34
}
35

  
35 36
// Get page id
36 37
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id'])) {
37
	header("Location: index.php");
38
	$admin->send_header("Location: index.php");
38 39
	exit(0);
39 40
} else {
40 41
	$page_id = (int)$_GET['page_id'];
......
45 46
	$admin->print_header();
46 47
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
47 48
}
48
// After check print the header
49
$admin->print_header();
50 49
/*
51 50
if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
52 51
{
......
54 53
	exit();
55 54
}
56 55
*/
56

  
57
// After check print the header
58
$admin->print_header();
59

  
60
$sBackLink = ADMIN_URL.'/pages/sections.php?page_id='.$page_id;
61

  
57 62
// Get perms
58
// $database = new database();
59
$results = $database->query("SELECT admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
60
$results_array = $results->fetchRow();
63
// Get page details
64
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'pages` ';
65
$sql .= 'WHERE page_id = '.$page_id.'';
66

  
67
if($oPage = $database->query($sql)){
68
    $results_array = $oPage->fetchRow();
69
} else {
70
	$admin->print_error($database->get_error());
71
    $aMsg = array();
72
    $aMsg[] = $MESSAGE['GENERIC_NOT_UPGRADED'];
73
    if($results->numRows() == 0) {
74
    	$aMsg[] = $MESSAGE['PAGES_NOT_FOUND'];
75
    }
76
    if($database->is_error()) {
77
    	$aMsg[] = $database->get_error();
78
    }
79
	$admin->print_error(implode('<br />',$aMsg), $sBackLink );
80
}
81

  
82
$old_admin_users  = explode(',', $results_array['admin_users']);
61 83
$old_admin_groups = explode(',', $results_array['admin_groups']);
62
$old_admin_users = explode(',', $results_array['admin_users']);
63
$in_old_group = FALSE;
84
$in_old_group = false;
64 85
foreach($admin->get_groups_id() as $cur_gid){
65 86
    if (in_array($cur_gid, $old_admin_groups)) {
66 87
        $in_old_group = TRUE;
67 88
    }
68 89
}
69 90
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
70
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
91
	$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
71 92
}
72 93

  
73
// Get page details
74
// $database = new database();
75
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'";
76
$results = $database->query($query);
77
if($database->is_error()) {
78
	$admin->print_header();
79
	$admin->print_error($database->get_error());
80
}
81
if($results->numRows() == 0) {
82
	$admin->print_header();
83
	$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
84
}
85
$results_array = $results->fetchRow();
86

  
87 94
// Set module permissions
88 95
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
96
$aMsg = array();
97
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'sections` ';
98
$sql .= 'WHERE page_id = '.$page_id.' ';
99
$sql .= 'ORDER BY position ASC';
89 100

  
90
// Loop through sections
91
$query_sections = $database->query("SELECT section_id,module,position FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
92
if($query_sections->numRows() > 0) {
93
	$num_sections = $query_sections->numRows();
94
	while($section = $query_sections->fetchRow()) {
95
		if(!is_numeric(array_search($section['module'], $module_permissions))) {
96
			// Update the section record with properties
97
			$section_id = $section['section_id'];
98
			$sql = ''; $publ_start = 0; $publ_end = 0;
99
			$dst = date("I")?" DST":""; // daylight saving time?
100
			if(isset($_POST['block'.$section_id]) && $_POST['block'.$section_id] != '') {
101
				$sql = "block = '".$admin->add_slashes($_POST['block'.$section_id])."'";
102
			}
103
			// update publ_start and publ_end, trying to make use of the strtotime()-features like "next week", "+1 month", ...
104
			if(isset($_POST['start_date'.$section_id]) && isset($_POST['end_date'.$section_id])) {
105
				if(trim($_POST['start_date'.$section_id]) == '0' || trim($_POST['start_date'.$section_id]) == '') {
106
					$publ_start = 0;
107
				} else {
108
					$publ_start = jscalendar_to_timestamp($_POST['start_date'.$section_id]);
109
				}
110
				if(trim($_POST['end_date'.$section_id]) == '0' || trim($_POST['end_date'.$section_id]) == '') {
111
					$publ_end = 0;
112
				} else {
113
					$publ_end = jscalendar_to_timestamp($_POST['end_date'.$section_id], $publ_start);
114
				}
115
				if($sql != '')
116
					$sql .= ",";
117
				$sql .= " publ_start = '".$admin->add_slashes($publ_start)."'";
118
				$sql .= ", publ_end = '".$admin->add_slashes($publ_end)."'";
119
			}
120
			$query = "UPDATE ".TABLE_PREFIX."sections SET $sql WHERE section_id = '$section_id' LIMIT 1";
121
			if($sql != '') {
122
				$database->query($query);
123
			}
124
		}
125
	}
101
if(!($oSection = $database->query($sql))) {
102
    $aMsg = array();
103
    $aMsg[] = $MESSAGE['GENERIC_NOT_UPGRADED'];
104
    if($database->is_error()) {
105
    	$aMsg[] = $database->get_error();
106
    }
107
	$admin->print_error(implode('<br />',$aMsg), $sBackLink );
126 108
}
127
// Check for error or print success message
128
if($database->is_error()) {
129
	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/sections.php?page_id='.$page_id );
130
} else {
131
	$admin->print_success($MESSAGE['PAGES']['SECTIONS_PROPERTIES_SAVED'], ADMIN_URL.'/pages/sections.php?page_id='.$page_id );
109

  
110
$aSqlSection = array();
111
// Loop through sections and set sql values for update
112
while($section = $oSection->fetchRow(MYSQL_ASSOC)) {
113

  
114
    $section_id  = $section['section_id'];
115
    $sid = 'wb'.$section_id;
116

  
117
    $dst = date('I') ? ' UTC' : ''; // daylight saving time? date('P')
118

  
119
    $iBlock      = $admin->get_post_escaped('block'.$section_id);
120
    $iBlock      = ($iBlock==null) ? $section['block'] : $iBlock;
121

  
122
    $sStartDate  = $admin->get_post_escaped('start_date'.$section_id);;
123
    $sStartDate  = ($sStartDate==null)||($sStartDate=='') ? 0 : jscalendar_to_timestamp($sStartDate)-TIMEZONE;
124

  
125
    $sEndDate   = $admin->get_post_escaped('end_date'.$section_id);
126
    $sEndDate   = ($sEndDate==null)||($sEndDate=='') ? 0 : jscalendar_to_timestamp($sEndDate)-TIMEZONE;
127

  
128
    $aSqlSection[$sid][]  = 'UPDATE `'.TABLE_PREFIX.'sections` SET ';
129
    $aSqlSection[$sid][] .= '`block`= \''.$iBlock.'\', ';
130
    $aSqlSection[$sid][] .= '`module` = \''.$section['module'].'\', ';
131
    $aSqlSection[$sid][] .= '`publ_start` = \''.$sStartDate.'\',';
132
    $aSqlSection[$sid][] .= '`publ_end` = \''.$sEndDate.'\' ';
133
    $aSqlSection[$sid][] .= 'WHERE `section_id` = \''.$section_id.'\' ';
132 134
}
133 135

  
136
foreach( $aSqlSection as $sid ) {
137

  
138
    $sql = implode('',$sid);
139
    if(!($oSection = $database->query($sql))) {
140
        $aMsg = array();
141
        $aMsg[] = $MESSAGE['GENERIC_NOT_UPGRADED'];
142
        if($database->is_error()) {
143
            $aMsg[] = $database->get_error();
144
        }
145
    $admin->print_error(implode('<br />',$aMsg), $sBackLink );
146
    }
147
}
148

  
149
$admin->print_success($MESSAGE['PAGES_SECTIONS_PROPERTIES_SAVED'], $sBackLink );
150

  
134 151
// Print admin footer
135 152
$admin->print_footer();
branches/2.8.x/wb/admin/pages/sections.php
31 31
require_once(WB_PATH.'/framework/functions.php');
32 32
// Create new admin object
33 33
require_once(WB_PATH.'/framework/class.admin.php');
34
$admin = new admin('Pages', 'pages_modify', false);
34
$admin = new admin('Pages', 'pages_view', false);
35 35

  
36 36
$action = 'show';
37 37
// Get page id
......
51 51

  
52 52
switch ($action):
53 53
	case 'delete' :
54
        if($admin->get_permission('pages_delete') == false)
55
        {
56
			$admin->print_header();
57
			$admin->print_error($module.' '.strtolower($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']),$backlink);
58
        }
54 59

  
55 60
		if( ( !($section_id = intval($admin->checkIDKEY('section_id', 0, $_SERVER['REQUEST_METHOD'])) )) )
56 61
		{
......
90 95

  
91 96
		break;
92 97
	case 'add' :
93

  
98
        if($admin->get_permission('pages_add') == false)
99
        {
100
			$admin->print_header();
101
			$admin->print_error($module.' '.strtolower($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']),$backlink);
102
        }
94 103
		if (!$admin->checkFTAN())
95 104
		{
96 105
			$admin->print_header();
......
107 116
	    $sql .= '`page_id` = '.(int)$page_id.', ';
108 117
	    $sql .= '`module` = \''.$module.'\', ';
109 118
	    $sql .= '`position` = '.(int)$position.', ';
110
	    $sql .= '`block` = 1';
119
	    $sql .= '`block` = \'1\', ';
120
        $sql .= '`publ_start` = \'0\',';
121
        $sql .= '`publ_end` = \'0\' ';
122

  
111 123
        if($database->query($sql)) {
112 124
			// Get the section id
113 125
			$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
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', '1752');
54
if(!defined('REVISION')) define('REVISION', '1753');
55 55
if(!defined('SP')) define('SP', '');

Also available in: Unified diff