Revision 1487
Added by DarkViper over 13 years ago
class.wb.php | ||
---|---|---|
138 | 138 |
$has_active_sections = false; |
139 | 139 |
$page_id = $page['page_id']; |
140 | 140 |
$now = time(); |
141 |
$query_sections = $database->query("SELECT publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id'"); |
|
142 |
if($query_sections->numRows() != 0) |
|
143 |
{ |
|
144 |
while($section = $query_sections->fetchRow()) |
|
145 |
{ |
|
146 |
if($now<$section['publ_end'] && ($now>$section['publ_start'] || $section['publ_start']==0) || $now>$section['publ_start'] && $section['publ_end']==0) |
|
147 |
{ |
|
141 |
$sql = 'SELECT `publ_start`, `publ_end` '; |
|
142 |
$sql .= 'FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.(int)$page_id; |
|
143 |
$query_sections = $database->query($sql); |
|
144 |
if($query_sections->numRows() != 0) { |
|
145 |
while($section = $query_sections->fetchRow()) { |
|
146 |
if( $now<$section['publ_end'] && |
|
147 |
($now>$section['publ_start'] || $section['publ_start']==0) || |
|
148 |
$now>$section['publ_start'] && $section['publ_end']==0) |
|
149 |
{ |
|
148 | 150 |
$has_active_sections = true; |
149 | 151 |
break; |
150 | 152 |
} |
... | ... | |
156 | 158 |
// Check whether we should show a page or not (for front-end) |
157 | 159 |
function show_page($page) |
158 | 160 |
{ |
159 |
if($this->page_is_visible($page) && $this->page_is_active($page)) |
|
160 |
{ |
|
161 |
return true; |
|
162 |
} else { |
|
163 |
return false; |
|
164 |
} |
|
161 |
$retval = ($this->page_is_visible($page) && $this->page_is_active($page)); |
|
162 |
return $retval; |
|
165 | 163 |
} |
166 | 164 |
|
167 | 165 |
// Check if the user is already authenticated or not |
168 | 166 |
function is_authenticated() { |
169 |
if(isset($_SESSION['USER_ID']) AND $_SESSION['USER_ID'] != "" AND is_numeric($_SESSION['USER_ID'])) |
|
170 |
{ |
|
171 |
return true; |
|
172 |
} else { |
|
173 |
return false; |
|
174 |
} |
|
167 |
$retval = ( isset($_SESSION['USER_ID']) AND |
|
168 |
$_SESSION['USER_ID'] != "" AND |
|
169 |
is_numeric($_SESSION['USER_ID'])); |
|
170 |
return $retval; |
|
175 | 171 |
} |
176 | 172 |
|
177 | 173 |
// Modified addslashes function which takes into account magic_quotes |
178 | 174 |
function add_slashes($input) { |
179 |
if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
|
|
175 |
if( get_magic_quotes_gpc() || (!is_string($input)) ) {
|
|
180 | 176 |
return $input; |
181 | 177 |
} |
182 |
$output = addslashes($input); |
|
183 |
return $output; |
|
178 |
return addslashes($input); |
|
184 | 179 |
} |
185 | 180 |
|
186 | 181 |
// Ditto for stripslashes |
... | ... | |
191 | 186 |
if ( !get_magic_quotes_gpc() || ( !is_string($input) ) ) { |
192 | 187 |
return $input; |
193 | 188 |
} |
194 |
$output = stripslashes($input); |
|
195 |
return $output; |
|
189 |
return stripslashes($input); |
|
196 | 190 |
} |
197 | 191 |
|
198 | 192 |
// Escape backslashes for use with mySQL LIKE strings |
... | ... | |
211 | 205 |
|
212 | 206 |
// Get POST data |
213 | 207 |
function get_post($field) { |
214 |
if(isset($_POST[$field])) { |
|
215 |
return $_POST[$field]; |
|
216 |
} else { |
|
217 |
return null; |
|
218 |
} |
|
208 |
return (isset($_POST[$field]) ? $_POST[$field] : null); |
|
219 | 209 |
} |
220 | 210 |
|
221 | 211 |
// Get POST data and escape it |
... | ... | |
226 | 216 |
|
227 | 217 |
// Get GET data |
228 | 218 |
function get_get($field) { |
229 |
if(isset($_GET[$field])) { |
|
230 |
return $_GET[$field]; |
|
231 |
} else { |
|
232 |
return null; |
|
233 |
} |
|
219 |
return (isset($_GET[$field]) ? $_GET[$field] : null); |
|
234 | 220 |
} |
235 | 221 |
|
236 | 222 |
// Get SESSION data |
237 | 223 |
function get_session($field) { |
238 |
if(isset($_SESSION[$field])) { |
|
239 |
return $_SESSION[$field]; |
|
240 |
} else { |
|
241 |
return null; |
|
242 |
} |
|
224 |
return (isset($_SESSION[$field]) ? $_SESSION[$field] : null); |
|
243 | 225 |
} |
244 | 226 |
|
245 | 227 |
// Get SERVER data |
246 | 228 |
function get_server($field) { |
247 |
if(isset($_SERVER[$field])) { |
|
248 |
return $_SERVER[$field]; |
|
249 |
} else { |
|
250 |
return null; |
|
251 |
} |
|
229 |
return (isset($_SERVER[$field]) ? $_SERVER[$field] : null); |
|
252 | 230 |
} |
253 | 231 |
|
254 | 232 |
// Get the current users id |
... | ... | |
298 | 276 |
|
299 | 277 |
// Get the current users timezone |
300 | 278 |
function get_timezone() { |
301 |
if(!isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { |
|
302 |
return $_SESSION['TIMEZONE']; |
|
303 |
} else { |
|
304 |
return '-72000'; |
|
305 |
} |
|
279 |
return (isset($_SESSION['USE_DEFAULT_TIMEZONE']) ? '-72000' : $_SESSION['TIMEZONE']); |
|
306 | 280 |
} |
307 | 281 |
|
308 | 282 |
// Validate supplied email address |
... | ... | |
425 | 399 |
|
426 | 400 |
// Validate send email |
427 | 401 |
function mail($fromaddress, $toaddress, $subject, $message, $fromname='') { |
428 |
/*
|
|
429 |
INTEGRATED OPEN SOURCE PHPMAILER CLASS FOR SMTP SUPPORT AND MORE
|
|
430 |
SOME SERVICE PROVIDERS DO NOT SUPPORT SENDING MAIL VIA PHP AS IT DOES NOT PROVIDE SMTP AUTHENTICATION
|
|
431 |
NEW WBMAILER CLASS IS ABLE TO SEND OUT MESSAGES USING SMTP WHICH RESOLVE THESE ISSUE (C. Sommer)
|
|
402 |
/* |
|
403 |
INTEGRATED OPEN SOURCE PHPMAILER CLASS FOR SMTP SUPPORT AND MORE |
|
404 |
SOME SERVICE PROVIDERS DO NOT SUPPORT SENDING MAIL VIA PHP AS IT DOES NOT PROVIDE SMTP AUTHENTICATION |
|
405 |
NEW WBMAILER CLASS IS ABLE TO SEND OUT MESSAGES USING SMTP WHICH RESOLVE THESE ISSUE (C. Sommer) |
|
432 | 406 |
|
433 |
NOTE:
|
|
434 |
To use SMTP for sending out mails, you have to specify the SMTP host of your domain
|
|
435 |
via the Settings panel in the backend of Website Baker
|
|
436 |
*/
|
|
407 |
NOTE: |
|
408 |
To use SMTP for sending out mails, you have to specify the SMTP host of your domain |
|
409 |
via the Settings panel in the backend of Website Baker |
|
410 |
*/ |
|
437 | 411 |
|
438 | 412 |
$fromaddress = preg_replace('/[\r\n]/', '', $fromaddress); |
439 | 413 |
$toaddress = preg_replace('/[\r\n]/', '', $toaddress); |
... | ... | |
443 | 417 |
|
444 | 418 |
// create PHPMailer object and define default settings |
445 | 419 |
$myMail = new wbmailer(); |
446 |
|
|
447 | 420 |
// set user defined from address |
448 | 421 |
if ($fromaddress!='') { |
449 |
if($fromname!='') $myMail->FromName = $fromname; // FROM-NAME
|
|
450 |
$myMail->From = $fromaddress; // FROM:
|
|
451 |
$myMail->AddReplyTo($fromaddress); // REPLY TO:
|
|
422 |
if($fromname!='') $myMail->FromName = $fromname; // FROM-NAME |
|
423 |
$myMail->From = $fromaddress; // FROM: |
|
424 |
$myMail->AddReplyTo($fromaddress); // REPLY TO: |
|
452 | 425 |
} |
453 |
|
|
454 | 426 |
// define recepient and information to send out |
455 |
$myMail->AddAddress($toaddress); // TO: |
|
456 |
$myMail->Subject = $subject; // SUBJECT |
|
457 |
$myMail->Body = nl2br($message); // CONTENT (HTML) |
|
458 |
$myMail->AltBody = strip_tags($message); // CONTENT (TEXT) |
|
459 |
|
|
427 |
$myMail->AddAddress($toaddress); // TO: |
|
428 |
$myMail->Subject = $subject; // SUBJECT |
|
429 |
$myMail->Body = nl2br($message); // CONTENT (HTML) |
|
430 |
$myMail->AltBody = strip_tags($message); // CONTENT (TEXT) |
|
460 | 431 |
// check if there are any send mail errors, otherwise say successful |
461 | 432 |
if (!$myMail->Send()) { |
462 | 433 |
return false; |
Also available in: Unified diff
class.order completely recoded to reduce SQL requests
all other files: fix SQL-statements to SQL-strict