Example #1
0
function tdomf_overview_admin_head()
{
    global $wp_version;
    if (tdomf_wp25() && preg_match('/page=tdo-mini-forms/', $_SERVER['REQUEST_URI'])) {
        ?>
   <style type="text/css">
      #zeitgeist {
	background: #eee;
	border: 1px solid #c5c5c5;
	float: right;
	font-size: 90%;
	margin-bottom: .5em;
	margin-left: 1em;
	margin-top: .5em;
	padding: 1em;
	width: 40%;
      }
      #zeitgeist h2, fieldset legend a {
	background: none;
}

/** html*/ 
#zeitgeist h2 {
	padding-top: 10px;
  width: 100%;
}

#zeitgeist h3 {
	border-bottom: 1px solid #ccc;
	font-size: 16px;
	margin: 1em 0 0;
}

#zeitgeist h3 cite {
	font-size: 12px;
	font-style: normal;
}

#zeitgeist li, #zeitgeist p {
	margin: .2em 0;
}

#zeitgeist ul {
	margin: 0 0 .3em .6em;
	padding: 0 0 0 .6em;
}
   </style>
   <?php 
    }
}
Example #2
0
function tdomf_wp23()
{
    global $wp_db_version;
    #if($wp_db_verison <= 6124)
    #  return true;
    return !tdomf_wp25();
}
Example #3
0
function tdomf_handle_options_actions()
{
    global $wpdb, $wp_roles;
    $message = "";
    $retValue = false;
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'create_dummy_user') {
        check_admin_referer('tdomf-create-dummy-user');
        tdomf_create_dummy_user();
        $message = "Dummy user created for Default Author!<br/>";
    } else {
        if (isset($_REQUEST['save_settings']) && !isset($_REQUEST['tdomf_form_id'])) {
            check_admin_referer('tdomf-options-save');
            // Default Author
            $def_aut = $_POST['tdomf_def_user'];
            if (!empty($def_aut) && !is_numeric($def_aut)) {
                if (($userdata = get_userdatabylogin($def_aut)) != false) {
                    $def_aut = $userdata->ID;
                } else {
                    $message .= "<font color='red'>" . sprintf(__("The user %s is not a valid user and cannot be used for Default Author", "tdomf"), $def_aut) . "</font><br/>";
                    $def_aut = false;
                }
            }
            update_option(TDOMF_DEFAULT_AUTHOR, $def_aut);
            // Author and Submitter fix
            $fix_aut = false;
            if (isset($_POST['tdomf_autocorrect_author'])) {
                $fix_aut = true;
            }
            update_option(TDOMF_AUTO_FIX_AUTHOR, $fix_aut);
            //Auto Trust Submitter Count
            $cnt = -1;
            if (isset($_POST['tdomf_trust_count']) && !empty($_POST['tdomf_trust_count']) && is_numeric($_POST['tdomf_trust_count'])) {
                $cnt = intval($_POST['tdomf_trust_count']);
            }
            update_option(TDOMF_OPTION_TRUST_COUNT, $cnt);
            //Author theme hack
            $author_theme_hack = false;
            if (isset($_POST['tdomf_author_theme_hack'])) {
                $author_theme_hack = true;
            }
            update_option(TDOMF_OPTION_AUTHOR_THEME_HACK, $author_theme_hack);
            //Add submitter info
            $add_submitter = false;
            if (isset($_POST['tdomf_add_submitter'])) {
                $add_submitter = true;
            }
            update_option(TDOMF_OPTION_ADD_SUBMITTER, $add_submitter);
            //disable errors
            $disable_errors = false;
            if (isset($_POST['tdomf_disable_errors'])) {
                $disable_errors = true;
            }
            update_option(TDOMF_OPTION_DISABLE_ERROR_MESSAGES, $disable_errors);
            // extra log messages
            $extra_log = false;
            if (isset($_POST['tdomf_extra_log'])) {
                $extra_log = true;
            }
            update_option(TDOMF_OPTION_EXTRA_LOG_MESSAGES, $extra_log);
            // your submissions
            $your_submissions = false;
            if (isset($_POST['tdomf_your_submissions'])) {
                $your_submissions = true;
            }
            update_option(TDOMF_OPTION_YOUR_SUBMISSIONS, $your_submissions);
            // default widget max sizes
            if (tdomf_wp25()) {
                $widget_max_width = intval($_POST['widget_max_width']);
                update_option(TDOMF_OPTION_WIDGET_MAX_WIDTH, $widget_max_width);
                $widget_max_height = intval($_POST['widget_max_height']);
                update_option(TDOMF_OPTION_WIDGET_MAX_HEIGHT, $widget_max_height);
            }
            // verification method
            $tdomf_verify = $_POST['tdomf_verify'];
            update_option(TDOMF_OPTION_VERIFICATION_METHOD, $tdomf_verify);
            $tdomf_form_data = $_POST['tdomf_form_data'];
            update_option(TDOMF_OPTION_FORM_DATA_METHOD, $tdomf_form_data);
            // Show links on moderation screen
            $tdomf_mod_show_links = isset($_POST['tdomf_mod_show_links']);
            update_option(TDOMF_OPTION_MOD_SHOW_LINKS, $tdomf_mod_show_links);
            // spam options
            $message .= tdomf_handle_spam_options_actions();
            // log options
            $tdomf_log_max_size = intval($_POST['tdomf_log_max_size']);
            update_option(TDOMF_OPTION_LOG_MAX_SIZE, $tdomf_log_max_size);
            $message .= "Options Saved!<br/>";
            tdomf_log_message("Options Saved");
        }
    }
    // Warnings
    $message .= tdomf_get_error_messages(false);
    if (!empty($message)) {
        ?>
   <div id="message" class="updated fade"><p><?php 
        echo $message;
        ?>
</p></div>
   <?php 
    }
    return $retValue;
}
function tdomf_forms_under_title_toolbar($form_id_in = false, $current = 'tdomf_show_form_options_menu')
{
    $form_ids = tdomf_get_form_ids();
    $pages = tdomf_get_option_form(TDOMF_OPTION_CREATEDPAGES, $form_id_in);
    if (tdomf_wp23()) {
        /* do nothing */
    } else {
        if (tdomf_wp27()) {
            ?>

        <ul class="subsubsub"> 
            <li> <a <?php 
            if ($current == 'tdomf_show_form_options_menu') {
                ?>
class="current" <?php 
            }
            ?>
href="admin.php?page=tdomf_show_form_options_menu&form=<?php 
            echo $form_id_in;
            ?>
"><?php 
            printf(__("Options", "tdomf"), $form_id_in);
            ?>
</a> |</li>
            <li> <a <?php 
            if ($current == 'tdomf_show_form_menu') {
                ?>
class="current" <?php 
            }
            ?>
href="admin.php?page=tdomf_show_form_menu&form=<?php 
            echo $form_id_in;
            ?>
"><?php 
            printf(__("Create", "tdomf"), $form_id_in);
            ?>
</a> |</li>
            <li> <a <?php 
            if ($current == 'tdomf_show_form_hacker' && !isset($_REQUEST['text'])) {
                ?>
class="current" <?php 
            }
            ?>
href="admin.php?page=tdomf_show_form_hacker&form=<?php 
            echo $form_id_in;
            ?>
"><?php 
            printf(__("Hack", "tdomf"), $form_id_in);
            ?>
</a> |</li>
            <li> <a <?php 
            if ($current == 'tdomf_show_form_hacker' && isset($_REQUEST['text'])) {
                ?>
class="current" <?php 
            }
            ?>
href="admin.php?page=tdomf_show_form_hacker&text&form=<?php 
            echo $form_id_in;
            ?>
"><?php 
            printf(__("Messages", "tdomf"), $form_id_in);
            ?>
</a> |</li>
            <li> <a <?php 
            if ($current == 'tdomf_show_form_export_menu') {
                ?>
class="current" <?php 
            }
            ?>
href="admin.php?page=tdomf_show_form_export_menu&form=<?php 
            echo $form_id_in;
            ?>
"><?php 
            printf(__("Export", "tdomf"), $form_id_in);
            ?>
</a> |</li>
            <?php 
            if ($pages != false && is_array($pages)) {
                ?>
          
                <li><a href="<?php 
                echo get_permalink($pages[0]);
                ?>
" title="<?php 
                echo htmlentities(_e("Live on your blog!", "tdomf"), ENT_QUOTES);
                ?>
" ><?php 
                _e("View Page &raquo;", "tdomf");
                ?>
</a> |</li>
            <?php 
            }
            ?>
            <?php 
            if (tdomf_get_option_form(TDOMF_OPTION_INCLUDED_YOUR_SUBMISSIONS, $form_id_in) && get_option(TDOMF_OPTION_YOUR_SUBMISSIONS)) {
                ?>
                <li><a href="users.php?page=tdomf_your_submissions#tdomf_form<?php 
                echo $form_id_in;
                ?>
" title="<?php 
                _e("Included on the 'Your Submissions' page!", 'tdomf');
                ?>
" >
                <?php 
                _e("View on 'Your Submissions' &raquo;", "tdomf");
                ?>
</a> |</li>
            <?php 
            }
            ?>
        </ul> 
          
      <div class="tablenav">
      
          <div class="alignleft">
            <a class="button" title="<?php 
            echo htmlentities(__('Create a new form', 'tdomf'), ENT_QUOTES);
            ?>
" href="<?php 
            echo wp_nonce_url("admin.php?page=tdomf_show_form_options_menu&new", 'tdomf-new-form');
            ?>
">
            <?php 
            _e("New", "tdomf");
            ?>
</a>
    
            <a class="button" title="<?php 
            echo htmlentities(__('Delete this form', 'tdomf'), ENT_QUOTES);
            ?>
" href="<?php 
            echo wp_nonce_url("admin.php?page=tdomf_show_form_options_menu&delete={$form_id_in}", 'tdomf-delete-form-' . $form_id_in);
            ?>
">
            <?php 
            _e("Delete", "tdomf");
            ?>
</a>
       
            <a class="button" title="<?php 
            echo htmlentities(__('Make a copy of this form', 'tdomf'), ENT_QUOTES);
            ?>
" href="<?php 
            echo wp_nonce_url("admin.php?page=tdomf_show_form_options_menu&copy={$form_id_in}&form={$form_id_in}", 'tdomf-copy-form-' . $form_id_in);
            ?>
">
            <?php 
            _e("Copy", "tdomf");
            ?>
</a>
          </div> <!-- alignleft -->
      
          <?php 
            if (!empty($form_ids)) {
                ?>
          
              <div class="alignright actions">
                <div class="tablenav-pages"><span class="displaying-num"><?php 
                _e("Forms:", 'tdomf');
                ?>
</span>
                    <?php 
                foreach ($form_ids as $form_id) {
                    ?>
                        <?php 
                    if ($form_id->form_id == $form_id_in) {
                        ?>
                            <span class='page-numbers current'><?php 
                        printf($form_id_in);
                        ?>
</span> 
                        <?php 
                    } else {
                        $form_name = tdomf_get_option_form(TDOMF_OPTION_NAME, $form_id->form_id);
                        ?>
                            <a class='page-numbers' title='<?php 
                        echo htmlentities($form_name, ENT_QUOTES);
                        ?>
' href="admin.php?page=<?php 
                        echo $current;
                        ?>
&form=<?php 
                        echo $form_id->form_id;
                        ?>
">
                            <?php 
                        printf($form_id->form_id);
                        ?>
</a>
                        <?php 
                    }
                    ?>
                    <?php 
                }
                ?>
                </div> <!-- alignleft actions -->
          <?php 
            }
            ?>
      
     </div> <!-- tablenav -->
      
         
     </div> <!-- wrap -->
     <div class="wrap">
     
    <?php 
        } else {
            if (tdomf_wp25()) {
                ?>
        
    <ul class="subsubsub">
       <?php 
                if (!empty($form_ids)) {
                    foreach ($form_ids as $form_id) {
                        ?>
                <li><a href="admin.php?page=tdomf_show_form_options_menu&form=<?php 
                        echo $form_id->form_id;
                        ?>
"<?php 
                        if ($form_id->form_id == $form_id_in) {
                            ?>
 class="current" <?php 
                        }
                        ?>
>
                <?php 
                        printf(__("Form %d", "tdomf"), $form_id->form_id);
                        ?>
</a> |</li>
            <?php 
                    }
                }
                ?>
        <?php 
                if (function_exists('wp_nonce_url')) {
                    ?>
        <li><a href="<?php 
                    echo wp_nonce_url("admin.php?page=tdomf_show_form_options_menu&new", 'tdomf-new-form');
                    ?>
">
          <?php 
                    _e("New Form &raquo;", "tdomf");
                    ?>
</a></li>
    <?php 
                } else {
                    ?>
      <li><a href="admin.php?page=tdomf_show_form_options_menu&new"><?php 
                    _e("New Form &raquo;", "tdomf");
                    ?>
</a></li>
    <?php 
                }
                ?>
   </ul>
    
    <ul class="subsubsub">
    <?php 
                if (function_exists('wp_nonce_url')) {
                    ?>
       <li><a href="<?php 
                    echo wp_nonce_url("admin.php?page=tdomf_show_form_options_menu&delete={$form_id}", 'tdomf-delete-form-' . $form_id);
                    ?>
">
          <?php 
                    _e("Delete", "tdomf");
                    ?>
</a> |</li>
       <li><a href="<?php 
                    echo wp_nonce_url("admin.php?page=tdomf_show_form_options_menu&copy={$form_id}&form={$form_id}", 'tdomf-copy-form-' . $form_id);
                    ?>
">
          <?php 
                    _e("Copy", "tdomf");
                    ?>
</a> |</li> 
    <?php 
                } else {
                    ?>
       <li><a href="admin.php?page=tdomf_show_form_options_menu&delete=<?php 
                    echo $form_id;
                    ?>
"><?php 
                    _e("Delete", "tdomf");
                    ?>
</a> |</li>
       <li><a href="admin.php?page=tdomf_show_form_options_menu&copy=<?php 
                    echo $form_id;
                    ?>
"><?php 
                    _e("Copy", "tdomf");
                    ?>
</a> |</li> 
    <?php 
                }
                ?>
    <?php 
                if ($pages != false) {
                    ?>
      <li><a href="<?php 
                    echo get_permalink($pages[0]);
                    ?>
" title="<?php 
                    _e("Live on your blog!", "tdomf");
                    ?>
" ><?php 
                    _e("View Page &raquo;", "tdomf");
                    ?>
</a> |</li>
    <?php 
                }
                ?>
    <?php 
                if (tdomf_get_option_form(TDOMF_OPTION_INCLUDED_YOUR_SUBMISSIONS, $form_id) && get_option(TDOMF_OPTION_YOUR_SUBMISSIONS)) {
                    ?>
      <li><a href="users.php?page=tdomf_your_submissions#tdomf_form<?php 
                    echo $form_id;
                    ?>
" title="<?php 
                    _e("Included on the 'Your Submissions' page!", 'tdomf');
                    ?>
" >
      <?php 
                    _e("View on 'Your Submissions' &raquo;", "tdomf");
                    ?>
</a> |</li>
    <?php 
                }
                ?>
     <li><a href="admin.php?page=tdomf_show_form_menu&form=<?php 
                echo $form_id;
                ?>
"><?php 
                printf(__("Widgets &raquo;", "tdomf"), $form_id);
                ?>
</a> |</li>
     <li><a href="admin.php?page=tdomf_show_form_hacker&form=<?php 
                echo $form_id;
                ?>
"><?php 
                printf(__("Hack Form &raquo;", "tdomf"), $form_id);
                ?>
</a></li>
    </ul>
    <?php 
            }
        }
    }
}