'. __('File missing in profile folder.', 'post_notification') . '
'; echo __('Folder', 'post_notification') . ': ' . $path . '
'; echo __('File', 'post_notification') . ': ' . $file. ''; return false; } return true; } function post_notification_check_string($path, $string){ require($path . '/strings.php'); if(!array_key_exists($string, $post_notification_strings)){ echo '
'. __('Missing string in string file.', 'post_notification') .'
'; echo __('File', 'post_notification') . ': ' . $path . '/strings.php
'; echo __('String', 'post_notification') . ': ' . $string . '
'; return false; } return true; } function post_notification_is_profile($path){ if(!( post_notification_is_file($path , 'confirm.tmpl') && post_notification_is_file($path , 'reg_success.tmpl') && post_notification_is_file($path , 'select.tmpl') && post_notification_is_file($path , 'subscribe.tmpl') && post_notification_is_file($path , 'unsubscribe.tmpl') && post_notification_is_file($path , 'strings.php'))) return false; if(!( post_notification_check_string($path, 'error') && post_notification_check_string($path, 'already_subscribed') && post_notification_check_string($path, 'activation_faild') && post_notification_check_string($path, 'address_not_in_database') && post_notification_check_string($path, 'sign_up_again') && post_notification_check_string($path, 'deaktivated') && post_notification_check_string($path, 'no_longer_activated') && post_notification_check_string($path, 'check_email') && post_notification_check_string($path, 'wrong_captcha') && post_notification_check_string($path, 'all') && post_notification_check_string($path, 'saved') )) return false; return true; } function post_notification_select($var, $comp){ if(get_option('post_notification_' . $var) == $comp) return ' selected="selected" '; else return ''; } function post_notification_select_yesno($var){ echo ''; } function post_notification_admin_sub(){ echo '

' . __('Settings', 'post_notification') . '

'; if ($_POST['updateSettings']){ if(!isset($_POST['the_content'])) $_POST['the_content'] = array(); //simple things first update_option('post_notification_read_more', $_POST['read_more']); update_option('post_notification_show_content', $_POST['show_content']); update_option('post_notification_send_default', $_POST['send_default']); update_option('post_notification_send_private', $_POST['send_private']); update_option('post_notification_send_page', $_POST['send_page']); update_option('post_notification_subject', $_POST['subject']); update_option('post_notification_from_name', $_POST['from_name']); update_option('post_notification_from_email', $_POST['from_email']); update_option('post_notification_page_name', $_POST['page_name']); update_option('post_notification_url', $_POST['pn_url']); update_option('post_notification_page_meta', $_POST['page_meta']); update_option('post_notification_filter_include', $_POST['filter_include']); update_option('post_notification_uninstall',$_POST['uninstall']); update_option('post_notification_debug',$_POST['debug']); update_option('post_notification_lock', $_POST['lock']); update_option('post_notification_the_content_exclude', serialize($_POST['the_content'])); update_option('post_notification_empty_cats', $_POST['empty_cats']); update_option('post_notification_show_cats', $_POST['show_cats']); update_option('post_notification_sendcheck', $_POST['sendcheck']); update_option('post_notification_saved_tmpl', $_POST['saved_tmpl']); update_option('post_notification_auto_subscribe', $_POST['auto_subscribe']); $p_captcha = $_POST['captcha']; if(is_numeric($p_captcha)){ if($p_captcha >= 0){ update_option('post_notification_captcha', $p_captcha ); } else { echo '
' . __('Number of captcha-chars must be 0 or greater.', 'post_notification') . '
'; } } else { echo '
' . __('Number of captcha-chars must be a number.', 'post_notification') . '
'; } $p_pause = $_POST['pause']; if(is_numeric($p_pause)){ if($p_pause >= 0){ update_option('post_notification_pause', $p_pause ); } else { echo '
' . __('Pause must be zero or greater.', 'post_notification') . '
'; } } else { echo '
' . __('Pause must be a number.', 'post_notification') . '
'; } $p_nervous = $_POST['nervous']; if(is_numeric($p_nervous)){ if($p_nervous >= 0){ update_option('post_notification_nervous', $p_nervous); } else { echo '
' . __('Nervous Finger must be zero or greater.', 'post_notification') . '
'; } } else { echo '
' . __('Nervous Finger must be a number.', 'post_notification') . '
'; } $p_maxmail = $_POST['maxmails']; if(is_numeric($p_maxmail)){ if($p_maxmail > 0){ update_option('post_notification_maxsend', $p_maxmail ); } else { echo '
' . __('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') . '
'; } $dir_handle=opendir(POST_NOTIFICATION_PATH); while (false !== ($file = readdir ($dir_handle))) { if(is_dir(POST_NOTIFICATION_PATH . $file) && $file[0] != '.' && $file[0] != '_') { if(post_notification_is_profile(POST_NOTIFICATION_PATH . $file)){ if(!in_array($file, $profile_list)) $profile_list[] = $file; } } } closedir($dir_handle); foreach($profile_list as $profile_list_el){ $en_profiles .= "