Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function wp_posts_sender()
- {
- if (!session_id())
- {
- echo "<div style=\"display:none;\">";
- session_start();
- echo "</div>";
- }
- include ("form.php");
- global $current_user;
- if ($_POST["secCode"] != $_SESSION["secCode"])
- {
- $step["capcha"] = false;
- }
- else
- {
- $_SESSION["secCode"] = rand(100000, 999999);
- $step["capcha"] = true;
- }
- if ($_POST["name_author"])
- {
- $step["auhtor"] = true;
- }
- if ($_POST["email_auhtor"])
- {
- $step["email"] = true;
- }
- if ($_POST["site_author"])
- {
- $step["site"] = true;
- }
- if ($_POST["post_name"])
- {
- $step["title"] = true;
- }
- if ($_POST["post_content"])
- {
- $step["content"] = true;
- }
- if (isset($_POST["send_post"]))
- {
- if (($step["capcha"] && $step["title"] && $step["content"]) == true)
- {
- $all_separator = array(",",".",",","+","-","_"," ","?");
- $standars_separator = array(",",",",",",",",",",",",",",",");
- $final_tags = str_replace($all_separator, $standars_separator, $_POST["post_tags"]);
- if (is_user_logged_in())
- {
- $get_userid = $current_user->ID;
- }
- else
- {
- $get_userid = "1";
- }
- $new_post = array("ID" => "","post_author" => $get_userid,"post_category" => array($_POST["cat"]),"post_content" => $_POST["post_content"],"post_title" => $_POST["post_name"],"tags_input" => $final_tags,"post_status" => get_option("type_publish"));
- $post_id = wp_insert_post($new_post);
- if ($_POST["name_author"])
- {
- add_post_meta($post_id, "name", $_POST["name_author"]);
- }
- if ($_POST["email_auhtor"])
- {
- add_post_meta($post_id, "email", $_POST["email_auhtor"]);
- }
- if ($_POST["site_author"])
- {
- add_post_meta($post_id, "site", $_POST["site_author"]);
- }
- for ($i = 1; $i <= get_option("sum_custom_field"); $i++)
- {
- $cfn[$i] = $_POST["cn_$i"];
- $cfv[$i] = $_POST["cv_$i"];
- add_post_meta($post_id, $cfn[$i], $cfv[$i]);
- }
- //==========================================================PAYMENT=================================================================//
- echo "<p class='publish'>????? ?????? ??.</p>";
- }
- else
- {
- echo "???";
- echo "<ul>";
- echo $step["capcha"] == false ? "<li>???? ?? ?????? ?? ???? ???? ????.</li>" : "";
- echo $step["title"] == false ? "<li>???? ????? ?? ???? ????.</li>" : "";
- echo $step["content"] == false ? "<li>???? ?????? ????? ?? ???? ????.</li>" : "";
- echo "</ul>";
- echo "<a Onclick=\"javascript:history.back();\">?????? ?? ???</a>";
- }
- }
- }
- function wp_post_sender_menu()
- {
- if (function_exists("add_options_page"))
- {
- add_options_page("????? ?????", "????? ?????", "manage_options", "wp-post-sender", "wp_post_sender_config_permission");
- }
- }
- function wp_post_sender_config_permission()
- {
- if (!current_user_can("manage_options"))
- {
- wp_die(__("You do not have sufficient permissions to access this page.", "wp_post_sender"));
- settings_fields("wp_post_sender_options");
- function register_mysettings()
- {
- register_setting("wp_post_sender_options", "type_publish");
- register_setting("wp_post_sender_options", "sum_custom_field");
- register_setting("wp_post_sender_options", "cat_id");
- }
- }
- echo "<div class=\"wrap\"><h2>??????? ????? ?????</h2><table class=\"form-table\"><form method=\"post\" action=\"options.php\">";
- wp_nonce_field("update-options");
- echo "<tr><th><h3>??????? ?????</h4></th></tr><tr><td>??? ?????? ?????:</td><td><select name=\"type_publish\">";
- $get_type_publish = get_option("type_publish");
- echo "<option name=\"draft\" value=\"draft\" ";
- echo $get_type_publish == "draft" ? "selected='selected'" : "";
- echo ">???????</option><option name=\"publish\" value=\"publish\" ";
- echo $get_type_publish == "publish" ? "selected='selected'" : "";
- echo ">??????</option><option name=\"pending\" value=\"pending\" ";
- echo $get_type_publish == "pending" ? "selected='selected'" : "";
- echo ">?? ?????? ?????</option><option name=\"private\" value=\"private\" ";
- echo $get_type_publish == "private" ? "selected='selected'" : "";
- echo ">?????</option></select><span style=\"font-size:11px;\">(??????? ????? ????? ?? ??????.)</span></td></tr><tr><td>????? ????? ????????? ??????</td><td><input type=\"text\" name=\"sum_custom_field\" value=\"";
- echo get_option("sum_custom_field");
- echo "\"/><span style=\"font-size:11px;\">(?? ????? ???? ??? ?? ??? ????? ???????????? ????? ???? ??????.)</span></td></tr><tr><td>???? ??? ????? ?????</td><td><input type=\"text\" name=\"cat_id\" value=\"";
- echo get_option("cat_id");
- echo "\"/><span style=\"font-size:11px;\">(????? ???? ???? ?? ?? ???????? ??? ????? ???? ??? ?? ?? ?????? ????? ???? ????. ????: 1,4)</span></td></tr><tr><td><p class=\"submit\"><input type=\"hidden\" name=\"action\" value=\"update\" /><input type=\"hidden\" name=\"page_options\" value=\"type_publish,sum_custom_field,cat_id\" /><input type=\"submit\" class=\"button-primary\" name=\"Submit\" value=\"?? ??? ?????\" /></p></td></tr></form></table></div>";
- }
- if (get_bloginfo("url") != "http://4print.ir/" && get_bloginfo("url") != "http://4print.ir" && get_bloginfo("url") != "http://www.4print.ir/" && get_bloginfo("url") != "http://www.4print.ir")
- {
- wp_die(__("?????? ?????? ???? ??? ???? ????? ????!"));
- }
- load_plugin_textdomain("wp_post_sender", "wp-content/plugins/wp-post-sender-custom/langs");
- add_action("admin_menu", "wp_post_sender_menu");
- add_shortcode("postsender", "wp_posts_sender");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement