' . __('Number of mails must be greater then zero.', 'post_notification') .'
';
}
} else {
echo '
' . __('Number of mails must be a number', 'post_notification') . '
';
}
if($_POST['hdr_nl'] == "rn")
update_option('post_notification_hdr_nl', "rn");
else
update_option('post_notification_hdr_nl', "n");
// Check wheather the template exists in the Profile
if( is_file(POST_NOTIFICATION_PATH . $_POST['en_profile'] .'/' . $_POST['en_template']) ||
is_file(POST_NOTIFICATION_DATA . $_POST['en_profile'] .'/' . $_POST['en_template']) ){
update_option('post_notification_profile', $_POST['en_profile']);
update_option('post_notification_template', $_POST['en_template']);
} else {
// Don't save any Profile / Template-inforamtion so we don't get in to an inconsisten state;
echo '
' . __('Could not find the template in this profile. Please select a template and save again.', 'post_notification') . '
';
$profile = $_POST['en_profile'];
}
// Update default categories
$categories = $_POST['pn_cats'];
if (empty($categories)) {
update_option('post_notification_selected_cats', '');
} else {
$categoryList = '';
foreach ($categories as $category) {
if (is_numeric($category)) {
$categoryList .= ',' . $category;
}
}
update_option('post_notification_selected_cats', substr($categoryList, 1));
}
//Add the page
if($_POST['add_page']=="add"){
//Database change in 2.1
if(get_option('db_version')< 4772){
$post_status = "static";
} else {
$post_type = "page";
$post_status = "publish";
}
//Collect the Data
if(get_option('post_notification_filter_include') == 'no'){
$post_title = $_POST['page_name'];
$post_content = __('If you can read this, something went wrong. :-(', 'post_notification');
} else {
$post_title = '@@post_notification_header';
$post_content = '@@post_notification_body';
}
$post_data = compact('post_content','post_title', 'post_status', 'post_type');
$post_data = add_magic_quotes($post_data);
//Post
$post_ID = wp_insert_post($post_data);
//Add meta if we are using the Template.
if(get_option('post_notification_filter_include') == 'no'){
add_post_meta($post_ID, '_wp_page_template', 'post_notification_template.php', true);
}
//Add the ID to the URL
update_option('post_notification_url', $post_ID);
}
echo '
' . __('Data was updated.', 'post_notification') . '
';
}
//Try to install the theme in case we need it. There be no warning. Warnings are only on the info-page.
post_notification_installtheme();
$selected = 'selected="selected"';
/**
* @todo Move all this stuff down to where it is displayed,
* having all this stuff up here was a good Idea while there were few settings.
*/
if(get_option('post_notification_hdr_nl') == 'rn')
$hdr_rn = $selected;
else
$hdr_n = $selected;
if(get_option('post_notification_show_content') == 'no')
$contentN = $selected;
else
$contentY = $selected;
if(get_option('post_notification_send_default') == 'no')
$sendN = $selected;
else
$sendY = $selected;
if(get_option('post_notification_send_private') == 'no')
$privateN = $selected;
else
$privateY = $selected;
if(get_option('post_notification_send_page') == 'no')
$pageN = $selected;
else
$pageY = $selected;
if(get_option('post_notification_page_meta') == 'no')
$metaN = $selected;
else
$metaY = $selected;
if(get_option('post_notification_filter_include') == 'no')
$filter_includeN = $selected;
else
$filter_includeY = $selected;
if(get_option('post_notification_uninstall') == 'yes') //rather have No
$uninstallY = $selected;
else
$uninstallN = $selected;
//Find Profiles
if(!isset($profile)) //If the profile is already set, dont change.
$profile = get_option('post_notification_profile');
$profile_list = array();
if(file_exists(POST_NOTIFICATION_DATA)){
$dir_handle=opendir(POST_NOTIFICATION_DATA);
while (false !== ($file = readdir ($dir_handle))) {
if(@is_dir(POST_NOTIFICATION_DATA . $file) && $file[0] != '.' && $file[0] != '_') {
if(post_notification_is_profile(POST_NOTIFICATION_DATA . $file)){
$profile_list[] = $file;
}
}
}
closedir($dir_handle);
} else {
echo '
' . __('Please save own Profiles in: ', 'post_notification') .' '. POST_NOTIFICATION_DATA . ' ';
echo __('Otherwise they may be deleted using autoupdate. ', 'post_notification') . '