Index: admin/tdomf-edit-form.php =================================================================== --- admin/tdomf-edit-form.php (revision 169181) +++ admin/tdomf-edit-form.php (working copy) @@ -1,31 +1,32 @@ - +>>>>>>> .r169181 \ No newline at end of file Index: admin/tdomf-edit-post-panel.php =================================================================== --- admin/tdomf-edit-post-panel.php (revision 169181) +++ admin/tdomf-edit-post-panel.php (working copy) @@ -1,38 +1,38 @@ -users "; - $query .= "ORDER BY ID DESC"; - return $wpdb->get_results( $query ); -} - -// Grab a list of user ids of all users, to use in the drop-down menu -// -function tdomf_get_all_users_count() { - global $wpdb; - $query = "SELECT count(ID) "; - $query .= "FROM $wpdb->users "; - $query .= "ORDER BY ID DESC"; - return intval($wpdb->get_var( $query )); -} - -// Add the sidebar panel -// +users "; + $query .= "ORDER BY ID DESC"; + return $wpdb->get_results( $query ); +} + +// Grab a list of user ids of all users, to use in the drop-down menu +// +function tdomf_get_all_users_count() { + global $wpdb; + $query = "SELECT count(ID) "; + $query .= "FROM $wpdb->users "; + $query .= "ORDER BY ID DESC"; + return intval($wpdb->get_var( $query )); +} + +// Add the sidebar panel +// function tdomf_edit_post_panel_admin_head() { global $post; // don't show on new post/page - if($post->ID > 0) { + if(is_object($post) && $post->ID > 0) { $edit_count = tdomf_get_edits(array('post_id' => $post->ID, 'count' => true)); // Wordpress 2.5 introduced add_meta_box if(function_exists('add_meta_box')) { @@ -143,286 +143,286 @@ } -// -// Show the Edit Post Panel -// -function tdomf_show_edit_post_panel() { - global $post; - - // don't show on new post - if($post->ID > 0) { - - $can_edit = false; - if(current_user_can('publish_posts')) { - $can_edit = true; - } - - $is_tdomf = false; - $tdomf_flag = get_post_meta($post->ID, TDOMF_KEY_FLAG, true); - if(!empty($tdomf_flag)) { - $is_tdomf = true; - } - - $locked = get_post_meta($post->ID, TDOMF_KEY_LOCK, true); - - $submitter_id = get_post_meta($post->ID, TDOMF_KEY_USER_ID, true); - - $submitter_ip = get_post_meta($post->ID, TDOMF_KEY_IP, true); - - $form_id = get_post_meta($post->ID, TDOMF_KEY_FORM_ID, true); - - $is_spam = (get_option(TDOMF_OPTION_SPAM) && get_post_meta($post->ID, TDOMF_KEY_SPAM, true)); - - // use JavaScript SACK library for AJAX - wp_print_scripts( array( 'sack' )); - - // I could stick this AJAX call into the Admin header, however, I don't want - // it hanging around on every admin page and potentially being called - // accidentially from some other TDOMF page -?> - - - -
-

-
- -
- - - checked disabled onClick="tdomf_update_panel();" /> - - - -
- - checked disabled onClick="tdomf_update_panel();" /> - - -

- - - -

- - - - - -

- - - - - user_login; - } - ?> - disabled /> - - -

- - - - -

- - - -
- -

" onclick="tdomf_ajax_edit_post(this.form.tdomf_flag, tdomf_submitter_is_user, tdomf_submitter_user, tdomf_submitter_name, tdomf_submitter_email, tdomf_submitter_web, this.form.tdomf_locked);" /> - - -

-
- - -ID; - } else { - die("alert('".sprintf(__("TDOMF: The user %s is not a valid user and cannot be used for Submitter","tdomf"),$user_id)."')"); - } - } - delete_post_meta($post_id, TDOMF_KEY_USER_ID); - add_post_meta($post_id, TDOMF_KEY_USER_ID, $user_id, true); - tdomf_log_message("Submitter info for post $post_id added"); - die("alert('".sprintf(__('TDOMF: TDO Mini Forms info for post %d updated','tdomf'),$post_id)."')"); - } else { - // do this so that we *know* that submitter user is not used - delete_post_meta($post_id, TDOMF_KEY_USER_ID); - $name = $_POST["tdomf_name"]; - delete_post_meta($post_id, TDOMF_KEY_NAME); - add_post_meta($post_id, TDOMF_KEY_NAME, $name, true); - $email = $_POST["tdomf_email"]; - delete_post_meta($post_id, TDOMF_KEY_EMAIL); - add_post_meta($post_id, TDOMF_KEY_EMAIL, $email, true); - $web = $_POST["tdomf_web"]; - delete_post_meta($post_id, TDOMF_KEY_WEB); - add_post_meta($post_id, TDOMF_KEY_WEB, $web, true); - tdomf_log_message("Submitter info for post $post_id added"); - die("alert('".sprintf(__('TDOMF: TDO Mini Forms info for post %d updated','tdomf'),$post_id)."')"); - } - } - tdomf_log_message("Error captured in EditPostPanel:tdomf_save_post"); - die("alert('')"); -} - -?> +// +// Show the Edit Post Panel +// +function tdomf_show_edit_post_panel() { + global $post; + + // don't show on new post + if($post->ID > 0) { + + $can_edit = false; + if(current_user_can('publish_posts')) { + $can_edit = true; + } + + $is_tdomf = false; + $tdomf_flag = get_post_meta($post->ID, TDOMF_KEY_FLAG, true); + if(!empty($tdomf_flag)) { + $is_tdomf = true; + } + + $locked = get_post_meta($post->ID, TDOMF_KEY_LOCK, true); + + $submitter_id = get_post_meta($post->ID, TDOMF_KEY_USER_ID, true); + + $submitter_ip = get_post_meta($post->ID, TDOMF_KEY_IP, true); + + $form_id = get_post_meta($post->ID, TDOMF_KEY_FORM_ID, true); + + $is_spam = (get_option(TDOMF_OPTION_SPAM) && get_post_meta($post->ID, TDOMF_KEY_SPAM, true)); + + // use JavaScript SACK library for AJAX + wp_print_scripts( array( 'sack' )); + + // I could stick this AJAX call into the Admin header, however, I don't want + // it hanging around on every admin page and potentially being called + // accidentially from some other TDOMF page +?> + + + +
+

+
+ +
+ + + checked disabled onClick="tdomf_update_panel();" /> + + + +
+ + checked disabled onClick="tdomf_update_panel();" /> + + +

+ + + +

+ + + + + +

+ + + + + user_login; + } + ?> + disabled /> + + +

+ + + + +

+ + + +
+ +

" onclick="tdomf_ajax_edit_post(this.form.tdomf_flag, tdomf_submitter_is_user, tdomf_submitter_user, tdomf_submitter_name, tdomf_submitter_email, tdomf_submitter_web, this.form.tdomf_locked);" /> + + +

+
+ + +ID; + } else { + die("alert('".sprintf(__("TDOMF: The user %s is not a valid user and cannot be used for Submitter","tdomf"),$user_id)."')"); + } + } + delete_post_meta($post_id, TDOMF_KEY_USER_ID); + add_post_meta($post_id, TDOMF_KEY_USER_ID, $user_id, true); + tdomf_log_message("Submitter info for post $post_id added"); + die("alert('".sprintf(__('TDOMF: TDO Mini Forms info for post %d updated','tdomf'),$post_id)."')"); + } else { + // do this so that we *know* that submitter user is not used + delete_post_meta($post_id, TDOMF_KEY_USER_ID); + $name = $_POST["tdomf_name"]; + delete_post_meta($post_id, TDOMF_KEY_NAME); + add_post_meta($post_id, TDOMF_KEY_NAME, $name, true); + $email = $_POST["tdomf_email"]; + delete_post_meta($post_id, TDOMF_KEY_EMAIL); + add_post_meta($post_id, TDOMF_KEY_EMAIL, $email, true); + $web = $_POST["tdomf_web"]; + delete_post_meta($post_id, TDOMF_KEY_WEB); + add_post_meta($post_id, TDOMF_KEY_WEB, $web, true); + tdomf_log_message("Submitter info for post $post_id added"); + die("alert('".sprintf(__('TDOMF: TDO Mini Forms info for post %d updated','tdomf'),$post_id)."')"); + } + } + tdomf_log_message("Error captured in EditPostPanel:tdomf_save_post"); + die("alert('')"); +} + +?> Index: admin/tdomf-form-options.php =================================================================== --- admin/tdomf-form-options.php (revision 169181) +++ admin/tdomf-form-options.php (working copy) @@ -1,1585 +1,1585 @@ - - - - - - - role_objects as $key => $role) { - foreach($role->capabilities as $cap => $grant) { - $capnames[$cap] = $cap; - //$this->debug('grant', ($role->capabilities)); - } - } - - $capnames = apply_filters('capabilities_list', $capnames); - if(!is_array($capnames)) $capnames = array(); - $capnames = array_unique($capnames); - sort($capnames); - - //Filter out the level_x caps, they're obsolete - $capnames = array_diff($capnames, array('level_0', 'level_1', 'level_2', 'level_3', 'level_4', 'level_5', - 'level_6', 'level_7', 'level_8', 'level_9', 'level_10')); - - //Filter out roles - foreach ($wp_roles->get_names() as $role) { - $key = array_search($role, $capnames); - if ($key !== false && $key !== null) { //array_search() returns null if not found in 4.1 - unset($capnames[$key]); - } - } - - // this cap is used seperately - unset($capnames['publish_post']); - - // filter out tdomf caps that were added - foreach($capnames as $key => $cap) { - if(substr($cap,TDOMF_CAPABILITY_CAN_SEE_FORM,strlen(TDOMF_CAPABILITY_CAN_SEE_FORM)) == TDOMF_CAPABILITY_CAN_SEE_FORM) { - unset($capnames[$key]); - } - } - - return $capnames; - } - -function tdomf_show_form_options($form_id) { - global $wp_version; - if(!tdomf_form_exists($form_id)) { ?> -
- - - - - -
- -

- - - - - - -

- - - -

- - -
- -
- - - - -
-
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
- -
- - -

- - -

- - -

- - -

- - - - - - - - - -

- - onChange="tdomf_enable_new();" > - onChange="tdomf_enable_edit();" > - onChange="tdomf_enable_use_type_posts();" > - onChange="tdomf_enable_use_type_posts();" > -

- -

-

- -

- - > - -
- - - - > - -
- - - - > - -

- - -

- - -

- - -

- - -

- -
- -
- -

- - role_objects; - $access_roles = array(); - $publish_roles = array(); - foreach($roles as $role) { - if(!isset($role->capabilities['publish_posts'])) { - if($role->name != get_option('default_role')) { - array_push($access_roles,$role->name); - } else { - $def_role = $role->name; - } - } else { - array_push($publish_roles,$role->name); - } - } - rsort($access_roles); - rsort($publish_roles); - - $caps = tdomf_get_all_caps(); - - $can_reg = get_option('users_can_register'); - - ?> - - - - - -

- - - -
- - - - /> - - -
- - - - checked - onClick="tdomf_publish_user();" /> - - -

- -
-
    -
  • -
  • -
  • -
- -
-

- -

- -
- - - -
- - - -
- -

-
- -
-

- - - -

- - role_objects[$def_role]->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id]) && $can_reg) { ?> checked disabled - checked - checked disabled /> -
- -

- -
- -
- - user_login; - } - sort($tdomf_access_users_list); - $tdomf_access_users_list = join(' ', $tdomf_access_users_list); - } ?> - -

- - - checked disabled /> - /> - -
- -
- -

- - - - - -

- -
- -
- - -

- - -

- -

- -

- - - > - - - -

- - -

- -
- -
- -

- - checked > - - -
- - - - - checked > - - -

- - - - disabled /> - -

- - - checked > - -
- - - - checked > - -
- - checked> - -
- - - checked> - -
- - checked> - -
- value="" value="http://" /> - -

- -

- -

- - - - checked> - -
- - checked> - -
- - - checked> - -
- - checked> - -
- value="" value="http://" /> - -
- -

- -
- -
- - - -

- > - -

- -

- - - checked /> - - - - > - - - - > - - -

- -

-

- - - - capabilities['edit_others_posts']) - && isset($role->capabilities['publish_posts'])) { ?> - name,$notify_roles)) { ?>checked /> - - -
- - - - -

- - -
- -
- -

- -

- - - Only %s submissions/contributions per - %s - %s(optionally) per %s Seconds (1 hour = 3600 seconds) - %s - - ","tdomf"), - ' - ', - ''.__("registered user","tdomf").'
- '.__("IP","tdomf"), - '', - '', - ''); ?> - - - -

-

    - $throttle_rule) { - $option_string = ""; - if($throttle_rule['opt1']) { - $option_string = sprintf(__("per %s Seconds","tdomf"),$throttle_rule['time']); - } - ?> -
  • - - »"> -
  • - -
-

- - -

- - -
- -
- - - -
- -
- - - - - - - -
- - »" /> - - -
- -
-
- -
- - -
- - - form_id == $form_id_in) { ?> - - - - - form_id); ?>form_id == $form_id_in) { ?> - | - - - - "> - - - - -
- -
- - "> - | - "> - | - - | - | - - - " > | - - - - " > - - " > - - - -
- - - - - -
- -
- "> - - - "> - - - "> - -
- - - -
-
- - form_id == $form_id_in) { ?> - - form_id); ?> - - form_id); ?> - - -
- -
- - -
-
- - - - - - - "[tdomf_form$form_id]", - "post_title" => $form_name, - "post_author" => $current_user->ID, - "post_status" => 'publish', - "post_type" => "page" - ); - $post_ID = wp_insert_post($post); - - $pages = tdomf_get_option_form(TDOMF_OPTION_CREATEDPAGES,$form_id); - if($pages == false) { - $pages = array( $post_ID ); - } else { - $pages = array_merge( $pages, array( $post_ID ) ); - } - tdomf_set_option_form(TDOMF_OPTION_CREATEDPAGES,$pages,$form_id); - - return $post_ID; - } - - return false; -} - -// Handle actions for this form -// -function tdomf_handle_form_options_actions() { - global $wpdb, $wp_roles; - - $message = ""; - $retValue = false; - - if(!isset($wp_roles)) { - $wp_roles = new WP_Roles(); - } - $roles = $wp_roles->role_objects; - $caps = tdomf_get_all_caps(); - - $remove_throttle_rule = false; - $rule_id = 0; - if(isset($_REQUEST['tdomf_form_id'])) { - $form_id = intval($_REQUEST['tdomf_form_id']); - $rules = tdomf_get_option_form(TDOMF_OPTION_THROTTLE_RULES,$form_id); - if(is_array($rules)) { - foreach($rules as $id => $r) { - if(isset($_REQUEST["tdomf_remove_throttle_rule_$id"])) { - $remove_throttle_rule = true; - $rule_id = $id; - break; - } - } - } - } - - if($remove_throttle_rule) { - check_admin_referer('tdomf-options-save'); - - unset($rules[$rule_id]); - tdomf_set_option_form(TDOMF_OPTION_THROTTLE_RULES,$rules,$form_id); - - $message .= "Throttle rule removed!
"; - tdomf_log_message("Removed throttle rule"); - - } else if(isset($_REQUEST['tdomf_add_throttle_rule'])) { - - check_admin_referer('tdomf-options-save'); - - $form_id = intval($_REQUEST['tdomf_form_id']); - - $rule = array(); - $rule['sub_type'] = $_REQUEST['tdomf_throttle_rule_sub_type']; - $rule['count'] = $_REQUEST['tdomf_throttle_rule_count']; - $rule['type'] = $_REQUEST['tdomf_throttle_rule_user_type']; - $rule['opt1'] = isset($_REQUEST['tdomf_throttle_rule_opt1']); - $rule['time'] = intval($_REQUEST['tdomf_throttle_rule_time']); - - $rules = tdomf_get_option_form(TDOMF_OPTION_THROTTLE_RULES,$form_id); - if(!is_array($rules)) { $rules = array(); } - $rules[] = $rule; - tdomf_set_option_form(TDOMF_OPTION_THROTTLE_RULES,$rules,$form_id); - - $message .= "Throttle rule added!
"; - tdomf_log_message("Added a new throttle rule: " . var_export($rule,true)); - - } else if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'create_form_page') { - check_admin_referer('tdomf-create-form-page'); - $form_id = intval($_REQUEST['form']); - $page_id = tdomf_create_form_page($form_id); - $message = sprintf(__("A page with the form has been created. View page »
","tdomf"),get_permalink($page_id)); - } else if(isset($_REQUEST['save_settings']) && isset($_REQUEST['tdomf_form_id'])) { - - check_admin_referer('tdomf-options-save'); - - $form_id = intval($_REQUEST['tdomf_form_id']); - - // Edit or Submit - - $edit_form = false; - if(isset($_REQUEST['tdomf_mode']) && $_REQUEST['tdomf_mode'] == "edit") { - $edit_form = true; - } - tdomf_set_option_form(TDOMF_OPTION_FORM_EDIT,$edit_form,$form_id); - - // Allow pages with forms to be editted - - $edit_page_form = isset($_REQUEST['tdomf_edit_page_form']); - tdomf_set_option_form(TDOMF_OPTION_EDIT_PAGE_FORM,$edit_page_form,$form_id); - - // Allow authors to edit - - $author_edit = false; - if(isset($_REQUEST['tdomf_author_edit'])) { - $author_edit = true; - } - tdomf_set_option_form(TDOMF_OPTION_ALLOW_AUTHOR,$author_edit,$form_id); - - // Edit post within X seconds of being published - - $time_edit = false; - if(isset($_REQUEST['tdomf_time_edit'])) { - $time_edit = intval($_REQUEST['tdomf_time_edit']); - if($time_edit <= 0){ $time_edit = false; } - } - tdomf_set_option_form(TDOMF_OPTION_ALLOW_TIME,$time_edit,$form_id); - - // Who can access the form? - - if(isset($_REQUEST['tdomf_special_access_anyone']) && tdomf_get_option_form(TDOMF_OPTION_ALLOW_EVERYONE,$form_id) == false) { - tdomf_set_option_form(TDOMF_OPTION_ALLOW_EVERYONE,true,$form_id); - - foreach($roles as $role) { - // remove cap as it's not needed - if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id])){ - $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id); - } - } - - tdomf_set_option_form(TDOMF_OPTION_ALLOW_CAPS,array(),$form_id); - - } else if(!isset($_REQUEST['tdomf_special_access_anyone'])){ - - tdomf_set_option_form(TDOMF_OPTION_ALLOW_EVERYONE,false,$form_id); - - // add cap to right roles - foreach($roles as $role) { - if(isset($_REQUEST["tdomf_access_".$role->name])){ - $role->add_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id); - } else if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id])){ - $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id); - } - } - - // list caps that can access form - $allow_caps = array(); - foreach($caps as $cap) { - if(isset($_REQUEST['tdomf_access_caps_'.$cap])){ - $allow_caps[] = $cap; - } - } - tdomf_set_option_form(TDOMF_OPTION_ALLOW_CAPS,$allow_caps,$form_id); - - // convert user names to ids - $allow_users = array(); - if(isset($_REQUEST['tdomf_access_users_list'])) { - $user_names = trim($_REQUEST['tdomf_access_users_list']); - if(!empty($user_names)) { - $user_names = split(' ',$user_names); - foreach($user_names as $user_name) { - if(!empty($user_name)) { - if(($userdata = get_userdatabylogin($user_name)) != false) { - $allow_users[] = $userdata->ID; - } else { - $message .= "".sprintf(__("$user_name is not a valid user name. Ignoring.
","tdomf"),$form_id)."
"; - tdomf_log_message("User login $user_name is not recognised by wordpress. Ignoring.",TDOMF_LOG_BAD); - } - } - } - } - } - tdomf_set_option_form(TDOMF_OPTION_ALLOW_USERS,$allow_users,$form_id); - } - - tdomf_set_option_form(TDOMF_OPTION_ALLOW_PUBLISH,isset($_REQUEST['tdomf_user_publish_override']),$form_id); - - // Who gets notified? - - $notify_roles = ""; - foreach($roles as $role) { - if(isset($_REQUEST["tdomf_notify_".$role->name])){ - $notify_roles .= $role->name.";"; - } - } - if(!empty($notify_roles)) { - tdomf_set_option_form(TDOMF_NOTIFY_ROLES,$notify_roles,$form_id); - } else { - tdomf_set_option_form(TDOMF_NOTIFY_ROLES,false,$form_id); - } - - $save = true; - $tdomf_admin_emails = $_POST['tdomf_admin_emails']; - $emails = split(',',$tdomf_admin_emails); - foreach($emails as $email) { - if(!empty($email)) { - if(!tdomf_check_email_address($email)) { - $message .= "".sprintf(__("The email %s is not valid! Please update 'Who Gets Notified' with valid email addresses.","tdomf"),$email)."
"; - $save = false; - break; - } - } - } - if($save) { tdomf_set_option_form(TDOMF_OPTION_ADMIN_EMAILS,$tdomf_admin_emails,$form_id); } - - // Default Category - - $def_cat = $_POST['tdomf_def_cat']; - tdomf_set_option_form(TDOMF_DEFAULT_CATEGORY,$def_cat,$form_id); - - // Restrict editing to posts submitted by tdomf - - $edit_restrict_tdomf = isset($_REQUEST['tdomf_edit_tdomf_only']); - tdomf_set_option_form(TDOMF_OPTION_EDIT_RESTRICT_TDOMF,$edit_restrict_tdomf,$form_id); - - $edit_restrict_cats = explode(',',trim($_REQUEST['tdomf_edit_cats'])); - if(!empty($edit_restrict_cats)) { - $cats = array(); - foreach($edit_restrict_cats as $cat) { - $cat = intval(trim($cat)); - if($cat > 0) { $cats[] = $cat; } - } - $edit_restrict_cats = $cats; - } else { - $edit_restrict_cats = array(); - } - tdomf_set_option_form(TDOMF_OPTION_EDIT_RESTRICT_CATS,$edit_restrict_cats,$form_id); - - // add edit link - - $add_edit_link = $_REQUEST['tdomf_add_edit_link']; - if($add_edit_link == 'custom') { - $add_edit_link = $_REQUEST['tdomf_add_edit_link_custom_url']; - } - tdomf_set_option_form(TDOMF_OPTION_ADD_EDIT_LINK,$add_edit_link,$form_id); - - $ajax_edit = isset($_REQUEST['tdomf_ajax_edit']); - tdomf_set_option_form(TDOMF_OPTION_AJAX_EDIT,$ajax_edit,$form_id); - - // auto modify edit link - - $auto_edit_link = $_REQUEST['tdomf_auto_edit_link']; - if($auto_edit_link == 'custom') { - $auto_edit_link = $_REQUEST['tdomf_auto_edit_link_custom_url']; - } - tdomf_set_option_form(TDOMF_OPTION_AUTO_EDIT_LINK,$auto_edit_link,$form_id); - - //Turn On/Off Moderation - - $mod = false; - if(isset($_POST['tdomf_moderation'])) { $mod = true; } - tdomf_set_option_form(TDOMF_OPTION_MODERATION,$mod,$form_id); - - $tdomf_redirect = isset($_POST['tdomf_redirect']); - tdomf_set_option_form(TDOMF_OPTION_REDIRECT,$tdomf_redirect,$form_id); - - //Preview - - $preview = false; - if(isset($_POST['tdomf_preview'])) { $preview = true; } - tdomf_set_option_form(TDOMF_OPTION_PREVIEW,$preview,$form_id); - - //From email - - if(trim($_POST['tdomf_from_email']) == "") { - tdomf_set_option_form(TDOMF_OPTION_FROM_EMAIL,false,$form_id); - } else { - tdomf_set_option_form(TDOMF_OPTION_FROM_EMAIL,$_POST['tdomf_from_email'],$form_id); - } - - // Form name - - if(trim($_POST['tdomf_form_name']) == "") { - tdomf_set_option_form(TDOMF_OPTION_NAME,"",$form_id); - } else { - tdomf_set_option_form(TDOMF_OPTION_NAME,strip_tags($_POST['tdomf_form_name']),$form_id); - } - - // Form description - - if(trim($_POST['tdomf_form_descp']) == "") { - tdomf_set_option_form(TDOMF_OPTION_DESCRIPTION,false,$form_id); - } else { - tdomf_set_option_form(TDOMF_OPTION_DESCRIPTION,$_POST['tdomf_form_descp'],$form_id); - } - - // Include on "your submissions" page - // - $include = false; - if(isset($_POST['tdomf_include_sub'])) { $include = true; } - tdomf_set_option_form(TDOMF_OPTION_INCLUDED_YOUR_SUBMISSIONS,$include,$form_id); - - if(get_option(TDOMF_OPTION_YOUR_SUBMISSIONS) && $include) { - $message .= sprintf(__("Saved Options for Form %d. See your form »","tdomf"),$form_id,"users.php?page=tdomf_your_submissions#tdomf_form%d")."
"; - } else { - $message .= sprintf(__("Saved Options for Form %d.","tdomf"),$form_id)."
"; - } - - // widget count - // - $widget_count = 10; - if(isset($_POST['tdomf_widget_count'])) { $widget_count = intval($_POST['tdomf_widget_count']); } - if($widget_count < 1){ $widget_count = 1; } - tdomf_set_option_form(TDOMF_OPTION_WIDGET_INSTANCES,$widget_count,$form_id); - - //Submit page instead of post - // - $use_page = false; - if(isset($_POST['tdomf_use_type']) && $_POST['tdomf_use_type'] == 'page') { $use_page = true; } - tdomf_set_option_form(TDOMF_OPTION_SUBMIT_PAGE,$use_page,$form_id); - - // Queue period - // - $tdomf_queue_period = intval($_POST['tdomf_queue_period']); - tdomf_set_option_form(TDOMF_OPTION_QUEUE_PERIOD,$tdomf_queue_period,$form_id); - - // Queue on all - // - $tdomf_queue_on_all = isset($_POST['tdomf_queue_on_all']); - tdomf_set_option_form(TDOMF_OPTION_QUEUE_ON_ALL,$tdomf_queue_on_all,$form_id); - - // ajax - // - $tdomf_ajax = isset($_POST['tdomf_ajax']); - tdomf_set_option_form(TDOMF_OPTION_AJAX,$tdomf_ajax,$form_id); - - // Send moderation email even for published posts - // - $tdomf_mod_email_on_pub = isset($_POST['tdomf_mod_email_on_pub']); - tdomf_set_option_form(TDOMF_OPTION_MOD_EMAIL_ON_PUB,$tdomf_mod_email_on_pub,$form_id); - - // Admin users auto-publish? - // - $tdomf_publish_no_mod = isset($_POST['tdomf_user_publish_auto']); - tdomf_set_option_form(TDOMF_OPTION_PUBLISH_NO_MOD,$tdomf_publish_no_mod,$form_id); - - // Spam - // - $message .= tdomf_handle_spam_options_actions($form_id); - - tdomf_log_message("Options Saved for Form ID $form_id"); - - } else if(isset($_REQUEST['delete'])) { - - $form_id = intval($_REQUEST['delete']); - - check_admin_referer('tdomf-delete-form-'.$form_id); - - if(tdomf_form_exists($form_id)) { - $count_forms = count(tdomf_get_form_ids()); - if($count_forms > 1) { - if(tdomf_delete_form($form_id)) { - $message .= sprintf(__("Form %d deleted.
","tdomf"),$form_id); - } else { - $message .= sprintf(__("Could not delete Form %d!
","tdomf"),$form_id); - } - } else { - $message .= sprintf(__("You cannot delete the last form! There must be at least one form in the system.
","tdomf"),$form_id); - } - } else { - $message .= sprintf(__("Form %d is not valid!
","tdomf"),$form_id); - } - } else if(isset($_REQUEST['copy'])) { - - $form_id = intval($_REQUEST['copy']); - - check_admin_referer('tdomf-copy-form-'.$form_id); - - $copy_form_id = tdomf_copy_form($form_id); - - if($copy_form_id != 0) { - $message .= sprintf(__("Form %d copied with id %d.
","tdomf"),$form_id,$copy_form_id); - $retValue = $copy_form_id; - } else { - $message .= sprintf(__("Failed to copy Form %d!
","tdomf"),$form_id); - } - - } else if(isset($_REQUEST['new'])) { - - check_admin_referer('tdomf-new-form'); - - $form_id = tdomf_create_form(__('New Form','tdomf'),array()); - - if($form_id != 0) { - $message .= sprintf(__("New form created with %d.
","tdomf"),$form_id); - $retValue = $form_id; - } else { - $message .= __("Failed to create new Form!
","tdomf"); - } - } - - // Warnings - - $message .= tdomf_get_error_messages(false); - - if(!empty($message)) { ?> -

- + + + + + + + role_objects as $key => $role) { + foreach($role->capabilities as $cap => $grant) { + $capnames[$cap] = $cap; + //$this->debug('grant', ($role->capabilities)); + } + } + + $capnames = apply_filters('capabilities_list', $capnames); + if(!is_array($capnames)) $capnames = array(); + $capnames = array_unique($capnames); + sort($capnames); + + //Filter out the level_x caps, they're obsolete + $capnames = array_diff($capnames, array('level_0', 'level_1', 'level_2', 'level_3', 'level_4', 'level_5', + 'level_6', 'level_7', 'level_8', 'level_9', 'level_10')); + + //Filter out roles + foreach ($wp_roles->get_names() as $role) { + $key = array_search($role, $capnames); + if ($key !== false && $key !== null) { //array_search() returns null if not found in 4.1 + unset($capnames[$key]); + } + } + + // this cap is used seperately + unset($capnames['publish_post']); + + // filter out tdomf caps that were added + foreach($capnames as $key => $cap) { + if(substr($cap,TDOMF_CAPABILITY_CAN_SEE_FORM,strlen(TDOMF_CAPABILITY_CAN_SEE_FORM)) == TDOMF_CAPABILITY_CAN_SEE_FORM) { + unset($capnames[$key]); + } + } + + return $capnames; + } + +function tdomf_show_form_options($form_id) { + global $wp_version; + if(!tdomf_form_exists($form_id)) { ?> +
+ + + + + +
+ +

+ + + + + + +

+ + + +

+ + +
+ +
+ + + + +
+
    +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
+ +
+ + +

+ + +

+ + +

+ + +

+ + + + + + + + + +

+ + onChange="tdomf_enable_new();" > + onChange="tdomf_enable_edit();" > + onChange="tdomf_enable_use_type_posts();" > + onChange="tdomf_enable_use_type_posts();" > +

+ +

+

+ +

+ + > + +
+ + + + > + +
+ + + + > + +

+ + +

+ + +

+ + +

+ + +

+ +
+ +
+ +

+ + role_objects; + $access_roles = array(); + $publish_roles = array(); + foreach($roles as $role) { + if(!isset($role->capabilities['publish_posts'])) { + if($role->name != get_option('default_role')) { + array_push($access_roles,$role->name); + } else { + $def_role = $role->name; + } + } else { + array_push($publish_roles,$role->name); + } + } + rsort($access_roles); + rsort($publish_roles); + + $caps = tdomf_get_all_caps(); + + $can_reg = get_option('users_can_register'); + + ?> + + + + + +

+ + + +
+ + + + /> + + +
+ + + + checked + onClick="tdomf_publish_user();" /> + + +

+ +
+
    +
  • +
  • +
  • +
+ +
+

+ +

+ +
+ + + +
+ + + +
+ +

+
+ +
+

+ + + +

+ + role_objects[$def_role]->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id]) && $can_reg) { ?> checked disabled + checked + checked disabled /> +
+ +

+ +
+ +
+ + user_login; + } + sort($tdomf_access_users_list); + $tdomf_access_users_list = join(' ', $tdomf_access_users_list); + } ?> + +

+ + + checked disabled /> + /> + +
+ +
+ +

+ + + + + +

+ +
+ +
+ + +

+ + +

+ +

+ +

+ + + > + + + +

+ + +

+ +
+ +
+ +

+ + checked > + + +
+ + + + + checked > + + +

+ + + + disabled /> + +

+ + + checked > + +
+ + + + checked > + +
+ + checked> + +
+ + + checked> + +
+ + checked> + +
+ value="" value="http://" /> + +

+ +

+ +

+ + + + checked> + +
+ + checked> + +
+ + + checked> + +
+ + checked> + +
+ value="" value="http://" /> + +
+ +

+ +
+ +
+ + + +

+ > + +

+ +

+ + + checked /> + + + + > + + + + > + + +

+ +

+

+ + + + capabilities['edit_others_posts']) + && isset($role->capabilities['publish_posts'])) { ?> + name,$notify_roles)) { ?>checked /> + + +
+ + + + +

+ + +
+ +
+ +

+ +

+ + + Only %s submissions/contributions per + %s + %s(optionally) per %s Seconds (1 hour = 3600 seconds) + %s + + ","tdomf"), + ' + ', + ''.__("registered user","tdomf").'
+ '.__("IP","tdomf"), + '', + '', + ''); ?> + + + +

+

    + $throttle_rule) { + $option_string = ""; + if($throttle_rule['opt1']) { + $option_string = sprintf(__("per %s Seconds","tdomf"),$throttle_rule['time']); + } + ?> +
  • + + »"> +
  • + +
+

+ + +

+ + +
+ +
+ + + +
+ +
+ + + + + + + +
+ + »" /> + + +
+ +
+
+ +
+ + +
+ + + form_id == $form_id_in) { ?> + + + + + form_id); ?>form_id == $form_id_in) { ?> + | + + + + "> + + + + +
+ +
+ + "> + | + "> + | + + | + | + + + " > | + + + + " > + + " > + + + +
+ + + + + +
+ +
+ "> + + + "> + + + "> + +
+ + + +
+
+ + form_id == $form_id_in) { ?> + + form_id); ?> + + form_id); ?> + + +
+ +
+ + +
+
+ + + + + + + "[tdomf_form$form_id]", + "post_title" => $form_name, + "post_author" => $current_user->ID, + "post_status" => 'publish', + "post_type" => "page" + ); + $post_ID = wp_insert_post($post); + + $pages = tdomf_get_option_form(TDOMF_OPTION_CREATEDPAGES,$form_id); + if($pages == false) { + $pages = array( $post_ID ); + } else { + $pages = array_merge( $pages, array( $post_ID ) ); + } + tdomf_set_option_form(TDOMF_OPTION_CREATEDPAGES,$pages,$form_id); + + return $post_ID; + } + + return false; +} + +// Handle actions for this form +// +function tdomf_handle_form_options_actions() { + global $wpdb, $wp_roles; + + $message = ""; + $retValue = false; + + if(!isset($wp_roles)) { + $wp_roles = new WP_Roles(); + } + $roles = $wp_roles->role_objects; + $caps = tdomf_get_all_caps(); + + $remove_throttle_rule = false; + $rule_id = 0; + if(isset($_REQUEST['tdomf_form_id'])) { + $form_id = intval($_REQUEST['tdomf_form_id']); + $rules = tdomf_get_option_form(TDOMF_OPTION_THROTTLE_RULES,$form_id); + if(is_array($rules)) { + foreach($rules as $id => $r) { + if(isset($_REQUEST["tdomf_remove_throttle_rule_$id"])) { + $remove_throttle_rule = true; + $rule_id = $id; + break; + } + } + } + } + + if($remove_throttle_rule) { + check_admin_referer('tdomf-options-save'); + + unset($rules[$rule_id]); + tdomf_set_option_form(TDOMF_OPTION_THROTTLE_RULES,$rules,$form_id); + + $message .= "Throttle rule removed!
"; + tdomf_log_message("Removed throttle rule"); + + } else if(isset($_REQUEST['tdomf_add_throttle_rule'])) { + + check_admin_referer('tdomf-options-save'); + + $form_id = intval($_REQUEST['tdomf_form_id']); + + $rule = array(); + $rule['sub_type'] = $_REQUEST['tdomf_throttle_rule_sub_type']; + $rule['count'] = $_REQUEST['tdomf_throttle_rule_count']; + $rule['type'] = $_REQUEST['tdomf_throttle_rule_user_type']; + $rule['opt1'] = isset($_REQUEST['tdomf_throttle_rule_opt1']); + $rule['time'] = intval($_REQUEST['tdomf_throttle_rule_time']); + + $rules = tdomf_get_option_form(TDOMF_OPTION_THROTTLE_RULES,$form_id); + if(!is_array($rules)) { $rules = array(); } + $rules[] = $rule; + tdomf_set_option_form(TDOMF_OPTION_THROTTLE_RULES,$rules,$form_id); + + $message .= "Throttle rule added!
"; + tdomf_log_message("Added a new throttle rule: " . var_export($rule,true)); + + } else if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'create_form_page') { + check_admin_referer('tdomf-create-form-page'); + $form_id = intval($_REQUEST['form']); + $page_id = tdomf_create_form_page($form_id); + $message = sprintf(__("A page with the form has been created. View page »
","tdomf"),get_permalink($page_id)); + } else if(isset($_REQUEST['save_settings']) && isset($_REQUEST['tdomf_form_id'])) { + + check_admin_referer('tdomf-options-save'); + + $form_id = intval($_REQUEST['tdomf_form_id']); + + // Edit or Submit + + $edit_form = false; + if(isset($_REQUEST['tdomf_mode']) && $_REQUEST['tdomf_mode'] == "edit") { + $edit_form = true; + } + tdomf_set_option_form(TDOMF_OPTION_FORM_EDIT,$edit_form,$form_id); + + // Allow pages with forms to be editted + + $edit_page_form = isset($_REQUEST['tdomf_edit_page_form']); + tdomf_set_option_form(TDOMF_OPTION_EDIT_PAGE_FORM,$edit_page_form,$form_id); + + // Allow authors to edit + + $author_edit = false; + if(isset($_REQUEST['tdomf_author_edit'])) { + $author_edit = true; + } + tdomf_set_option_form(TDOMF_OPTION_ALLOW_AUTHOR,$author_edit,$form_id); + + // Edit post within X seconds of being published + + $time_edit = false; + if(isset($_REQUEST['tdomf_time_edit'])) { + $time_edit = intval($_REQUEST['tdomf_time_edit']); + if($time_edit <= 0){ $time_edit = false; } + } + tdomf_set_option_form(TDOMF_OPTION_ALLOW_TIME,$time_edit,$form_id); + + // Who can access the form? + + if(isset($_REQUEST['tdomf_special_access_anyone']) && tdomf_get_option_form(TDOMF_OPTION_ALLOW_EVERYONE,$form_id) == false) { + tdomf_set_option_form(TDOMF_OPTION_ALLOW_EVERYONE,true,$form_id); + + foreach($roles as $role) { + // remove cap as it's not needed + if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id])){ + $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id); + } + } + + tdomf_set_option_form(TDOMF_OPTION_ALLOW_CAPS,array(),$form_id); + + } else if(!isset($_REQUEST['tdomf_special_access_anyone'])){ + + tdomf_set_option_form(TDOMF_OPTION_ALLOW_EVERYONE,false,$form_id); + + // add cap to right roles + foreach($roles as $role) { + if(isset($_REQUEST["tdomf_access_".$role->name])){ + $role->add_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id); + } else if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id])){ + $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$form_id); + } + } + + // list caps that can access form + $allow_caps = array(); + foreach($caps as $cap) { + if(isset($_REQUEST['tdomf_access_caps_'.$cap])){ + $allow_caps[] = $cap; + } + } + tdomf_set_option_form(TDOMF_OPTION_ALLOW_CAPS,$allow_caps,$form_id); + + // convert user names to ids + $allow_users = array(); + if(isset($_REQUEST['tdomf_access_users_list'])) { + $user_names = trim($_REQUEST['tdomf_access_users_list']); + if(!empty($user_names)) { + $user_names = split(' ',$user_names); + foreach($user_names as $user_name) { + if(!empty($user_name)) { + if(($userdata = get_userdatabylogin($user_name)) != false) { + $allow_users[] = $userdata->ID; + } else { + $message .= "".sprintf(__("$user_name is not a valid user name. Ignoring.
","tdomf"),$form_id)."
"; + tdomf_log_message("User login $user_name is not recognised by wordpress. Ignoring.",TDOMF_LOG_BAD); + } + } + } + } + } + tdomf_set_option_form(TDOMF_OPTION_ALLOW_USERS,$allow_users,$form_id); + } + + tdomf_set_option_form(TDOMF_OPTION_ALLOW_PUBLISH,isset($_REQUEST['tdomf_user_publish_override']),$form_id); + + // Who gets notified? + + $notify_roles = ""; + foreach($roles as $role) { + if(isset($_REQUEST["tdomf_notify_".$role->name])){ + $notify_roles .= $role->name.";"; + } + } + if(!empty($notify_roles)) { + tdomf_set_option_form(TDOMF_NOTIFY_ROLES,$notify_roles,$form_id); + } else { + tdomf_set_option_form(TDOMF_NOTIFY_ROLES,false,$form_id); + } + + $save = true; + $tdomf_admin_emails = $_POST['tdomf_admin_emails']; + $emails = split(',',$tdomf_admin_emails); + foreach($emails as $email) { + if(!empty($email)) { + if(!tdomf_check_email_address($email)) { + $message .= "".sprintf(__("The email %s is not valid! Please update 'Who Gets Notified' with valid email addresses.","tdomf"),$email)."
"; + $save = false; + break; + } + } + } + if($save) { tdomf_set_option_form(TDOMF_OPTION_ADMIN_EMAILS,$tdomf_admin_emails,$form_id); } + + // Default Category + + $def_cat = $_POST['tdomf_def_cat']; + tdomf_set_option_form(TDOMF_DEFAULT_CATEGORY,$def_cat,$form_id); + + // Restrict editing to posts submitted by tdomf + + $edit_restrict_tdomf = isset($_REQUEST['tdomf_edit_tdomf_only']); + tdomf_set_option_form(TDOMF_OPTION_EDIT_RESTRICT_TDOMF,$edit_restrict_tdomf,$form_id); + + $edit_restrict_cats = explode(',',trim($_REQUEST['tdomf_edit_cats'])); + if(!empty($edit_restrict_cats)) { + $cats = array(); + foreach($edit_restrict_cats as $cat) { + $cat = intval(trim($cat)); + if($cat > 0) { $cats[] = $cat; } + } + $edit_restrict_cats = $cats; + } else { + $edit_restrict_cats = array(); + } + tdomf_set_option_form(TDOMF_OPTION_EDIT_RESTRICT_CATS,$edit_restrict_cats,$form_id); + + // add edit link + + $add_edit_link = $_REQUEST['tdomf_add_edit_link']; + if($add_edit_link == 'custom') { + $add_edit_link = $_REQUEST['tdomf_add_edit_link_custom_url']; + } + tdomf_set_option_form(TDOMF_OPTION_ADD_EDIT_LINK,$add_edit_link,$form_id); + + $ajax_edit = isset($_REQUEST['tdomf_ajax_edit']); + tdomf_set_option_form(TDOMF_OPTION_AJAX_EDIT,$ajax_edit,$form_id); + + // auto modify edit link + + $auto_edit_link = $_REQUEST['tdomf_auto_edit_link']; + if($auto_edit_link == 'custom') { + $auto_edit_link = $_REQUEST['tdomf_auto_edit_link_custom_url']; + } + tdomf_set_option_form(TDOMF_OPTION_AUTO_EDIT_LINK,$auto_edit_link,$form_id); + + //Turn On/Off Moderation + + $mod = false; + if(isset($_POST['tdomf_moderation'])) { $mod = true; } + tdomf_set_option_form(TDOMF_OPTION_MODERATION,$mod,$form_id); + + $tdomf_redirect = isset($_POST['tdomf_redirect']); + tdomf_set_option_form(TDOMF_OPTION_REDIRECT,$tdomf_redirect,$form_id); + + //Preview + + $preview = false; + if(isset($_POST['tdomf_preview'])) { $preview = true; } + tdomf_set_option_form(TDOMF_OPTION_PREVIEW,$preview,$form_id); + + //From email + + if(trim($_POST['tdomf_from_email']) == "") { + tdomf_set_option_form(TDOMF_OPTION_FROM_EMAIL,false,$form_id); + } else { + tdomf_set_option_form(TDOMF_OPTION_FROM_EMAIL,$_POST['tdomf_from_email'],$form_id); + } + + // Form name + + if(trim($_POST['tdomf_form_name']) == "") { + tdomf_set_option_form(TDOMF_OPTION_NAME,"",$form_id); + } else { + tdomf_set_option_form(TDOMF_OPTION_NAME,strip_tags($_POST['tdomf_form_name']),$form_id); + } + + // Form description + + if(trim($_POST['tdomf_form_descp']) == "") { + tdomf_set_option_form(TDOMF_OPTION_DESCRIPTION,false,$form_id); + } else { + tdomf_set_option_form(TDOMF_OPTION_DESCRIPTION,$_POST['tdomf_form_descp'],$form_id); + } + + // Include on "your submissions" page + // + $include = false; + if(isset($_POST['tdomf_include_sub'])) { $include = true; } + tdomf_set_option_form(TDOMF_OPTION_INCLUDED_YOUR_SUBMISSIONS,$include,$form_id); + + if(get_option(TDOMF_OPTION_YOUR_SUBMISSIONS) && $include) { + $message .= sprintf(__("Saved Options for Form %d. See your form »","tdomf"),$form_id,"users.php?page=tdomf_your_submissions#tdomf_form%d")."
"; + } else { + $message .= sprintf(__("Saved Options for Form %d.","tdomf"),$form_id)."
"; + } + + // widget count + // + $widget_count = 10; + if(isset($_POST['tdomf_widget_count'])) { $widget_count = intval($_POST['tdomf_widget_count']); } + if($widget_count < 1){ $widget_count = 1; } + tdomf_set_option_form(TDOMF_OPTION_WIDGET_INSTANCES,$widget_count,$form_id); + + //Submit page instead of post + // + $use_page = false; + if(isset($_POST['tdomf_use_type']) && $_POST['tdomf_use_type'] == 'page') { $use_page = true; } + tdomf_set_option_form(TDOMF_OPTION_SUBMIT_PAGE,$use_page,$form_id); + + // Queue period + // + $tdomf_queue_period = intval($_POST['tdomf_queue_period']); + tdomf_set_option_form(TDOMF_OPTION_QUEUE_PERIOD,$tdomf_queue_period,$form_id); + + // Queue on all + // + $tdomf_queue_on_all = isset($_POST['tdomf_queue_on_all']); + tdomf_set_option_form(TDOMF_OPTION_QUEUE_ON_ALL,$tdomf_queue_on_all,$form_id); + + // ajax + // + $tdomf_ajax = isset($_POST['tdomf_ajax']); + tdomf_set_option_form(TDOMF_OPTION_AJAX,$tdomf_ajax,$form_id); + + // Send moderation email even for published posts + // + $tdomf_mod_email_on_pub = isset($_POST['tdomf_mod_email_on_pub']); + tdomf_set_option_form(TDOMF_OPTION_MOD_EMAIL_ON_PUB,$tdomf_mod_email_on_pub,$form_id); + + // Admin users auto-publish? + // + $tdomf_publish_no_mod = isset($_POST['tdomf_user_publish_auto']); + tdomf_set_option_form(TDOMF_OPTION_PUBLISH_NO_MOD,$tdomf_publish_no_mod,$form_id); + + // Spam + // + $message .= tdomf_handle_spam_options_actions($form_id); + + tdomf_log_message("Options Saved for Form ID $form_id"); + + } else if(isset($_REQUEST['delete'])) { + + $form_id = intval($_REQUEST['delete']); + + check_admin_referer('tdomf-delete-form-'.$form_id); + + if(tdomf_form_exists($form_id)) { + $count_forms = count(tdomf_get_form_ids()); + if($count_forms > 1) { + if(tdomf_delete_form($form_id)) { + $message .= sprintf(__("Form %d deleted.
","tdomf"),$form_id); + } else { + $message .= sprintf(__("Could not delete Form %d!
","tdomf"),$form_id); + } + } else { + $message .= sprintf(__("You cannot delete the last form! There must be at least one form in the system.
","tdomf"),$form_id); + } + } else { + $message .= sprintf(__("Form %d is not valid!
","tdomf"),$form_id); + } + } else if(isset($_REQUEST['copy'])) { + + $form_id = intval($_REQUEST['copy']); + + check_admin_referer('tdomf-copy-form-'.$form_id); + + $copy_form_id = tdomf_copy_form($form_id); + + if($copy_form_id != 0) { + $message .= sprintf(__("Form %d copied with id %d.
","tdomf"),$form_id,$copy_form_id); + $retValue = $copy_form_id; + } else { + $message .= sprintf(__("Failed to copy Form %d!
","tdomf"),$form_id); + } + + } else if(isset($_REQUEST['new'])) { + + check_admin_referer('tdomf-new-form'); + + $form_id = tdomf_create_form(__('New Form','tdomf'),array()); + + if($form_id != 0) { + $message .= sprintf(__("New form created with %d.
","tdomf"),$form_id); + $retValue = $form_id; + } else { + $message .= __("Failed to create new Form!
","tdomf"); + } + } + + // Warnings + + $message .= tdomf_get_error_messages(false); + + if(!empty($message)) { ?> +

+ Index: admin/tdomf-log.php =================================================================== --- admin/tdomf-log.php (revision 169181) +++ admin/tdomf-log.php (working copy) @@ -1,62 +1,62 @@ - -

- -

- - -
- -

- - - - - - - -
-
- -
-
-
- - - -
-
- -
- -
- -
- - + +

+ +

+ + +
+ +

+ + + + + + + +
+
+ +
+
+
+ + + +
+
+ +
+ +
+ +
+ + Index: admin/tdomf-options.php =================================================================== --- admin/tdomf-options.php (revision 169181) +++ admin/tdomf-options.php (working copy) @@ -1,16 +1,16 @@ - + if(preg_match('/tdomf_show_options_menu/',$_SERVER['REQUEST_URI'])) { ?> - posts "; - $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; - $query .= "WHERE meta_key = '".TDOMF_KEY_FLAG."' "; - $query .= "WHERE post_author = '$def_aut' "; - $query .= "OR post_author = '0' "; - return intval($wpdb->get_var( $query )); - } - return 0; -} - -// Show the page -// -function tdomf_overview_menu() { - global $wpdb,$wp_roles; - - // Initilise the plugin for the first time here. This gets called when you click the TDOMF button in the menu. - // Doing it here means you can delete all the options! - tdomf_init(); - - // get feed_messages - require_once(ABSPATH . WPINC . '/rss.php'); - - if(!isset($wp_roles)) { - $wp_roles = new WP_Roles(); - } - $roles = $wp_roles->role_objects; - -?> -
-

- -
- - -

- - - -

- -

»

- -

- - - - - -

">»

- -
    - - - -
- - - - - 0) { ?> -

">»

- - - - - -

»

- -
    - - - -
- - - -

- - 'unapproved', 'count' => true, 'unique_post_ids' => true)); - $stat_sub_cur = tdomf_get_submitted_posts_count(); - $stat_edit_cur = tdomf_get_edits(array('count' => true, 'unique_post_ids' => true)); - $stat_mod = $stat_sub_cur - $stat_unmod; - $stat_edit_mod = tdomf_get_edits(array('state' => 'approved', 'count' => true, 'unique_post_ids' => true)); - $stat_spam = get_option(TDOMF_STAT_SPAM); ?> - - -

- -

- - - items) && 0 != count($rss->items) ) { - $rss->items = array_slice($rss->items, 0, 5); - echo "

".__('Latest Support Forum Topics','tdomf')."

    "; - foreach ($rss->items as $item) { ?> -
  • '>
  • - "; - } ?> - -
- - ".$message = tdomf_get_error_messages()."

"; ?> - - - - - - -
-
- - - - -
-
- My Amazon Wishlist]","tdomf"),"http://www.amazon.co.uk/gp/registry/23S7OL9W6Q4JT"); ?> - - Rate TDO-Mini-Forms on Wordpress.org!]","tdomf"),"http://wordpress.org/extend/plugins/tdo-mini-forms/#rate-response"); ?> -
- -

- - - -

support forums on thedeadone.net or the support forums on wordpress.org.',"tdomf"); ?>

- -

- -

- -

- -
-

- - items) && 0 != count($rss->items) ) - { - $rss->items = array_slice($rss->items, 0, 4); - foreach ($rss->items as $item) - { - ?> -

'>

-

'.date("F, jS", strtotime($item['pubdate'])).' - '.$item['description']; ?>

- -

thedeadone.net to check for updates.', 'tdomf'), 'http://thedeadone.net/index.php?tag=tdomf') ?>

- -
-
-
- ID, TDOMF_KEY_FORM_ID, true); - $submitter = get_post_meta($p->ID, TDOMF_KEY_NAME, true); - if($form_id == false || !tdomf_form_exists($form_id)) { - if($submitter == false || empty($submitter)) { - return "
  • ".sprintf(__("\"%s\"","tdomf"),get_permalink($p->ID),$p->post_title)."
  • "; - } else { - return "
  • ".sprintf(__("\"%s\" submitted by %s","tdomf"),get_permalink($p->ID),$p->post_title,$submitter)."
  • "; - } - } else if($submitter == false || empty($submitter)) { - return "
  • ".sprintf(__("\"%s\" using form %d","tdomf"),get_permalink($p->ID),$p->post_title, $form_id)."
  • "; - } - return "
  • ".sprintf(__("\"%s\" submitted by %s using form %d","tdomf"),get_permalink($p->ID),$p->post_title,$submitter,$form_id)."
  • "; -} - -function tdomf_dashboard_status() { - - $published_sub_count = tdomf_get_published_posts_count(); - $approved_edits_count = tdomf_get_edits(array('state' => 'approved', 'count' => true)); - $scheduled_sub_count = tdomf_get_queued_posts_count(); - $spam_edits_count = tdomf_get_edits(array('state' => 'spam', 'count' => true, 'unique_post_ids' => true)); - $pending_edits_count = tdomf_get_edits(array('state' => 'unapproved', 'count' => true, 'unique_post_ids' => true)); - $pending_sub_count = tdomf_get_unmoderated_posts_count(); - $spam_sub_count = tdomf_get_spam_posts_count(); - - echo ''; - - $num = number_format_i18n($published_sub_count); - $text = __ngettext( 'Approved Submission', 'Approved Submissions', $published_sub_count ); - $url = tdomf_get_mod_posts_url(array('show' => 'all')); - echo '' . $num . ''; - echo '' . $text . ''; - - $num = number_format_i18n($approved_edits_count); - $text = __ngettext( 'Approved Contribution', 'Approved Contributions', $approved_edits_count ); - $url = tdomf_get_mod_posts_url(array('show' => 'approved_edits')); - echo '' . $num . ''; - echo '' . $text . ''; - - echo ''; - - if($scheduled_sub_count > 0) { - $num = number_format_i18n($scheduled_sub_count); - $text = __ngettext( 'Scheduled Submission', 'Scheduled Submissions', $scheduled_sub_count ); - $url = tdomf_get_mod_posts_url(array('show' => 'scheduled')); - echo '' . $num . ''; - echo '' . $text . ''; - echo ''; - } - - if(get_option(TDOMF_OPTION_SPAM) && ($spam_edits_count > 0 || $spam_sub_count > 0)) { - - $num = number_format_i18n($pending_sub_count); - $text = __ngettext( 'Pending Submission', 'Pending Submissions', $pending_sub_count ); - $url = tdomf_get_mod_posts_url(array('show' => 'pending_submissions')); - echo '' . $num . ''; - echo '' . $text . ''; - - $num = number_format_i18n($spam_sub_count); - $text = __ngettext( 'Spam Submission', 'Spam Submissions', $spam_sub_count ); - $url = tdomf_get_mod_posts_url(array('show' => 'spam_submissions')); - echo '' . $num . ''; - echo '' . $text . ''; - - echo ''; - - $num = number_format_i18n($pending_edits_count); - $text = __ngettext( 'Pending Contribution', 'Pending Contributions', $pending_edits_count ); - echo '' . $num . ''; - echo '' . $text . ''; - - $num = number_format_i18n($spam_edits_count); - $text = __ngettext( 'Spam Contribution', 'Spam Contributions', $spam_edits_count ); - $url = tdomf_get_mod_posts_url(array('show' => 'spam_edits')); - echo '' . $num . ''; - echo '' . $text . ''; - } else { - $num = number_format_i18n($pending_sub_count); - $url = tdomf_get_mod_posts_url(array('show' => 'pending_submissions')); - $text = __ngettext( 'Pending Submission', 'Pending Submissions', $pending_sub_count ); - echo '' . $num . ''; - echo '' . $text . ''; - - $num = number_format_i18n($pending_edits_count); - $url = tdomf_get_mod_posts_url(array('show' => 'pending_edits')); - $text = __ngettext( 'Pending Contribution', 'Pending Contributions', $pending_edits_count ); - echo '' . $num . ''; - echo '' . $text . ''; - - } - - echo ''; -} -add_action('right_now_table_end','tdomf_dashboard_status'); - -function tdomf_overview_please_upgrade() { - $ver_cur = get_option(TDOMF_VERSION_CURRENT); - if($ver_cur != false && $ver_cur != TDOMF_BUILD) { ?> -

    - please visit the overview page. Thank you.','tdomf'),"admin.php?page=tdo-mini-forms"); ?> -

    - + + posts "; + $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; + $query .= "WHERE meta_key = '".TDOMF_KEY_FLAG."' "; + $query .= "WHERE post_author = '$def_aut' "; + $query .= "OR post_author = '0' "; + return intval($wpdb->get_var( $query )); + } + return 0; +} + +// Show the page +// +function tdomf_overview_menu() { + global $wpdb,$wp_roles; + + // Initilise the plugin for the first time here. This gets called when you click the TDOMF button in the menu. + // Doing it here means you can delete all the options! + tdomf_init(); + + // get feed_messages + require_once(ABSPATH . WPINC . '/rss.php'); + + if(!isset($wp_roles)) { + $wp_roles = new WP_Roles(); + } + $roles = $wp_roles->role_objects; + +?> +
    +

    + +
    + + +

    + + + +

    + +

    »

    + +

    + + + + + +

    ">»

    + +
      + + + +
    + + + + + 0) { ?> +

    ">»

    + + + + + +

    »

    + +
      + + + +
    + + + +

    + + 'unapproved', 'count' => true, 'unique_post_ids' => true)); + $stat_sub_cur = tdomf_get_submitted_posts_count(); + $stat_edit_cur = tdomf_get_edits(array('count' => true, 'unique_post_ids' => true)); + $stat_mod = $stat_sub_cur - $stat_unmod; + $stat_edit_mod = tdomf_get_edits(array('state' => 'approved', 'count' => true, 'unique_post_ids' => true)); + $stat_spam = get_option(TDOMF_STAT_SPAM); ?> + + +

    + +

    + + + items) && 0 != count($rss->items) ) { + $rss->items = array_slice($rss->items, 0, 5); + echo "

    ".__('Latest Support Forum Topics','tdomf')."

      "; + foreach ($rss->items as $item) { ?> +
    • '>
    • + "; + } ?> + +
    + + ".$message = tdomf_get_error_messages()."

    "; ?> + + + + + + +
    +
    + + + + +
    +
    + My Amazon Wishlist]","tdomf"),"http://www.amazon.co.uk/gp/registry/23S7OL9W6Q4JT"); ?> + + Rate TDO-Mini-Forms on Wordpress.org!]","tdomf"),"http://wordpress.org/extend/plugins/tdo-mini-forms/#rate-response"); ?> +
    + +

    + + + +

    support forums on thedeadone.net or the support forums on wordpress.org.',"tdomf"); ?>

    + +

    + +

    + +

    + +
    +

    + + items) && 0 != count($rss->items) ) + { + $rss->items = array_slice($rss->items, 0, 4); + foreach ($rss->items as $item) + { + ?> +

    '>

    +

    '.date("F, jS", strtotime($item['pubdate'])).' - '.$item['description']; ?>

    + +

    thedeadone.net to check for updates.', 'tdomf'), 'http://thedeadone.net/index.php?tag=tdomf') ?>

    + +
    +
    +
    + ID, TDOMF_KEY_FORM_ID, true); + $submitter = get_post_meta($p->ID, TDOMF_KEY_NAME, true); + if($form_id == false || !tdomf_form_exists($form_id)) { + if($submitter == false || empty($submitter)) { + return "
  • ".sprintf(__("\"%s\"","tdomf"),get_permalink($p->ID),$p->post_title)."
  • "; + } else { + return "
  • ".sprintf(__("\"%s\" submitted by %s","tdomf"),get_permalink($p->ID),$p->post_title,$submitter)."
  • "; + } + } else if($submitter == false || empty($submitter)) { + return "
  • ".sprintf(__("\"%s\" using form %d","tdomf"),get_permalink($p->ID),$p->post_title, $form_id)."
  • "; + } + return "
  • ".sprintf(__("\"%s\" submitted by %s using form %d","tdomf"),get_permalink($p->ID),$p->post_title,$submitter,$form_id)."
  • "; +} + +function tdomf_dashboard_status() { + + $published_sub_count = tdomf_get_published_posts_count(); + $approved_edits_count = tdomf_get_edits(array('state' => 'approved', 'count' => true)); + $scheduled_sub_count = tdomf_get_queued_posts_count(); + $spam_edits_count = tdomf_get_edits(array('state' => 'spam', 'count' => true, 'unique_post_ids' => true)); + $pending_edits_count = tdomf_get_edits(array('state' => 'unapproved', 'count' => true, 'unique_post_ids' => true)); + $pending_sub_count = tdomf_get_unmoderated_posts_count(); + $spam_sub_count = tdomf_get_spam_posts_count(); + + echo ''; + + $num = number_format_i18n($published_sub_count); + $text = __ngettext( 'Approved Submission', 'Approved Submissions', $published_sub_count ); + $url = tdomf_get_mod_posts_url(array('show' => 'all')); + echo '' . $num . ''; + echo '' . $text . ''; + + $num = number_format_i18n($approved_edits_count); + $text = __ngettext( 'Approved Contribution', 'Approved Contributions', $approved_edits_count ); + $url = tdomf_get_mod_posts_url(array('show' => 'approved_edits')); + echo '' . $num . ''; + echo '' . $text . ''; + + echo ''; + + if($scheduled_sub_count > 0) { + $num = number_format_i18n($scheduled_sub_count); + $text = __ngettext( 'Scheduled Submission', 'Scheduled Submissions', $scheduled_sub_count ); + $url = tdomf_get_mod_posts_url(array('show' => 'scheduled')); + echo '' . $num . ''; + echo '' . $text . ''; + echo ''; + } + + if(get_option(TDOMF_OPTION_SPAM) && ($spam_edits_count > 0 || $spam_sub_count > 0)) { + + $num = number_format_i18n($pending_sub_count); + $text = __ngettext( 'Pending Submission', 'Pending Submissions', $pending_sub_count ); + $url = tdomf_get_mod_posts_url(array('show' => 'pending_submissions')); + echo '' . $num . ''; + echo '' . $text . ''; + + $num = number_format_i18n($spam_sub_count); + $text = __ngettext( 'Spam Submission', 'Spam Submissions', $spam_sub_count ); + $url = tdomf_get_mod_posts_url(array('show' => 'spam_submissions')); + echo '' . $num . ''; + echo '' . $text . ''; + + echo ''; + + $num = number_format_i18n($pending_edits_count); + $text = __ngettext( 'Pending Contribution', 'Pending Contributions', $pending_edits_count ); + echo '' . $num . ''; + echo '' . $text . ''; + + $num = number_format_i18n($spam_edits_count); + $text = __ngettext( 'Spam Contribution', 'Spam Contributions', $spam_edits_count ); + $url = tdomf_get_mod_posts_url(array('show' => 'spam_edits')); + echo '' . $num . ''; + echo '' . $text . ''; + } else { + $num = number_format_i18n($pending_sub_count); + $url = tdomf_get_mod_posts_url(array('show' => 'pending_submissions')); + $text = __ngettext( 'Pending Submission', 'Pending Submissions', $pending_sub_count ); + echo '' . $num . ''; + echo '' . $text . ''; + + $num = number_format_i18n($pending_edits_count); + $url = tdomf_get_mod_posts_url(array('show' => 'pending_edits')); + $text = __ngettext( 'Pending Contribution', 'Pending Contributions', $pending_edits_count ); + echo '' . $num . ''; + echo '' . $text . ''; + + } + + echo ''; +} +add_action('right_now_table_end','tdomf_dashboard_status'); + +function tdomf_overview_please_upgrade() { + $ver_cur = get_option(TDOMF_VERSION_CURRENT); + if($ver_cur != false && $ver_cur != TDOMF_BUILD) { ?> +

    + please visit the overview page. Thank you.','tdomf'),"admin.php?page=tdo-mini-forms"); ?> +

    + \ No newline at end of file Index: admin/tdomf-uninstall.php =================================================================== --- admin/tdomf-uninstall.php (revision 169181) +++ admin/tdomf-uninstall.php (working copy) @@ -1,53 +1,53 @@ -posts "; - $query .= "ORDER BY ID DESC"; - return $wpdb->get_results( $query ); -} - -///////////////////////////////// -// Delete pre-configured options -// -function tdomf_reset_options() { - global $wpdb, $wp_roles, $table_prefix; - - echo ""; - _e("Deleting Options... ","tdomf"); - echo ""; - - // This includes v0.6 options! - // - delete_option(TDOMF_ACCESS_LEVEL); - delete_option(TDOMF_NOTIFY_LEVEL); - delete_option(TDOMF_ACCESS_ROLES); - delete_option(TDOMF_NOTIFY_ROLES); - delete_option(TDOMF_DEFAULT_CATEGORY); - delete_option(TDOMF_DEFAULT_AUTHOR); - delete_option(TDOMF_AUTO_FIX_AUTHOR); - delete_option(TDOMF_BANNED_IPS); - delete_option(TDOMF_VERSION_CURRENT); - delete_option(TDOMF_OPTION_MODERATION); - delete_option(TDOMF_OPTION_TRUST_COUNT); - delete_option(TDOMF_OPTION_ALLOW_EVERYONE); - delete_option(TDOMF_OPTION_AJAX); - delete_option(TDOMF_OPTION_PREVIEW); - delete_option(TDOMF_OPTION_FROM_EMAIL); - delete_option(TDOMF_OPTION_AUTHOR_THEME_HACK); - delete_option(TDOMF_OPTION_ADD_SUBMITTER); - delete_option(TDOMF_OPTION_FORM_ORDER); - delete_option(TDOMF_STAT_SUBMITTED); - delete_option(TDOMF_OPTION_DISABLE_ERROR_MESSAGES); - delete_option(TDOMF_OPTION_EXTRA_LOG_MESSAGES); +posts "; + $query .= "ORDER BY ID DESC"; + return $wpdb->get_results( $query ); +} + +///////////////////////////////// +// Delete pre-configured options +// +function tdomf_reset_options() { + global $wpdb, $wp_roles, $table_prefix; + + echo ""; + _e("Deleting Options... ","tdomf"); + echo ""; + + // This includes v0.6 options! + // + delete_option(TDOMF_ACCESS_LEVEL); + delete_option(TDOMF_NOTIFY_LEVEL); + delete_option(TDOMF_ACCESS_ROLES); + delete_option(TDOMF_NOTIFY_ROLES); + delete_option(TDOMF_DEFAULT_CATEGORY); + delete_option(TDOMF_DEFAULT_AUTHOR); + delete_option(TDOMF_AUTO_FIX_AUTHOR); + delete_option(TDOMF_BANNED_IPS); + delete_option(TDOMF_VERSION_CURRENT); + delete_option(TDOMF_OPTION_MODERATION); + delete_option(TDOMF_OPTION_TRUST_COUNT); + delete_option(TDOMF_OPTION_ALLOW_EVERYONE); + delete_option(TDOMF_OPTION_AJAX); + delete_option(TDOMF_OPTION_PREVIEW); + delete_option(TDOMF_OPTION_FROM_EMAIL); + delete_option(TDOMF_OPTION_AUTHOR_THEME_HACK); + delete_option(TDOMF_OPTION_ADD_SUBMITTER); + delete_option(TDOMF_OPTION_FORM_ORDER); + delete_option(TDOMF_STAT_SUBMITTED); + delete_option(TDOMF_OPTION_DISABLE_ERROR_MESSAGES); + delete_option(TDOMF_OPTION_EXTRA_LOG_MESSAGES); delete_option(TDOMF_OPTION_YOUR_SUBMISSIONS); delete_option(TDOMF_OPTION_NAME); delete_option(TDOMF_OPTION_DESCRIPTION); @@ -58,249 +58,249 @@ delete_option(TDOMF_LOG); delete_option(TDOMF_OPTION_WIDGET_MAX_WIDTH); delete_option(TDOMF_OPTION_WIDGET_MAX_LENGTH); - delete_option(TDOMF_OPTION_WIDGET_MAX_WIDTH); + delete_option(TDOMF_OPTION_WIDGET_MAX_HEIGHT); delete_option(TDOMF_OPTION_VERIFICATION_METHOD); delete_option(TDOMF_OPTION_FORM_DATA_METHOD); delete_option(TDOMF_VERSION_LAST); - - echo ""; - _e("DONE","tdomf"); - echo "
    "; - - echo ""; - _e("Resetting role capabilities... ","tdomf"); - echo ""; - if(!isset($wp_roles)) { - $wp_roles = new WP_Roles(); - } - $roles = $wp_roles->role_objects; - $form_ids = tdomf_get_form_ids(); - foreach($roles as $role) { - if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_1'])){ - $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_1'); - } - foreach($form_ids as $f) { - if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$f->form_id])){ - $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$f->form_id); - } - } - } - - echo ""; - _e("DONE","tdomf"); - echo "
    "; - - echo ""; - _e("Deleting Widget Options (or at least the ones I can find!)... ","tdomf"); - echo ""; - // Danger will robinson! If the table prefix is "tdomf_", you may end up - // deleting critical Wordpress core options! - if($table_prefix != "tdomf_") { - $alloptions = wp_load_alloptions(); - foreach($alloptions as $id => $val) { - if(preg_match('#^tdomf_.+#',$id)) { - delete_option($id); - echo ""; - } - } - echo ""; - _e("DONE","tdomf"); - } else { - echo ""; - _e("FAIL","tdomf"); - } - echo "
    "; - - echo ""; - _e("Deleting Database Tables... ","tdomf"); - echo ""; - tdomf_db_delete_tables(); - echo ""; - _e("DONE","tdomf"); - echo "
    "; - -} - -function tdomf_full_uninstall() { - - // Delete Posts - // - echo ""; - _e("Removing posts submitted or managed by TDO Mini Forms (this may take a few minutes depending on the number of posts)... ","tdomf"); - echo ""; - $posts = tdomf_get_all_posts(); - foreach($posts as $post) { - delete_option(TDOMF_NOTIFY.$post->ID); - $tdomf_flag = get_post_meta($post->ID, TDOMF_KEY_FLAG, true); - if(!empty($tdomf_flag)){ - wp_delete_post($post->ID); - } - } - echo ""; - _e("DONE","tdomf"); - echo "
    "; - - // Delete Created Users - // - echo ""; - _e("Attempting to delete any users created by TDOMF... ","tdomf"); - echo ""; - $users = get_option(TDOMF_OPTION_CREATEDUSERS); - if($users != false) { - foreach($users as $u) { - wp_delete_user($u); - } - } - echo ""; - _e("DONE","tdomf"); - echo "
    "; - - // Strip existing Users - // - echo ""; - _e("Removing info from remaining users (this may take a few minutes depending on number of users)... ","tdomf"); - echo ""; - $users = tdomf_get_all_users(); - foreach($users as $user) { - delete_usermeta($user->ID, TDOMF_KEY_FLAG); - delete_usermeta($user->ID, TDOMF_KEY_STATUS); - } - echo ""; - _e("DONE","tdomf"); - echo "
    "; - - // Delete Forms - // - $form_ids = tdomf_get_form_ids(); - foreach($form_ids as $f) { - echo ""; - printf(__("Deleting Form %d... ","tdomf"),$f->form_id); - echo ""; - if(tdomf_delete_form($f->form_id)) { - echo ""; - _e("DONE","tdomf"); - } else { - echo ""; - _e("FAIL","tdomf"); - } - echo "
    "; - } - - // Delete Options - // - tdomf_reset_options(); -} - -// Uninstall everything else! -// -function tdomf_uninstall() { - tdomf_reset_options(); - - echo ""; - _e("Removing info from all users (this may take a few minutes depending on number of users)... ","tdomf"); - echo ""; - $users = tdomf_get_all_users(); - foreach($users as $user) { - delete_usermeta($user->ID, TDOMF_KEY_FLAG); - delete_usermeta($user->ID, TDOMF_KEY_STATUS); - } - echo ""; - _e("DONE","tdomf"); - echo "
    "; - - // This includes v0.6 options! - // - echo ""; - _e("Removing info from all posts (this may take a few minutes depending on number of posts)... ","tdomf"); - echo ""; - $posts = tdomf_get_all_posts(); - foreach($posts as $post) { - delete_option(TDOMF_NOTIFY.$post->ID); - delete_post_meta($post->ID, TDOMF_KEY_NOTIFY_EMAIL); - delete_post_meta($post->ID, TDOMF_KEY_FLAG); - delete_post_meta($post->ID, TDOMF_KEY_NAME); - delete_post_meta($post->ID, TDOMF_KEY_EMAIL); - delete_post_meta($post->ID, TDOMF_KEY_WEB); - delete_post_meta($post->ID, TDOMF_KEY_IP); - delete_post_meta($post->ID, TDOMF_KEY_USER_ID); - delete_post_meta($post->ID, TDOMF_KEY_USER_NAME); - delete_post_meta($post->ID, TDOMF_KEY_LOCK); - } - echo ""; - _e("DONE","tdomf"); - echo "
    "; -} - -// Display a help page -// -function tdomf_show_uninstall_menu() { - ?> - -
    - -

    - - - - -

    - -

    -

    - -

    -

    - -

    -

    " class='delete' >

    - -

    -

    - -

    - - -

    -
    - - - -
    -

    nearly everything. Any posts submitted, users created or pages created are not removed. However submitted posts are stripped of any information about TDO Mini Forms. If you re-enable TDO Mini Forms, posts previousily submitted will not turn up as submitted posts any more.","tdomf"); ?>

    - " class='delete' > -
    - -
    -

    everything. It is advised to backup your database before proceeding as posts, pages and users will be deleted. All posts submitted by users using TDO Mini Forms will be deleted. Any users created by TDO Mini forms will be deleted. Any pages created by TDO Mini Forms will be deleted. All options and settings will be completely removed. It'll be like you never used TDO Mini Forms!","tdomf"); ?>

    - " class='delete' > -
    - - - -
    - -
    - - + + echo ""; + _e("DONE","tdomf"); + echo "
    "; + + echo ""; + _e("Resetting role capabilities... ","tdomf"); + echo ""; + if(!isset($wp_roles)) { + $wp_roles = new WP_Roles(); + } + $roles = $wp_roles->role_objects; + $form_ids = tdomf_get_form_ids(); + foreach($roles as $role) { + if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_1'])){ + $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_1'); + } + foreach($form_ids as $f) { + if(isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$f->form_id])){ + $role->remove_cap(TDOMF_CAPABILITY_CAN_SEE_FORM.'_'.$f->form_id); + } + } + } + + echo ""; + _e("DONE","tdomf"); + echo "
    "; + + echo ""; + _e("Deleting Widget Options (or at least the ones I can find!)... ","tdomf"); + echo ""; + // Danger will robinson! If the table prefix is "tdomf_", you may end up + // deleting critical Wordpress core options! + if($table_prefix != "tdomf_") { + $alloptions = wp_load_alloptions(); + foreach($alloptions as $id => $val) { + if(preg_match('#^tdomf_.+#',$id)) { + delete_option($id); + echo ""; + } + } + echo ""; + _e("DONE","tdomf"); + } else { + echo ""; + _e("FAIL","tdomf"); + } + echo "
    "; + + echo ""; + _e("Deleting Database Tables... ","tdomf"); + echo ""; + tdomf_db_delete_tables(); + echo ""; + _e("DONE","tdomf"); + echo "
    "; + +} + +function tdomf_full_uninstall() { + + // Delete Posts + // + echo ""; + _e("Removing posts submitted or managed by TDO Mini Forms (this may take a few minutes depending on the number of posts)... ","tdomf"); + echo ""; + $posts = tdomf_get_all_posts(); + foreach($posts as $post) { + delete_option(TDOMF_NOTIFY.$post->ID); + $tdomf_flag = get_post_meta($post->ID, TDOMF_KEY_FLAG, true); + if(!empty($tdomf_flag)){ + wp_delete_post($post->ID); + } + } + echo ""; + _e("DONE","tdomf"); + echo "
    "; + + // Delete Created Users + // + echo ""; + _e("Attempting to delete any users created by TDOMF... ","tdomf"); + echo ""; + $users = get_option(TDOMF_OPTION_CREATEDUSERS); + if($users != false) { + foreach($users as $u) { + wp_delete_user($u); + } + } + echo ""; + _e("DONE","tdomf"); + echo "
    "; + + // Strip existing Users + // + echo ""; + _e("Removing info from remaining users (this may take a few minutes depending on number of users)... ","tdomf"); + echo ""; + $users = tdomf_get_all_users(); + foreach($users as $user) { + delete_usermeta($user->ID, TDOMF_KEY_FLAG); + delete_usermeta($user->ID, TDOMF_KEY_STATUS); + } + echo ""; + _e("DONE","tdomf"); + echo "
    "; + + // Delete Forms + // + $form_ids = tdomf_get_form_ids(); + foreach($form_ids as $f) { + echo ""; + printf(__("Deleting Form %d... ","tdomf"),$f->form_id); + echo ""; + if(tdomf_delete_form($f->form_id)) { + echo ""; + _e("DONE","tdomf"); + } else { + echo ""; + _e("FAIL","tdomf"); + } + echo "
    "; + } + + // Delete Options + // + tdomf_reset_options(); +} + +// Uninstall everything else! +// +function tdomf_uninstall() { + tdomf_reset_options(); + + echo ""; + _e("Removing info from all users (this may take a few minutes depending on number of users)... ","tdomf"); + echo ""; + $users = tdomf_get_all_users(); + foreach($users as $user) { + delete_usermeta($user->ID, TDOMF_KEY_FLAG); + delete_usermeta($user->ID, TDOMF_KEY_STATUS); + } + echo ""; + _e("DONE","tdomf"); + echo "
    "; + + // This includes v0.6 options! + // + echo ""; + _e("Removing info from all posts (this may take a few minutes depending on number of posts)... ","tdomf"); + echo ""; + $posts = tdomf_get_all_posts(); + foreach($posts as $post) { + delete_option(TDOMF_NOTIFY.$post->ID); + delete_post_meta($post->ID, TDOMF_KEY_NOTIFY_EMAIL); + delete_post_meta($post->ID, TDOMF_KEY_FLAG); + delete_post_meta($post->ID, TDOMF_KEY_NAME); + delete_post_meta($post->ID, TDOMF_KEY_EMAIL); + delete_post_meta($post->ID, TDOMF_KEY_WEB); + delete_post_meta($post->ID, TDOMF_KEY_IP); + delete_post_meta($post->ID, TDOMF_KEY_USER_ID); + delete_post_meta($post->ID, TDOMF_KEY_USER_NAME); + delete_post_meta($post->ID, TDOMF_KEY_LOCK); + } + echo ""; + _e("DONE","tdomf"); + echo "
    "; +} + +// Display a help page +// +function tdomf_show_uninstall_menu() { + ?> + +
    + +

    + + + + +

    + +

    +

    + +

    +

    + +

    +

    " class='delete' >

    + +

    +

    + +

    + + +

    +
    + + + +
    +

    nearly everything. Any posts submitted, users created or pages created are not removed. However submitted posts are stripped of any information about TDO Mini Forms. If you re-enable TDO Mini Forms, posts previousily submitted will not turn up as submitted posts any more.","tdomf"); ?>

    + " class='delete' > +
    + +
    +

    everything. It is advised to backup your database before proceeding as posts, pages and users will be deleted. All posts submitted by users using TDO Mini Forms will be deleted. Any users created by TDO Mini forms will be deleted. Any pages created by TDO Mini Forms will be deleted. All options and settings will be completely removed. It'll be like you never used TDO Mini Forms!","tdomf"); ?>

    + " class='delete' > +
    + + + +
    + +
    + + \ No newline at end of file Index: admin/tdomf-your-submissions.php =================================================================== --- admin/tdomf-your-submissions.php (revision 169181) +++ admin/tdomf-your-submissions.php (working copy) @@ -1,80 +1,80 @@ -posts "; - $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; - $query .= "WHERE meta_key = '".TDOMF_KEY_USER_ID."' "; - $query .= "AND post_status = 'publish' "; - $query .= "AND meta_value = '$user_id' "; - $query .= "ORDER BY ID DESC "; - if($limit > 0) { - $query .= "LIMIT $limit "; - } - if($offset > 0) { - $query .= "OFFSET $offset "; - } - return $wpdb->get_results( $query );*/ - return tdomf_get_posts(array('limit' => $limit, - 'offset' => $offset, - 'user_id' => $user_id, - 'post_status' => array('publish'))); -} - -function tdomf_get_user_scheduled_posts($user_id = 0, $offset = 0, $limit = 0) { - /*global $wpdb; - $query = "SELECT ID, post_title, meta_value, post_status, post_modified_gmt, post_modified, post_date, post_date_gmt "; - $query .= "FROM $wpdb->posts "; - $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; - $query .= "WHERE meta_key = '".TDOMF_KEY_USER_ID."' "; - $query .= "AND post_status = 'future' "; - $query .= "AND meta_value = '$user_id' "; - $query .= "ORDER BY ID DESC "; - if($limit > 0) { - $query .= "LIMIT $limit "; - } - if($offset > 0) { - $query .= "OFFSET $offset "; - } - return $wpdb->get_results( $query );*/ - return tdomf_get_posts(array('limit' => $limit, - 'offset' => $offset, - 'post_status' => array('future'), - 'user_id' => $user_id )); -} - -// Grab a list of unmoderated submitted posts for user -// -function tdomf_get_user_draft_posts($user_id = 0, $offset = 0, $limit = 0) { - /*global $wpdb; - $query = "SELECT ID, post_title, meta_value, post_status "; - $query .= "FROM $wpdb->posts "; - $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; - $query .= "WHERE meta_key = '".TDOMF_KEY_USER_ID."' "; - $query .= "AND post_status = 'draft' "; - $query .= "AND meta_value = '$user_id' "; - $query .= "ORDER BY ID DESC "; - if($limit > 0) { - $query .= "LIMIT $limit "; - } - if($offset > 0) { - $query .= "OFFSET $offset "; - } - return $wpdb->get_results( $query );*/ - return tdomf_get_posts(array('limit' => $limit, - 'offset' => $offset, - 'user_id' => $user_id, - 'post_status' => array('draft'))); -} - +posts "; + $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; + $query .= "WHERE meta_key = '".TDOMF_KEY_USER_ID."' "; + $query .= "AND post_status = 'publish' "; + $query .= "AND meta_value = '$user_id' "; + $query .= "ORDER BY ID DESC "; + if($limit > 0) { + $query .= "LIMIT $limit "; + } + if($offset > 0) { + $query .= "OFFSET $offset "; + } + return $wpdb->get_results( $query );*/ + return tdomf_get_posts(array('limit' => $limit, + 'offset' => $offset, + 'user_id' => $user_id, + 'post_status' => array('publish'))); +} + +function tdomf_get_user_scheduled_posts($user_id = 0, $offset = 0, $limit = 0) { + /*global $wpdb; + $query = "SELECT ID, post_title, meta_value, post_status, post_modified_gmt, post_modified, post_date, post_date_gmt "; + $query .= "FROM $wpdb->posts "; + $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; + $query .= "WHERE meta_key = '".TDOMF_KEY_USER_ID."' "; + $query .= "AND post_status = 'future' "; + $query .= "AND meta_value = '$user_id' "; + $query .= "ORDER BY ID DESC "; + if($limit > 0) { + $query .= "LIMIT $limit "; + } + if($offset > 0) { + $query .= "OFFSET $offset "; + } + return $wpdb->get_results( $query );*/ + return tdomf_get_posts(array('limit' => $limit, + 'offset' => $offset, + 'post_status' => array('future'), + 'user_id' => $user_id )); +} + +// Grab a list of unmoderated submitted posts for user +// +function tdomf_get_user_draft_posts($user_id = 0, $offset = 0, $limit = 0) { + /*global $wpdb; + $query = "SELECT ID, post_title, meta_value, post_status "; + $query .= "FROM $wpdb->posts "; + $query .= "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; + $query .= "WHERE meta_key = '".TDOMF_KEY_USER_ID."' "; + $query .= "AND post_status = 'draft' "; + $query .= "AND meta_value = '$user_id' "; + $query .= "ORDER BY ID DESC "; + if($limit > 0) { + $query .= "LIMIT $limit "; + } + if($offset > 0) { + $query .= "OFFSET $offset "; + } + return $wpdb->get_results( $query );*/ + return tdomf_get_posts(array('limit' => $limit, + 'offset' => $offset, + 'user_id' => $user_id, + 'post_status' => array('draft'))); +} + function tdomf_get_post_time( $d = 'U', $gmt = false, $post ) { // returns timestamp if ( $gmt ) $time = $post->post_date_gmt; @@ -88,7 +88,7 @@ // include form style sheet on page // function tdomf_show_your_submissions_admin_head() { - if(preg_match('/page=tdomf_your_submissions/',$_SERVER[REQUEST_URI])) { + if(preg_match('/page=tdomf_your_submissions/',$_SERVER['REQUEST_URI'])) { ?> ID,TDOMF_KEY_FLAG); - $sub_total = tdomf_get_users_submitted_posts_count($current_user->ID); - $app_total = tdomf_get_users_published_posts_count($current_user->ID); - $user_status = get_usermeta($current_user->ID,TDOMF_KEY_STATUS); - $app_posts = tdomf_get_user_published_posts($current_user->ID,0,$limit); - $mod_posts = tdomf_get_user_draft_posts($current_user->ID); - $mod_total = count($mod_posts); - $fut_posts = tdomf_get_user_scheduled_posts($current_user->ID); - $fut_total = count($fut_posts); - $unapp_edits = tdomf_get_edits(array('state' => 'unapproved', 'unique_post_ids' => true, 'user_id' => $current_user->ID)); - $app_edits = tdomf_get_edits(array('state' => 'approved', 'unique_post_ids' => true, 'user_id' => $current_user->ID, 'limit' => $limit)); - - ?> - -
    -

    - - - admins.","tdomf"),$_REQUEST['REMOTE_ADDR'],get_bloginfo('admin_email')); ?> - - admins.","tdomf"),get_bloginfo('admin_email')); ?> - - -

    - - %s! ","tdomf"),$current_user->display_name); ?> - - %s!","tdomf"),$current_user->display_name); ?> - - %s.","tdomf"),$current_user->display_name); ?> - -

    - -

    - - -
      - -
    • -
    • - -
    • -
    - - - 0 || $app_total > 0)) { ?> - - 0) { ?> -

    -
      - -
    • - post_date; - $time = tdomf_get_post_time('G', true, $p); - if ( ( abs(time() - $time) ) < 86400 ) { - $h_time = sprintf( __('%s from now'), human_time_diff( $time ) ); - } else { - $h_time = mysql2date(__('Y/m/d'), $m_time); - } ?> - %s will be published %s","tdomf"),get_permalink($p->ID),$p->post_title,"$h_time"); ?> -
    • - -
    - - - 0) { ?> -

    -
      - -
    • - post_date; - $time = tdomf_get_post_time('G', true, $p); - if ( ( abs(time() - $time) ) < 86400 ) { - $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); - } else { - $h_time = mysql2date(__('Y/m/d'), $m_time); - } ?> - %s approved %s","tdomf"),get_permalink($p->ID),$p->post_title,"$h_time"); ?> -
    • - -
    - - - 0) { ?> -

    -
      - -
    • "post_title; ?>"
    • - -
    - - - - -

    -
      - -
    • - 'approved', 'post_id' =>$app_edit->post_id, 'user_id' => $current_user->ID, 'limit' => 1)); - $edit = $edit[0]; - $t_time = get_the_time(__('Y/m/d g:i:s A')); - $h_time = mysql2date(__('Y/m/d'), $edit->date); - $post = get_post($app_edit->post_id); - printf(__("%s edited %s","tdomf"),get_permalink($app_edit->post_id),$post->post_title,"$h_time"); ?> -
    • - -
    - - - -

    -
      - -
    • - 'unapproved', 'post_id' =>$unapp_edit->post_id, 'user_id' => $current_user->ID, 'limit' => 1)); - $edit = $edit[0]; - $t_time = get_the_time(__('Y/m/d g:i:s A')); - $h_time = mysql2date(__('Y/m/d'), $edit->date); - $post = get_post($unapp_edit->post_id); - printf(__("%s edited %s","tdomf"),get_permalink($unapp_edit->post_id),$post->post_title,"$h_time"); ?> -
    • - -
    - - -
    - - - - - form_id)) { - $edit = tdomf_get_option_form(TDOMF_OPTION_FORM_EDIT,$form_id->form_id); - $post_id = false; - if(isset($_REQUEST['tdomf_post_id'])) { $post_id = intval($_REQUEST['tdomf_post_id']); } - $good = true; - if($edit && tdomf_check_permissions_form($form_id->form_id, $post_id) != NULL) { - $good = false; - } - if($good) { ?> -
    -

    form_id); ?>

    -

    form_id); ?>

    - form_id); ?> -

    -
    - - - -
    - -

    TDO Mini Forms Plugin.','tdomf'); ?>

    - - +// Show the page! +// +function tdomf_show_your_submissions_menu() { + global $current_user; + + // how many of the recently published/approved entries to see + // + $limit = 10; + + get_currentuserinfo(); + + $tdomf_flag = get_usermeta($current_user->ID,TDOMF_KEY_FLAG); + $sub_total = tdomf_get_users_submitted_posts_count($current_user->ID); + $app_total = tdomf_get_users_published_posts_count($current_user->ID); + $user_status = get_usermeta($current_user->ID,TDOMF_KEY_STATUS); + $app_posts = tdomf_get_user_published_posts($current_user->ID,0,$limit); + $mod_posts = tdomf_get_user_draft_posts($current_user->ID); + $mod_total = count($mod_posts); + $fut_posts = tdomf_get_user_scheduled_posts($current_user->ID); + $fut_total = count($fut_posts); + $unapp_edits = tdomf_get_edits(array('state' => 'unapproved', 'unique_post_ids' => true, 'user_id' => $current_user->ID)); + $app_edits = tdomf_get_edits(array('state' => 'approved', 'unique_post_ids' => true, 'user_id' => $current_user->ID, 'limit' => $limit)); + + ?> + +
    +

    + + + admins.","tdomf"),$_REQUEST['REMOTE_ADDR'],get_bloginfo('admin_email')); ?> + + admins.","tdomf"),get_bloginfo('admin_email')); ?> + + +

    + + %s! ","tdomf"),$current_user->display_name); ?> + + %s!","tdomf"),$current_user->display_name); ?> + + %s.","tdomf"),$current_user->display_name); ?> + +

    + +

    + + +
      + +
    • +
    • + +
    • +
    + + + 0 || $app_total > 0)) { ?> + + 0) { ?> +

    +
      + +
    • + post_date; + $time = tdomf_get_post_time('G', true, $p); + if ( ( abs(time() - $time) ) < 86400 ) { + $h_time = sprintf( __('%s from now'), human_time_diff( $time ) ); + } else { + $h_time = mysql2date(__('Y/m/d'), $m_time); + } ?> + %s will be published %s","tdomf"),get_permalink($p->ID),$p->post_title,"$h_time"); ?> +
    • + +
    + + + 0) { ?> +

    +
      + +
    • + post_date; + $time = tdomf_get_post_time('G', true, $p); + if ( ( abs(time() - $time) ) < 86400 ) { + $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); + } else { + $h_time = mysql2date(__('Y/m/d'), $m_time); + } ?> + %s approved %s","tdomf"),get_permalink($p->ID),$p->post_title,"$h_time"); ?> +
    • + +
    + + + 0) { ?> +

    +
      + +
    • "post_title; ?>"
    • + +
    + + + + +

    +
      + +
    • + 'approved', 'post_id' =>$app_edit->post_id, 'user_id' => $current_user->ID, 'limit' => 1)); + $edit = $edit[0]; + $t_time = get_the_time(__('Y/m/d g:i:s A')); + $h_time = mysql2date(__('Y/m/d'), $edit->date); + $post = get_post($app_edit->post_id); + printf(__("%s edited %s","tdomf"),get_permalink($app_edit->post_id),$post->post_title,"$h_time"); ?> +
    • + +
    + + + +

    +
      + +
    • + 'unapproved', 'post_id' =>$unapp_edit->post_id, 'user_id' => $current_user->ID, 'limit' => 1)); + $edit = $edit[0]; + $t_time = get_the_time(__('Y/m/d g:i:s A')); + $h_time = mysql2date(__('Y/m/d'), $edit->date); + $post = get_post($unapp_edit->post_id); + printf(__("%s edited %s","tdomf"),get_permalink($unapp_edit->post_id),$post->post_title,"$h_time"); ?> +
    • + +
    + + +
    + + + + + form_id)) { + $edit = tdomf_get_option_form(TDOMF_OPTION_FORM_EDIT,$form_id->form_id); + $post_id = false; + if(isset($_REQUEST['tdomf_post_id'])) { $post_id = intval($_REQUEST['tdomf_post_id']); } + $good = true; + if($edit && tdomf_check_permissions_form($form_id->form_id, $post_id) != NULL) { + $good = false; + } + if($good) { ?> +
    +

    form_id); ?>

    +

    form_id); ?>

    + form_id); ?> +

    +
    + + + +
    + +

    TDO Mini Forms Plugin.','tdomf'); ?>

    + + Index: tdomf.php =================================================================== --- tdomf.php (revision 169181) +++ tdomf.php (working copy) @@ -1,390 +1,390 @@ -posts = apply_filters('the_posts', $this->posts); - 1. is single/page [should include category and index?] - 2. what post? - 3. is it tdomf, draft/unmoderation, not spam, viewer is submitter - 4. add to array - This will allow users see their submitted posts, however comments should - be disabled as they cannot be used in preview mode - - What Clickable links in your posts? http://thedeadone.net/forum/?p=500#comment-1598 -*/ - - /* -//////////////////////////////////////////////////////////////////////////////// -TODO for future versions - -Known Bugs -- Upload Link error -- TinyMCE integration problem with AJAX - -New Features -- Option to redirect all comment notifications on submitted posts to the admin (globally or per form) -- Allow moderators append a message to the approved/rejected notification (allows communication between submitter and moderator) -- Widget Manager Menu - * Info about loaded widgets - * Disable loading of specific widgets -- Style Sheet Editor - * Preview - * Select from pre-configured Styles - * Submit new style to include in TDOMF -- Email verification of non-registered users -- Manage Downloads page -- Authors of posts should be able to see "previews" of post -- Get input during validation of form (for capatchas) -- Option to use "Post ready for review" instead of draft for unapproved submitted posts -- Turn Forms into multiple steps -- Shortcode Support - -New Form Options -- Force Preview before submission -- Hide Form on Preview -- Forms can be used to submit links, emails, etc. -- Select Form Style/include Custom CSS - -New Widgets -- Widget to allow user to enter a date to post the submission (as in future post) -- Widget to allow submitter to copy the submission to another email -- Widget that inputs only title - * or that allows formatting of title by - * user-input - * custom field - * username/submitter - * date submitted (requires date/time format) - * PHP code -- Login/Register/Who Am I Widget - -Existing Widget Improvements -- Any widget with a size or length field should be customisable. -- Textfield Class (support numeric, date, email, webpage, etc.) -- Textarea Class -- Copy Widget to another Form -- Individual save -- Upload Files - * Multiple Instances - * Thumbnail size - * Limit size of image by w/h - * Image cropping - * Title field for file links/attachment pages - * Nicer integration: background uploading using iframe - * Prevent submission until files uploaded - * Progress bar -- Content - * TinyMCE Integration - * Allow users to define their own quicktags - * Mechanism to allow sumitter to select where the link/image for upload should go - * Default Value -- Custom Field: Textarea - * TinyMCE Integration - * Allow users to define their own quicktags - * Mechanism to allow sumitter to select where the link/image for upload should go - * Default Value -- Custom Field - * Radio Groups - * Multiple Checkboxes (grid-layout) -- Custom Field: Textfield - * Numeric - * Date -- Custom Field: Select - * Required support -- Tags - * Select from existing tag list or tag cloud - * Select from only a specified set of tags -- 1 Question Captcha - * Random questions for Captcha -- Category - * Co-operate with "Set Category from GET variables" Widget -- Notify Me - * Option to always notify submitter -- Image Captcha - * Do not reload image on every preview (would be resolved by a seperate validation step) -- Text - * Option to not use the form formatting (i.e. no "
    " tags before and after) - * Option to have the text popup (would require a HTML space for the link) -- Set Category from GET variables - * Add options (or at least information) for this widget - * Co-operate with "Categories" Widget -- Who Am I - * Integration with WP-OpenID? - * Allow login as part of form submit -- Categories - * Categories displayed but unselectable - -Template Tags -- Log -- Moderation Queue -- Approved Posts -- File Info -- Country codes on submitter's IP -- Image Tags - -Misc -- Documentation on creating your own widgets - -//////////////////////////////////////////////////////////////////////////////// -*/ - -/////////////////////////////////////////////////// -// Defines and other global vars for this Plugin // -/////////////////////////////////////////////////// - -// Older versions of PHP may not define DIRECTORY_SEPARATOR so define it here, -// just in case. -if(!defined('DIRECTORY_SEPARATOR')) { - define('DIRECTORY_SEPARATOR','/'); -} - -// Build Number (must be a integer) -define("TDOMF_BUILD", "51"); -// Version Number (can be text) -define("TDOMF_VERSION", "0.13.4"); - -/////////////////////////////////////// -// 0.1 to 0.5 Settings (no longer used) -// -define("TDOMF_ACCESS_LEVEL", "tdomf_access_level"); -define("TDOMF_NOTIFY_LEVEL", "tdomf_notify_level"); - -/////////////////////////////////////// -// 0.6 Settings (no longer used) -// -define('TDOMF_NOTIFY','tdomf_notify'); -define("TDOMF_ITEMS_PER_PAGE", 30); -define("TDOMF_POSTS_INDEX", 0); -define("TDOMF_USERS_INDEX", 1); -define("TDOMF_IPS_INDEX", 2); -define("TDOMF_OPTIONS_INDEX", 3); - -///////////////// -// 0.6 Settings -// -define("TDOMF_ACCESS_ROLES", "tdomf_access_roles"); -define("TDOMF_NOTIFY_ROLES", "tdomf_notify_roles"); -define("TDOMF_DEFAULT_CATEGORY", "tdomf_default_category"); -define("TDOMF_DEFAULT_AUTHOR", "tdomf_default_author"); -define("TDOMF_AUTO_FIX_AUTHOR", "tdomf_auto_fix_author"); -define("TDOMF_BANNED_IPS", "tdomf_banned_ips"); -// -// These keys are used to store info about a post, on the post. -// Keys with underscore prefix (i.e. "_") are hidden from the general user. Keys -// without can be modified and displayed using Wordpress normal features such as -// template tags and custom fields editor. -// -define("TDOMF_KEY_FLAG","_tdomf_flag"); -define("TDOMF_KEY_NAME","Author Name"); -define("TDOMF_KEY_EMAIL","Author Email"); -define("TDOMF_KEY_WEB","Author Webpage"); -define("TDOMF_KEY_IP","_tdomf_original_poster_ip"); -define("TDOMF_KEY_USER_ID","_tdomf_original_poster_id"); -define("TDOMF_KEY_USER_NAME","Original Submitter Username"); -// -// This key is very important. It determines if a user is trusted or banned.. -// -define("TDOMF_KEY_STATUS","_tdomf_status"); - - -///////////////// -// 0.7 Settings -// -define('TDOMF_FOLDER', dirname(plugin_basename(__FILE__))); -define('TDOMF_FULLPATH', WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.TDOMF_FOLDER.DIRECTORY_SEPARATOR); -#define('TDOMF_FULLPATH', ABSPATH.PLUGINDIR.DIRECTORY_SEPARATOR.TDOMF_FOLDER.DIRECTORY_SEPARATOR); -define('TDOMF_URLPATH', get_option('siteurl').'/wp-content/plugins/'.TDOMF_FOLDER.'/'); -define('TDOMF_WIDGET_PATH',TDOMF_FULLPATH.'widgets/'); -define('TDOMF_VERSION_CURRENT', "tdomf_version_current"); -define('TDOMF_LOG', "tdomf_log"); -define('TDOMF_OPTION_MODERATION', "tdomf_enable_moderation"); -define('TDOMF_OPTION_TRUST_COUNT', "tdomf_trust_count"); -define('TDOMF_OPTION_ALLOW_EVERYONE', "tdomf_allow_everyone"); -define('TDOMF_OPTION_AJAX', "tdomf_ajax"); -define('TDOMF_OPTION_PREVIEW', "tdomf_preview"); -define('TDOMF_OPTION_FROM_EMAIL', "tdomf_from_email"); -define('TDOMF_OPTION_AUTHOR_THEME_HACK', "tdomf_author_submitter"); -define('TDOMF_OPTION_FORM_ORDER', "tdomf_form_order"); -define('TDOMF_OPTION_ADD_SUBMITTER', "tdomf_add_submitter_info"); -define('TDOMF_CAPABILITY_CAN_SEE_FORM', "tdomf_can_see_form"); -define('TDOMF_STAT_SUBMITTED', "tdomf_stat_submitted"); -define('TDOMF_USER_STATUS_OK', "Normal"); -define('TDOMF_USER_STATUS_BANNED', "Banned"); -define('TDOMF_USER_STATUS_TRUSTED', "Trusted"); -define('TDOMF_KEY_NOTIFY_EMAIL', "_tdomf_notify_email"); - -///////////////// -// 0.8 Settings -// -define('TDOMF_UPLOAD_PERMS',0777); -define('TDOMF_UPLOAD_TIMEOUT',(60 * 60)); // 1 hour -define('TDOMF_KEY_DOWNLOAD_COUNT',"_tdomf_download_count_"); -define('TDOMF_KEY_DOWNLOAD_TYPE',"_tdomf_download_type_"); -define('TDOMF_KEY_DOWNLOAD_PATH',"_tdomf_download_path_"); -define('TDOMF_KEY_DOWNLOAD_NAME',"_tdomf_download_name_"); -define('TDOMF_KEY_DOWNLOAD_CMD_OUTPUT',"_tdomf_download_cmd_output_"); - -///////////////// -// 0.9 Settings -// -define('TDOMF_KEY_DOWNLOAD_THUMB',"_tdomf_download_thumb_"); -define('TDOMF_OPTION_DISABLE_ERROR_MESSAGES',"tdomf_disable_error_messages"); -define('TDOMF_OPTION_EXTRA_LOG_MESSAGES',"tdomf_extra_log_messages"); -define('TDOMF_OPTION_YOUR_SUBMISSIONS',"tdomf_your_submissions"); -define('TDOMF_WIDGET_URLPATH',TDOMF_URLPATH.'widgets/'); - +posts = apply_filters('the_posts', $this->posts); + 1. is single/page [should include category and index?] + 2. what post? + 3. is it tdomf, draft/unmoderation, not spam, viewer is submitter + 4. add to array + This will allow users see their submitted posts, however comments should + be disabled as they cannot be used in preview mode + - What Clickable links in your posts? http://thedeadone.net/forum/?p=500#comment-1598 +*/ + + /* +//////////////////////////////////////////////////////////////////////////////// +TODO for future versions + +Known Bugs +- Upload Link error +- TinyMCE integration problem with AJAX + +New Features +- Option to redirect all comment notifications on submitted posts to the admin (globally or per form) +- Allow moderators append a message to the approved/rejected notification (allows communication between submitter and moderator) +- Widget Manager Menu + * Info about loaded widgets + * Disable loading of specific widgets +- Style Sheet Editor + * Preview + * Select from pre-configured Styles + * Submit new style to include in TDOMF +- Email verification of non-registered users +- Manage Downloads page +- Authors of posts should be able to see "previews" of post +- Get input during validation of form (for capatchas) +- Option to use "Post ready for review" instead of draft for unapproved submitted posts +- Turn Forms into multiple steps +- Shortcode Support + +New Form Options +- Force Preview before submission +- Hide Form on Preview +- Forms can be used to submit links, emails, etc. +- Select Form Style/include Custom CSS + +New Widgets +- Widget to allow user to enter a date to post the submission (as in future post) +- Widget to allow submitter to copy the submission to another email +- Widget that inputs only title + * or that allows formatting of title by + * user-input + * custom field + * username/submitter + * date submitted (requires date/time format) + * PHP code +- Login/Register/Who Am I Widget + +Existing Widget Improvements +- Any widget with a size or length field should be customisable. +- Textfield Class (support numeric, date, email, webpage, etc.) +- Textarea Class +- Copy Widget to another Form +- Individual save +- Upload Files + * Multiple Instances + * Thumbnail size + * Limit size of image by w/h + * Image cropping + * Title field for file links/attachment pages + * Nicer integration: background uploading using iframe + * Prevent submission until files uploaded + * Progress bar +- Content + * TinyMCE Integration + * Allow users to define their own quicktags + * Mechanism to allow sumitter to select where the link/image for upload should go + * Default Value +- Custom Field: Textarea + * TinyMCE Integration + * Allow users to define their own quicktags + * Mechanism to allow sumitter to select where the link/image for upload should go + * Default Value +- Custom Field + * Radio Groups + * Multiple Checkboxes (grid-layout) +- Custom Field: Textfield + * Numeric + * Date +- Custom Field: Select + * Required support +- Tags + * Select from existing tag list or tag cloud + * Select from only a specified set of tags +- 1 Question Captcha + * Random questions for Captcha +- Category + * Co-operate with "Set Category from GET variables" Widget +- Notify Me + * Option to always notify submitter +- Image Captcha + * Do not reload image on every preview (would be resolved by a seperate validation step) +- Text + * Option to not use the form formatting (i.e. no "
    " tags before and after) + * Option to have the text popup (would require a HTML space for the link) +- Set Category from GET variables + * Add options (or at least information) for this widget + * Co-operate with "Categories" Widget +- Who Am I + * Integration with WP-OpenID? + * Allow login as part of form submit +- Categories + * Categories displayed but unselectable + +Template Tags +- Log +- Moderation Queue +- Approved Posts +- File Info +- Country codes on submitter's IP +- Image Tags + +Misc +- Documentation on creating your own widgets + +//////////////////////////////////////////////////////////////////////////////// +*/ + +/////////////////////////////////////////////////// +// Defines and other global vars for this Plugin // +/////////////////////////////////////////////////// + +// Older versions of PHP may not define DIRECTORY_SEPARATOR so define it here, +// just in case. +if(!defined('DIRECTORY_SEPARATOR')) { + define('DIRECTORY_SEPARATOR','/'); +} + +// Build Number (must be a integer) +define("TDOMF_BUILD", "51"); +// Version Number (can be text) +define("TDOMF_VERSION", "0.13.4"); + +/////////////////////////////////////// +// 0.1 to 0.5 Settings (no longer used) +// +define("TDOMF_ACCESS_LEVEL", "tdomf_access_level"); +define("TDOMF_NOTIFY_LEVEL", "tdomf_notify_level"); + +/////////////////////////////////////// +// 0.6 Settings (no longer used) +// +define('TDOMF_NOTIFY','tdomf_notify'); +define("TDOMF_ITEMS_PER_PAGE", 30); +define("TDOMF_POSTS_INDEX", 0); +define("TDOMF_USERS_INDEX", 1); +define("TDOMF_IPS_INDEX", 2); +define("TDOMF_OPTIONS_INDEX", 3); + +///////////////// +// 0.6 Settings +// +define("TDOMF_ACCESS_ROLES", "tdomf_access_roles"); +define("TDOMF_NOTIFY_ROLES", "tdomf_notify_roles"); +define("TDOMF_DEFAULT_CATEGORY", "tdomf_default_category"); +define("TDOMF_DEFAULT_AUTHOR", "tdomf_default_author"); +define("TDOMF_AUTO_FIX_AUTHOR", "tdomf_auto_fix_author"); +define("TDOMF_BANNED_IPS", "tdomf_banned_ips"); +// +// These keys are used to store info about a post, on the post. +// Keys with underscore prefix (i.e. "_") are hidden from the general user. Keys +// without can be modified and displayed using Wordpress normal features such as +// template tags and custom fields editor. +// +define("TDOMF_KEY_FLAG","_tdomf_flag"); +define("TDOMF_KEY_NAME","Author Name"); +define("TDOMF_KEY_EMAIL","Author Email"); +define("TDOMF_KEY_WEB","Author Webpage"); +define("TDOMF_KEY_IP","_tdomf_original_poster_ip"); +define("TDOMF_KEY_USER_ID","_tdomf_original_poster_id"); +define("TDOMF_KEY_USER_NAME","Original Submitter Username"); +// +// This key is very important. It determines if a user is trusted or banned.. +// +define("TDOMF_KEY_STATUS","_tdomf_status"); + + +///////////////// +// 0.7 Settings +// +define('TDOMF_FOLDER', dirname(plugin_basename(__FILE__))); +define('TDOMF_FULLPATH', WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.TDOMF_FOLDER.DIRECTORY_SEPARATOR); +#define('TDOMF_FULLPATH', ABSPATH.PLUGINDIR.DIRECTORY_SEPARATOR.TDOMF_FOLDER.DIRECTORY_SEPARATOR); +define('TDOMF_URLPATH', get_option('siteurl').'/wp-content/plugins/'.TDOMF_FOLDER.'/'); +define('TDOMF_WIDGET_PATH',TDOMF_FULLPATH.'widgets/'); +define('TDOMF_VERSION_CURRENT', "tdomf_version_current"); +define('TDOMF_LOG', "tdomf_log"); +define('TDOMF_OPTION_MODERATION', "tdomf_enable_moderation"); +define('TDOMF_OPTION_TRUST_COUNT', "tdomf_trust_count"); +define('TDOMF_OPTION_ALLOW_EVERYONE', "tdomf_allow_everyone"); +define('TDOMF_OPTION_AJAX', "tdomf_ajax"); +define('TDOMF_OPTION_PREVIEW', "tdomf_preview"); +define('TDOMF_OPTION_FROM_EMAIL', "tdomf_from_email"); +define('TDOMF_OPTION_AUTHOR_THEME_HACK', "tdomf_author_submitter"); +define('TDOMF_OPTION_FORM_ORDER', "tdomf_form_order"); +define('TDOMF_OPTION_ADD_SUBMITTER', "tdomf_add_submitter_info"); +define('TDOMF_CAPABILITY_CAN_SEE_FORM', "tdomf_can_see_form"); +define('TDOMF_STAT_SUBMITTED', "tdomf_stat_submitted"); +define('TDOMF_USER_STATUS_OK', "Normal"); +define('TDOMF_USER_STATUS_BANNED', "Banned"); +define('TDOMF_USER_STATUS_TRUSTED', "Trusted"); +define('TDOMF_KEY_NOTIFY_EMAIL', "_tdomf_notify_email"); + +///////////////// +// 0.8 Settings +// +define('TDOMF_UPLOAD_PERMS',0777); +define('TDOMF_UPLOAD_TIMEOUT',(60 * 60)); // 1 hour +define('TDOMF_KEY_DOWNLOAD_COUNT',"_tdomf_download_count_"); +define('TDOMF_KEY_DOWNLOAD_TYPE',"_tdomf_download_type_"); +define('TDOMF_KEY_DOWNLOAD_PATH',"_tdomf_download_path_"); +define('TDOMF_KEY_DOWNLOAD_NAME',"_tdomf_download_name_"); +define('TDOMF_KEY_DOWNLOAD_CMD_OUTPUT',"_tdomf_download_cmd_output_"); + +///////////////// +// 0.9 Settings +// +define('TDOMF_KEY_DOWNLOAD_THUMB',"_tdomf_download_thumb_"); +define('TDOMF_OPTION_DISABLE_ERROR_MESSAGES',"tdomf_disable_error_messages"); +define('TDOMF_OPTION_EXTRA_LOG_MESSAGES',"tdomf_extra_log_messages"); +define('TDOMF_OPTION_YOUR_SUBMISSIONS',"tdomf_your_submissions"); +define('TDOMF_WIDGET_URLPATH',TDOMF_URLPATH.'widgets/'); + //////////////// // 0.10 Settings // @@ -411,7 +411,7 @@ define("TDOMF_HIDE_REGISTER_GLOBAL_ERROR", false); define('TDOMF_OPTION_WIDGET_MAX_WIDTH',"tdomf_form_widget_max_width"); -define('TDOMF_OPTION_WIDGET_MAX_LENGTH',"tdomf_form_widget_max_length"); +define('TDOMF_OPTION_WIDGET_MAX_HEIGHT',"tdomf_form_widget_max_height"); ////////////////// // 0.10.3 Settings @@ -552,280 +552,280 @@ define('TDOMF_KEY_FIELDS', "_tdomf_fields"); define('TDOMF_KEY_CUSTOM_FIELDS', "_tdomf_custom_fields"); -////////////////////////////////////////////////// -// loading text domain for language translation -// -load_plugin_textdomain('tdomf',PLUGINDIR.DIRECTORY_SEPARATOR.TDOMF_FOLDER); - -///////////////////////////////////////// -// Loading "hacks" here before pluggable -// -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-hacks.php'); - -////////////////////////////////////////////////////////////////////////// -// A potential fix for WordpressMU (WordpressMU is officially unsupported) -// -require_once(ABSPATH . 'wp-includes/pluggable.php'); - -// Is this a Wordpress < 2.5 install? -// -function tdomf_wp23() { - global $wp_db_version; - #if($wp_db_verison <= 6124) - # return true; - return !tdomf_wp25(); -} - -// Is this a Wordpress >= 2.5 install? -// -function tdomf_wp25() { - global $wp_db_version; - if($wp_db_version >= 7558) { - return true; - } - return false; -} - -// Is this a Wordpress >= 2.7 -// -function tdomf_wp27() { - global $wp_version; - return version_compare($wp_version,"2.7-beta3",">="); -} - -/////////////////////////////////// -// Configure Backend Admin Menus // -/////////////////////////////////// - -add_action('admin_menu', 'tdomf_add_menus'); -function tdomf_add_menus() -{ - $unmod_count = tdomf_get_unmoderated_posts_count(); - $unmod_count += tdomf_get_edits(array('state' => 'unapproved', 'count' => true, 'unique_post_ids' => true)); - - /*if(tdomf_wp25() && $unmod_count > 0) { - add_menu_page(__('TDO Mini Forms', 'tdomf'), sprintf(__("TDO Mini Forms %d", 'tdomf'), $unmod_count, $unmod_count), 'edit_others_posts', TDOMF_FOLDER, 'tdomf_overview_menu'); - } else {*/ - add_menu_page(__('TDO Mini Forms', 'tdomf'), __('TDO Mini Forms', 'tdomf'), 'edit_others_posts', TDOMF_FOLDER, 'tdomf_overview_menu'); - /*}*/ - - // Options - add_submenu_page( TDOMF_FOLDER , __('Options', 'tdomf'), __('Options', 'tdomf'), 'manage_options', 'tdomf_show_options_menu', 'tdomf_show_options_menu'); - // - // Form Options - add_submenu_page( TDOMF_FOLDER , __('Form Options', 'tdomf'), __('Form Options', 'tdomf'), 'manage_options', 'tdomf_show_form_options_menu', 'tdomf_show_form_options_menu'); - // - // Form Widgets - add_submenu_page( TDOMF_FOLDER , __('Form Creator', 'tdomf'), __('Form Creator', 'tdomf'), 'manage_options', 'tdomf_show_form_menu', 'tdomf_show_form_menu'); - // - // Form Hacker - add_submenu_page( TDOMF_FOLDER , __('Form Hacker', 'tdomf'), __('Form Hacker', 'tdomf'), 'manage_options', 'tdomf_show_form_hacker', 'tdomf_show_form_hacker'); - // - // Form Export - add_submenu_page( TDOMF_FOLDER , __('Form Export', 'tdomf'), __('Form Export', 'tdomf'), 'manage_options', 'tdomf_show_form_export_menu', 'tdomf_show_form_export_menu'); - // - // Moderation Queue - if(tdomf_is_moderation_in_use()) { - add_submenu_page( TDOMF_FOLDER , __('Moderation', 'tdomf'), sprintf(__('Moderation (%d)', 'tdomf'), $unmod_count), 'edit_others_posts', 'tdomf_show_mod_posts_menu', 'tdomf_show_mod_posts_menu'); - } - else { - add_submenu_page( TDOMF_FOLDER , __('Moderation', 'tdomf'), __('Moderation', 'tdomf'), 'edit_others_posts', 'tdomf_show_mod_posts_menu', 'tdomf_show_mod_posts_menu'); - } - // - // Manage Submitters - add_submenu_page( TDOMF_FOLDER , __('Users and IPs', 'tdomf'), __('Users and IPs', 'tdomf'), 'edit_others_posts', 'tdomf_show_manage_menu', 'tdomf_show_manage_menu'); - // - // Log - add_submenu_page( TDOMF_FOLDER , __('Log', 'tdomf'), __('Log', 'tdomf'), 'manage_options', 'tdomf_show_log_menu', 'tdomf_show_log_menu'); - // - // Uninstall - add_submenu_page( TDOMF_FOLDER , __('Uninstall', 'tdomf'), __('Uninstall', 'tdomf'), 'manage_options', 'tdomf_show_uninstall_menu', 'tdomf_show_uninstall_menu'); - - // - // Your submissions - if(get_option(TDOMF_OPTION_YOUR_SUBMISSIONS)) { - add_submenu_page('profile.php', 'Your Submissions', 'Your Submissions', 0, 'tdomf_your_submissions', 'tdomf_show_your_submissions_menu'); - } -} - -////////////////////////////////// -// Load the rest of the plugin! // -////////////////////////////////// - -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-log-functions.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-widget-functions.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-template-functions.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-spam.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-form.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-notify.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-upload-functions.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-theme-widgets.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-db.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-msgs.php'); -require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-widget-classes.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-overview.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-edit-post-panel.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-form-options.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-form-export.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-options.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-edit-form.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-log.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-moderation.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-manage.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-your-submissions.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-uninstall.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-form-hacker.php'); -require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-export.php'); - -///////////////////////// -// What's new since... // -///////////////////////// - -function tdomf_new_features() { - $last_version = get_option(TDOMF_VERSION_LAST); - $features = ""; - - if($last_version == false) { return false; } - - // 29 = 0.10.4 - if($last_version <= 29) { - - $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu#spam"; - $features .= "
  • ".sprintf(__('Integration with Akismet for SPAM protection','tdomf'),$link)."
  • "; - - $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#queue"; - $features .= "
  • ".sprintf(__('Automatically schedule approved posts!','tdomf'),$link)."
  • "; - - $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#throttle"; - $features .= "
  • ".sprintf(__('Add submission throttling rules to your form!','tdomf'),$link)."
  • "; - - if(current_user_can('manage_options')) { - $link = "admin.php?page=".TDOMF_FOLDER.DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."tdomf-info.php&text"; - $link2 = "admin.php?page=".TDOMF_FOLDER.DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."tdomf-info.php&html"; - $features .= "
  • ".sprintf(__('View tdomfinfo() in text and html-code. Useful for copying and pasting!',"tdomf"),$link,$link2)."
  • "; - } - - $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#import"; - $features .= "
  • ".sprintf(__('Import and export individual form settings','tdomf'),$link)."
  • "; - - $link = get_bloginfo('wpurl')."/wp-admin/widgets.php"; - $features .= "
  • ".sprintf(__('New widget for your theme: Top Submitters','tdomf'),$link)."
  • "; - } - // 30 = 0.11b - // 31 = 0.11 - // 32 = 0.11.1 (bug fixes) - if($last_version <= 32) { - - $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#ajax"; - $features .= "
  • ".sprintf(__('AJAX support for forms!','tdomf'),$link)."
  • "; - - $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_form_hacker"; - $features .= "
  • ".sprintf(__('Hack the appearance of your form!','tdomf'),$link)."
  • "; - - $link = get_bloginfo('wpurl')."/wp-admin/admin.phppage=tdomf_show_form_menu&form=".tdomf_get_first_form_id(); - $features .= "
  • ".sprintf(__('Text widget updated to support macros and php code','tdomf'),$link)."
  • "; - - $link = get_bloginfo('wpurl')."/wp-admin/admin.phppage=tdomf_show_form_menu&form=".tdomf_get_first_form_id(); - $features .= "
  • ".sprintf(__('Categories widget can now be displayed as checkboxes or radio buttons','tdomf'),$link)."
  • "; - - $link = get_bloginfo('wpurl')."/wp-admin/admin.phppage=tdomf_show_form_menu&form=".tdomf_get_first_form_id(); - $features .= "
  • ".sprintf(__('New Widget: Append. Allows you add text to a submitted post. It can even run PHP code.','tdomf'),$link)."
  • "; - - $features .= "
  • ".__('New Template Tags: tdomf_get_the_submitter_email and tdomf_the_submitter_email','tdomf')."
  • "; - } - // 33 = 0.12b - // 34 = 0.12 - // 40 = 0.12.3 - if($last_version < 40) { - $features .= "
  • ".__("Auto Respond Email widget for your form","tdomf")."
  • "; - $features .= "
  • ".__("Ban User and IP links directly from the moderation email","tdomf")."
  • "; - $features .= "
  • ".__("The moderation emails that are sent for admins can now be left turned on even if moderation is turned off","tdomf")."
  • "; - } - // 41 = 0.12.4 - if($last_version < 41) { - $features .= "
  • ".__("Improved Error Reporting","tdomf")."
  • "; - $features .= "
  • ".__("Form toolbar on all form pages (Widgets and Form Hacker)","tdomf")."
  • "; - $features .= "
  • ".__("Include option implemented for Categories widget","tdomf")."
  • "; - $features .= "
  • ".__("Import/Export restored and improved","tdomf")."
  • "; - $features .= "
  • ".__("Default Generated Forms are now W3C compliant","tdomf")."
  • "; - $features .= "
  • ".__("Comment Notification from Submitted Posts no longer go to the Submitter unless they can modify the comments","tdomf")."
  • "; - } - // 43 = 0.12.5 - if($last_version < 43) { - $features .= "
  • ".__("Excerpt Widget","tdomf")."
  • "; - $features .= "
  • ".__("Comments Management Widget","tdomf")."
  • "; - $features .= "
  • ".__("Include option implemented for Categories widget (fixed)","tdomf")."
  • "; - $features .= "
  • ".__("Order by and Sort options for Categories widget","tdomf")."
  • "; - $features .= "
  • ".__("Integration with Subscribe to Comments plugin via widget","tdomf")."
  • "; - $features .= "
  • ".__("Publish now button","tdomf")."
  • "; - $features .= "
  • ".__("Specify Email Addresses instead of Roles to recieve Moderation notifications","tdomf")."
  • "; - $features .= "
  • ".__('Default tags, required and enable/disable user adding tags options for Tags widget','tdomf').'
  • '; - } - // 44 = pre-0.13 release - if($last_version < 44) { - $features .= "
  • ".__("More powerful form access configuration. Now you can select by capability and user as well as role!","tdomf")."
  • "; - $features .= "
  • ".__("2.7 Wordpress Compatibility","tdomf")."
  • "; - $features .= "
  • ".__("Can now turn off auto-publishing of users with publishing rights","tdomf")."
  • "; - $features .= "
  • ".__("New Permalink Widget","tdomf")."
  • "; - $features .= "
  • ".__("New GeoMashup Integration Widget","tdomf")."
  • "; - } - // 46 = 0.12.7 - if($last_version < 46) { - $features .= "
  • ".__("Auto Respond Email widget can now provide a link to flag posts using a Custom Field","tdomf")."
  • "; - } - // 47 = 0.13 - if($last_version < 47) { - $features .= "
  • ".__("You can now created forms to edit posts and pages!","tdomf")."
  • "; - } - // 48 = 0.13.1 - // 49 = 0.13.2 - if($last_version < 49) { - $features .= "
  • ".__("More Spam Checking options added. Can now be configured per form!","tdomf")."
  • "; - } - // 50 = 0.13.3 - if($last_version < 50) { - $features .= "
  • ".__("Filter by user, ip and form on moderations screen","tdomf")."
  • "; - $features .= "
  • ".__("Enable syntax code highlighting on Form Hacker and messages","tdomf")."
  • "; - $features .= "
  • ".__("Special revision page for comparing revisions created by TDOMF","tdomf")."
  • "; - } - // 51 = 0.13.4 - - if(!empty($features)) { - return ""; - } - - return false; -} - -///////////////////////// -// Start/Init/Upgrade // -//////////////////////// - -function tdomf_init(){ - - // Pre 0.7 or a fresh install! - if(get_option(TDOMF_VERSION_CURRENT) == false) - { - add_option(TDOMF_VERSION_CURRENT,TDOMF_BUILD); - - // Some defaults for new options! - add_option(TDOMF_OPTION_MODERATION,true); - add_option(TDOMF_OPTION_PREVIEW,true); - add_option(TDOMF_OPTION_TRUST_COUNT,-1); - add_option(TDOMF_OPTION_YOUR_SUBMISSIONS,true); +////////////////////////////////////////////////// +// loading text domain for language translation +// +load_plugin_textdomain('tdomf',PLUGINDIR.DIRECTORY_SEPARATOR.TDOMF_FOLDER); + +///////////////////////////////////////// +// Loading "hacks" here before pluggable +// +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-hacks.php'); + +////////////////////////////////////////////////////////////////////////// +// A potential fix for WordpressMU (WordpressMU is officially unsupported) +// +require_once(ABSPATH . 'wp-includes/pluggable.php'); + +// Is this a Wordpress < 2.5 install? +// +function tdomf_wp23() { + global $wp_db_version; + #if($wp_db_verison <= 6124) + # return true; + return !tdomf_wp25(); +} + +// Is this a Wordpress >= 2.5 install? +// +function tdomf_wp25() { + global $wp_db_version; + if($wp_db_version >= 7558) { + return true; + } + return false; +} + +// Is this a Wordpress >= 2.7 +// +function tdomf_wp27() { + global $wp_version; + return version_compare($wp_version,"2.7-beta3",">="); +} + +/////////////////////////////////// +// Configure Backend Admin Menus // +/////////////////////////////////// + +add_action('admin_menu', 'tdomf_add_menus'); +function tdomf_add_menus() +{ + $unmod_count = tdomf_get_unmoderated_posts_count(); + $unmod_count += tdomf_get_edits(array('state' => 'unapproved', 'count' => true, 'unique_post_ids' => true)); + + /*if(tdomf_wp25() && $unmod_count > 0) { + add_menu_page(__('TDO Mini Forms', 'tdomf'), sprintf(__("TDO Mini Forms %d", 'tdomf'), $unmod_count, $unmod_count), 'edit_others_posts', TDOMF_FOLDER, 'tdomf_overview_menu'); + } else {*/ + add_menu_page(__('TDO Mini Forms', 'tdomf'), __('TDO Mini Forms', 'tdomf'), 'edit_others_posts', TDOMF_FOLDER, 'tdomf_overview_menu'); + /*}*/ + + // Options + add_submenu_page( TDOMF_FOLDER , __('Options', 'tdomf'), __('Options', 'tdomf'), 'manage_options', 'tdomf_show_options_menu', 'tdomf_show_options_menu'); + // + // Form Options + add_submenu_page( TDOMF_FOLDER , __('Form Options', 'tdomf'), __('Form Options', 'tdomf'), 'manage_options', 'tdomf_show_form_options_menu', 'tdomf_show_form_options_menu'); + // + // Form Widgets + add_submenu_page( TDOMF_FOLDER , __('Form Creator', 'tdomf'), __('Form Creator', 'tdomf'), 'manage_options', 'tdomf_show_form_menu', 'tdomf_show_form_menu'); + // + // Form Hacker + add_submenu_page( TDOMF_FOLDER , __('Form Hacker', 'tdomf'), __('Form Hacker', 'tdomf'), 'manage_options', 'tdomf_show_form_hacker', 'tdomf_show_form_hacker'); + // + // Form Export + add_submenu_page( TDOMF_FOLDER , __('Form Export', 'tdomf'), __('Form Export', 'tdomf'), 'manage_options', 'tdomf_show_form_export_menu', 'tdomf_show_form_export_menu'); + // + // Moderation Queue + if(tdomf_is_moderation_in_use()) { + add_submenu_page( TDOMF_FOLDER , __('Moderation', 'tdomf'), sprintf(__('Moderation (%d)', 'tdomf'), $unmod_count), 'edit_others_posts', 'tdomf_show_mod_posts_menu', 'tdomf_show_mod_posts_menu'); + } + else { + add_submenu_page( TDOMF_FOLDER , __('Moderation', 'tdomf'), __('Moderation', 'tdomf'), 'edit_others_posts', 'tdomf_show_mod_posts_menu', 'tdomf_show_mod_posts_menu'); + } + // + // Manage Submitters + add_submenu_page( TDOMF_FOLDER , __('Users and IPs', 'tdomf'), __('Users and IPs', 'tdomf'), 'edit_others_posts', 'tdomf_show_manage_menu', 'tdomf_show_manage_menu'); + // + // Log + add_submenu_page( TDOMF_FOLDER , __('Log', 'tdomf'), __('Log', 'tdomf'), 'manage_options', 'tdomf_show_log_menu', 'tdomf_show_log_menu'); + // + // Uninstall + add_submenu_page( TDOMF_FOLDER , __('Uninstall', 'tdomf'), __('Uninstall', 'tdomf'), 'manage_options', 'tdomf_show_uninstall_menu', 'tdomf_show_uninstall_menu'); + + // + // Your submissions + if(get_option(TDOMF_OPTION_YOUR_SUBMISSIONS)) { + add_submenu_page('profile.php', 'Your Submissions', 'Your Submissions', 0, 'tdomf_your_submissions', 'tdomf_show_your_submissions_menu'); + } +} + +////////////////////////////////// +// Load the rest of the plugin! // +////////////////////////////////// + +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-log-functions.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-widget-functions.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-template-functions.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-spam.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-form.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-notify.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-upload-functions.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-theme-widgets.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-db.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-msgs.php'); +require_once(TDOMF_FULLPATH.'include'.DIRECTORY_SEPARATOR.'tdomf-widget-classes.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-overview.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-edit-post-panel.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-form-options.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-form-export.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-options.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-edit-form.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-log.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-moderation.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-manage.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-your-submissions.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-uninstall.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-form-hacker.php'); +require_once(TDOMF_FULLPATH.'admin'.DIRECTORY_SEPARATOR.'tdomf-export.php'); + +///////////////////////// +// What's new since... // +///////////////////////// + +function tdomf_new_features() { + $last_version = get_option(TDOMF_VERSION_LAST); + $features = ""; + + if($last_version == false) { return false; } + + // 29 = 0.10.4 + if($last_version <= 29) { + + $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu#spam"; + $features .= "
  • ".sprintf(__('Integration with Akismet for SPAM protection','tdomf'),$link)."
  • "; + + $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#queue"; + $features .= "
  • ".sprintf(__('Automatically schedule approved posts!','tdomf'),$link)."
  • "; + + $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#throttle"; + $features .= "
  • ".sprintf(__('Add submission throttling rules to your form!','tdomf'),$link)."
  • "; + + if(current_user_can('manage_options')) { + $link = "admin.php?page=".TDOMF_FOLDER.DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."tdomf-info.php&text"; + $link2 = "admin.php?page=".TDOMF_FOLDER.DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."tdomf-info.php&html"; + $features .= "
  • ".sprintf(__('View tdomfinfo() in text and html-code. Useful for copying and pasting!',"tdomf"),$link,$link2)."
  • "; + } + + $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#import"; + $features .= "
  • ".sprintf(__('Import and export individual form settings','tdomf'),$link)."
  • "; + + $link = get_bloginfo('wpurl')."/wp-admin/widgets.php"; + $features .= "
  • ".sprintf(__('New widget for your theme: Top Submitters','tdomf'),$link)."
  • "; + } + // 30 = 0.11b + // 31 = 0.11 + // 32 = 0.11.1 (bug fixes) + if($last_version <= 32) { + + $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_options_menu&form=".tdomf_get_first_form_id()."#ajax"; + $features .= "
  • ".sprintf(__('AJAX support for forms!','tdomf'),$link)."
  • "; + + $link = get_bloginfo('wpurl')."/wp-admin/admin.php?page=tdomf_show_form_hacker"; + $features .= "
  • ".sprintf(__('Hack the appearance of your form!','tdomf'),$link)."
  • "; + + $link = get_bloginfo('wpurl')."/wp-admin/admin.phppage=tdomf_show_form_menu&form=".tdomf_get_first_form_id(); + $features .= "
  • ".sprintf(__('Text widget updated to support macros and php code','tdomf'),$link)."
  • "; + + $link = get_bloginfo('wpurl')."/wp-admin/admin.phppage=tdomf_show_form_menu&form=".tdomf_get_first_form_id(); + $features .= "
  • ".sprintf(__('Categories widget can now be displayed as checkboxes or radio buttons','tdomf'),$link)."
  • "; + + $link = get_bloginfo('wpurl')."/wp-admin/admin.phppage=tdomf_show_form_menu&form=".tdomf_get_first_form_id(); + $features .= "
  • ".sprintf(__('New Widget: Append. Allows you add text to a submitted post. It can even run PHP code.','tdomf'),$link)."
  • "; + + $features .= "
  • ".__('New Template Tags: tdomf_get_the_submitter_email and tdomf_the_submitter_email','tdomf')."
  • "; + } + // 33 = 0.12b + // 34 = 0.12 + // 40 = 0.12.3 + if($last_version < 40) { + $features .= "
  • ".__("Auto Respond Email widget for your form","tdomf")."
  • "; + $features .= "
  • ".__("Ban User and IP links directly from the moderation email","tdomf")."
  • "; + $features .= "
  • ".__("The moderation emails that are sent for admins can now be left turned on even if moderation is turned off","tdomf")."
  • "; + } + // 41 = 0.12.4 + if($last_version < 41) { + $features .= "
  • ".__("Improved Error Reporting","tdomf")."
  • "; + $features .= "
  • ".__("Form toolbar on all form pages (Widgets and Form Hacker)","tdomf")."
  • "; + $features .= "
  • ".__("Include option implemented for Categories widget","tdomf")."
  • "; + $features .= "
  • ".__("Import/Export restored and improved","tdomf")."
  • "; + $features .= "
  • ".__("Default Generated Forms are now W3C compliant","tdomf")."
  • "; + $features .= "
  • ".__("Comment Notification from Submitted Posts no longer go to the Submitter unless they can modify the comments","tdomf")."
  • "; + } + // 43 = 0.12.5 + if($last_version < 43) { + $features .= "
  • ".__("Excerpt Widget","tdomf")."
  • "; + $features .= "
  • ".__("Comments Management Widget","tdomf")."
  • "; + $features .= "
  • ".__("Include option implemented for Categories widget (fixed)","tdomf")."
  • "; + $features .= "
  • ".__("Order by and Sort options for Categories widget","tdomf")."
  • "; + $features .= "
  • ".__("Integration with Subscribe to Comments plugin via widget","tdomf")."
  • "; + $features .= "
  • ".__("Publish now button","tdomf")."
  • "; + $features .= "
  • ".__("Specify Email Addresses instead of Roles to recieve Moderation notifications","tdomf")."
  • "; + $features .= "
  • ".__('Default tags, required and enable/disable user adding tags options for Tags widget','tdomf').'
  • '; + } + // 44 = pre-0.13 release + if($last_version < 44) { + $features .= "
  • ".__("More powerful form access configuration. Now you can select by capability and user as well as role!","tdomf")."
  • "; + $features .= "
  • ".__("2.7 Wordpress Compatibility","tdomf")."
  • "; + $features .= "
  • ".__("Can now turn off auto-publishing of users with publishing rights","tdomf")."
  • "; + $features .= "
  • ".__("New Permalink Widget","tdomf")."
  • "; + $features .= "
  • ".__("New GeoMashup Integration Widget","tdomf")."
  • "; + } + // 46 = 0.12.7 + if($last_version < 46) { + $features .= "
  • ".__("Auto Respond Email widget can now provide a link to flag posts using a Custom Field","tdomf")."
  • "; + } + // 47 = 0.13 + if($last_version < 47) { + $features .= "
  • ".__("You can now created forms to edit posts and pages!","tdomf")."
  • "; + } + // 48 = 0.13.1 + // 49 = 0.13.2 + if($last_version < 49) { + $features .= "
  • ".__("More Spam Checking options added. Can now be configured per form!","tdomf")."
  • "; + } + // 50 = 0.13.3 + if($last_version < 50) { + $features .= "
  • ".__("Filter by user, ip and form on moderations screen","tdomf")."
  • "; + $features .= "
  • ".__("Enable syntax code highlighting on Form Hacker and messages","tdomf")."
  • "; + $features .= "
  • ".__("Special revision page for comparing revisions created by TDOMF","tdomf")."
  • "; + } + // 51 = 0.13.4 + + if(!empty($features)) { + return ""; + } + + return false; +} + +///////////////////////// +// Start/Init/Upgrade // +//////////////////////// + +function tdomf_init(){ + + // Pre 0.7 or a fresh install! + if(get_option(TDOMF_VERSION_CURRENT) == false) + { + add_option(TDOMF_VERSION_CURRENT,TDOMF_BUILD); + + // Some defaults for new options! + add_option(TDOMF_OPTION_MODERATION,true); + add_option(TDOMF_OPTION_PREVIEW,true); + add_option(TDOMF_OPTION_TRUST_COUNT,-1); + add_option(TDOMF_OPTION_YOUR_SUBMISSIONS,true); add_option(TDOMF_OPTION_WIDGET_MAX_WIDTH,500); - add_option(TDOMF_OPTION_WIDGET_MAX_LENGTH,400); - } - - // Pre 0.9.3 (beta)/16 - if(intval(get_option(TDOMF_VERSION_CURRENT)) < 16) { - add_option(TDOMF_OPTION_YOUR_SUBMISSIONS,true); - } - + add_option(TDOMF_OPTION_WIDGET_MAX_HEIGHT,400); + } + + // Pre 0.9.3 (beta)/16 + if(intval(get_option(TDOMF_VERSION_CURRENT)) < 16) { + add_option(TDOMF_OPTION_YOUR_SUBMISSIONS,true); + } + // Pre WP 2.5/0.10.2 if(intval(get_option(TDOMF_VERSION_CURRENT)) < 26) { add_option(TDOMF_OPTION_WIDGET_MAX_WIDTH,500); - add_option(TDOMF_OPTION_WIDGET_MAX_LENGTH,400); + add_option(TDOMF_OPTION_WIDGET_MAX_HEIGHT,400); } if(get_option(TDOMF_OPTION_VERIFICATION_METHOD) == false) { @@ -852,14 +852,14 @@ } } - // Update build number - if(get_option(TDOMF_VERSION_CURRENT) != TDOMF_BUILD) { - update_option(TDOMF_VERSION_LAST,get_option(TDOMF_VERSION_CURRENT)); - update_option(TDOMF_VERSION_CURRENT,TDOMF_BUILD); - } -} - -tdomf_db_create_tables(); -tdomf_load_widgets(); - -?> + // Update build number + if(get_option(TDOMF_VERSION_CURRENT) != TDOMF_BUILD) { + update_option(TDOMF_VERSION_LAST,get_option(TDOMF_VERSION_CURRENT)); + update_option(TDOMF_VERSION_CURRENT,TDOMF_BUILD); + } +} + +tdomf_db_create_tables(); +tdomf_load_widgets(); + +?>