That's why it int the post_notification.php
*
* function post_notification_febody()
* Returns the Body as a string
* Can be used by a template -> That's why it int the post_notification.php
*
* function post_notification_fe($class = 'entry')
* Outputs:
*
Header
*
* output
*
*
* function post_notification_page_content()
* Returns a array with 'header' and 'body' entries.
*
*/
function post_notification_fe($class = 'entry'){
global $wpdb;
$content = post_notification_page_content();
echo '
' . $content['header'] . '
' . $content['body'] . '
';
}
function post_notification_check_captcha(){
if(get_option('post_notification_captcha') == 0) return true;
if($_POST['captchacode'] == '') return false;
if($_POST['captcha'] == '') return false;
require_once( POST_NOTIFICATION_PATH . 'class.captcha.php' );
$my_captcha = new captcha($_POST['captchacode'], POST_NOTIFICATION_PATH . '_temp');
return $my_captcha->verify( $_POST['captcha']);
}
/**
* This creates the content
*/
function post_notification_page_content(){
global $post_notification_page_content_glob, $wpdb;
if($post_notification_page_content_glob) return $post_notification_page_content_glob;
//It doesn't matter where this goes:
$content = & $post_notification_page_content_glob;
$content = array();
$content['header'] = '';
$content['body'] = '';
// ******************************************************** //
// GET VARIABLES FROM URL
// ******************************************************** //
$action = $_GET['action'];
$addr = $wpdb->escape($_GET['addr']);
$code = $wpdb->escape($_GET['code']);
if ($_POST['addr'] != '') {
$action = $_POST['action'];
$addr = $wpdb->escape($_POST['addr']);
$code = $wpdb->escape($_POST['code']);
$pn_cats = $_POST['pn_cats']; //Security is handled in the function.
}
$msg = &$content['body'];
// ******************************************************** //
// DEFINE OTHER VARS NEEDED
// ******************************************************** //
require(post_notification_get_profile_dir(). '/strings.php');
$t_emails = $wpdb->prefix . 'post_notification_emails';
$t_cats = $wpdb->prefix . 'post_notification_cats';
$from_email = get_option('post_notification_from_email');
$pnurl = post_notification_get_link();
if(get_option('post_notification_hdr_nl') == "rn")
$hdr_nl = "\r\n";
else
$hdr_nl = "\n";
$blogname = get_option('blogname');
// ******************************************************** //
// Code Check
// ******************************************************** //
//This code is not very nice in performance, but I wanted to keep it as easy to understand as possible. It's not called that often.
if(($code != '') && $wpdb->get_var("SELECT id FROM $t_emails WHERE email_addr = '$addr' AND act_code = '" . $code . "'")){
// ******************************************************** //
// WITH AUTH
// ******************************************************** //
if(1 != $wpdb->get_var("SELECT gets_mail FROM $t_emails WHERE email_addr = '$addr'")){
//The user just subscribed, so let's set him up
$now = post_notification_date2mysql();
$wpdb->query("UPDATE $t_emails SET gets_mail = 1, date_subscribed = '$now' WHERE email_addr = '$addr'");
$mailid = $wpdb->get_var("SELECT id FROM $t_emails WHERE email_addr = '$addr'");
$selected_cats = explode(',', get_option('post_notification_selected_cats'));
$queryCats = '';
if (! empty($selected_cats)) {
$queryCats = "";
foreach ($selected_cats as $category) {
if(is_numeric($category)) $queryCats .= ", ($mailid, $category)";
}
if(strlen($queryCats) > 0)
$wpdb->query("INSERT INTO $t_cats (id, cat_id) VALUES" . substr($queryCats, 1));
}
if(isset($post_notification_strings['welcome'])){
$msg = '