Example #1
0
function sola_nl_widget_add_sub()
{
    extract($_POST);
    $check = sola_nl_add_single_subscriber();
    if ($check == true) {
        $body = "<p>Hi There</p>\n                <p>Thank you for signing up. Please click on the following link to activate your subscription.</p>\n                <a href=''>Click Here</a>";
        $subject = get_option('sola_nl_confirm_subject');
        $body = get_option('sola_nl_confirm_mail');
        sola_mail(0, $sub_email, $subject, $body);
        ?>

        

        <div>
            <?php 
        echo get_option("sola_nl_confirm_thank_you");
        ?>
        </div>
        <?php 
    } else {
        if (is_wp_error($check)) {
            sola_return_error($check);
        }
    }
}
Example #2
0
function sola_nl_wp_head()
{
    @session_start();
    // post data handling
    global $sola_nl_success;
    global $sola_nl_error;
    // check for apc-object-cache.php (godaddy)
    //    $checker = get_dropins();
    /* albert 22 jan 2015 */
    //    if (isset($checker['object-cache.php'])) {
    //	echo "<div id=\"message\" class=\"error\"><p>".__("Please note: <strong>Sola Newsletters will not function correctly while using APC Object Cache.</strong> We have found that GoDaddy hosting packages automatically include this with their WordPress hosting packages. Please email GoDaddy and ask them to remove the object-cache.php from your wp-content/ directory.","sola")."</p></div>";
    //    }
    /* theme upload handling */
    if (isset($_POST['sola_upload_theme_btn'])) {
        if (is_array($_FILES['sola_theme_file'])) {
            // You should also check filesize here.
            if ($_FILES['sola_theme_file']['size'] > 1000000) {
                echo "File upload size too large";
                return;
            }
            WP_Filesystem();
            $destination = wp_upload_dir();
            $destination_path = $destination['basedir'] . "/sola/themes/";
            $unzipfile = unzip_file($_FILES['sola_theme_file']['tmp_name'], $destination_path);
            if ($unzipfile) {
                echo "<div class='updated'><p>" . __('Theme uploaded successfully', 'sola') . "<p></div>";
            } else {
                echo __('Cannot upload the theme. Please ensure WordPress has write permission to the Uploads folder', 'sola');
            }
        } else {
        }
    }
    if (isset($_POST['sola_nl_send_feedback'])) {
        if (wp_mail("*****@*****.**", "Plugin feedback", "Name: " . $_POST['sola_nl_feedback_name'] . "\n\r" . "Email: " . $_POST['sola_nl_feedback_email'] . "\n\r" . "Website: " . $_POST['sola_nl_feedback_website'] . "\n\r" . "Feedback:" . $_POST['sola_nl_feedback_feedback'])) {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("Thank you for your feedback. We will be in touch soon", "sola") . "</p></div>";
        } else {
            if (function_exists('curl_version')) {
                $request_url = "http://www.solaplugins.com/apif/rec_feedback.php";
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $request_url);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
                curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $output = curl_exec($ch);
                curl_close($ch);
                echo "<div id=\"message\" class=\"updated\"><p>" . __("Thank you for your feedback. We will be in touch soon", "sola") . "</p></div>";
            } else {
                echo "<div id=\"message\" class=\"error\">";
                echo "<p>" . __("There was a problem sending your feedback. Please log your feedback on ", "sola") . "<a href='http://solaplugins.com/support-desk' target='_BLANK'>http://solaplugins.com/support-desk</a></p>";
                echo "</div>";
            }
        }
    }
    if (isset($_POST['sola_nl_edit_subscriber'])) {
        $sola_nl_check = sola_nl_update_subscriber();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("Subscribers Updated", "sola") . "</p></div>";
        }
    }
    if (isset($_POST['sola_nl_import_subscribers'])) {
        if (is_uploaded_file($_FILES['sub_import_file']['tmp_name'])) {
            /* check if correct file type */
            if (strpos($_FILES['sub_import_file']['type'], ".csv" !== false)) {
                sola_return_error(new WP_Error('sola_error', __('Upload error', 'sola'), __("Please ensure you upload a CSV file. The file you are trying to upload is a ", 'sola') . $_FILES['sub_import_file']['type'] . __(' type file', 'sola')));
            } else {
                $arm_nl_check = sola_import_file_subscribers($_POST['sub_list']);
                if (is_wp_error($arm_nl_check)) {
                    sola_return_error($arm_nl_check);
                } else {
                    $_SESSION['arm_nl_success'] = __("Subscribers Imported Successfully", "sola");
                    wp_redirect("admin.php?page=sola-nl-menu-subscribers");
                    exit('Cannot redirect');
                }
            }
        } else {
            $arm_nl_check = sola_import_subscribers($_POST['sub_import_excel'], $_POST['sub_list']);
            if (is_wp_error($arm_nl_check)) {
                sola_return_error($arm_nl_check);
            } else {
                $_SESSION['arm_nl_success'] = __("Subscribers Imported Successfully", "sola");
                wp_redirect("admin.php?page=sola-nl-menu-subscribers");
                exit('Cannot redirect');
            }
        }
    }
    if (isset($_POST['sola_nl_new_subscriber'])) {
        if (isset($_POST['sub_list'])) {
            $check = sola_nl_add_single_subscriber();
            if ($check == true) {
                ?>
               <div class="updated">
                  <p><?php 
                _e("Subscriber Added", "sola");
                ?>
</p>
               </div>
               <?php 
            } else {
                echo $check;
            }
        } else {
            ?>
            <div class="error">
                <p><?php 
            _e("Please Select a List when adding the subscriber", "sola");
            ?>
</p>
            </div>
            <?php 
        }
    }
    if (isset($_GET['action']) && $_GET['action'] == "delete_subscriber") {
        $sola_nl_check = sola_nl_delete_subscriber();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("Subscribers Deleted", "sola") . "</p></div>";
        }
    }
    if (isset($_GET['action']) && $_GET['action'] == "delete_camp") {
        $sola_nl_check = sola_nl_delete_camp();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("Campaign Deleted", "sola") . "</p></div>";
        }
    }
    if (isset($_GET['action']) && $_GET['action'] == "pause_sending") {
        $sola_nl_check = sola_nl_pause_camp();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            $newurl = site_url() . "/wp-admin/admin.php?page=sola-nl-menu";
            ob_end_clean();
            header("location:" . $newurl);
        }
    }
    if (isset($_GET['action']) && $_GET['action'] == "resume_sending") {
        $sola_nl_check = sola_nl_resume_camp();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            $newurl = site_url() . "/wp-admin/admin.php?page=sola-nl-menu";
            ob_end_clean();
            header("location:" . $newurl);
        }
    }
    if (isset($_POST['sola_nl_new_list'])) {
        sola_nl_add_list();
    }
    if (isset($_POST['sola_nl_edit_list'])) {
        $sola_nl_check = sola_nl_update_list();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("List Updated", "sola") . "</p></div>";
        }
    }
    if (isset($_GET['action']) && $_GET['action'] == "delete_list") {
        $sola_nl_check = sola_nl_delete_list();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("List Deleted", "sola") . "d</p></div>";
        }
    }
    if (isset($_POST["sola_nl_save_settings"])) {
        if (sola_nl_update_settings()) {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("Settings Saved", "sola") . "</p></div>";
        }
    }
    if (isset($_POST['sola_nl_new_camp'])) {
        $sola_nl_check = sola_nl_add_camp();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            if (isset($_POST['campaign_type']) && $_POST['campaign_type'] == '3') {
                $template_page = site_url() . "/wp-admin/admin.php?page=sola-nl-menu&action=custom_template&camp_id={$sola_nl_check}";
            } else {
                $template_page = site_url() . "/wp-admin/admin.php?page=sola-nl-menu&action=theme&camp_id={$sola_nl_check}";
            }
            //$new_camp_page = site_url()."/wp-admin/admin.php?page=sola-nl-menu&action=editor&camp_id=$sola_nl_check";
            ob_end_clean();
            header("location:" . $template_page);
            exit;
        }
    }
    if (isset($_POST["sola_nl_edit_camp"])) {
        $sola_nl_check = sola_nl_update_camp();
        if (is_wp_error($sola_nl_check)) {
            sola_return_error($sola_nl_check);
        } else {
            $new_camp_page = site_url() . "/wp-admin/admin.php?page=sola-nl-menu&action=editor&camp_id=" . $_POST["camp_id"];
            ob_end_clean();
            header("location:" . $new_camp_page);
            exit;
        }
    }
    //   if($_POST["sola_nl_finish_campaign"]){
    //
    //       $sola_nl_check = sola_nl_finish_camp();
    //      if ( is_wp_error($sola_nl_check) ) { sola_return_error($sola_nl_check); }
    //      else {
    //           echo "<div id=\"message\" class=\"updated\"><p>".__("Campaign Ready to Send","sola")."</p></div>";
    //       }
    //   }
    if (isset($_POST['action']) && $_POST["action"] == "sola-delete-subs" && isset($_POST['sola_check_subs']) && $_POST['sola_check_subs']) {
        foreach ($_POST['sola_check_subs'] as $sub_id) {
            $sola_nl_check = sola_nl_delete_subscriber($sub_id);
            if (is_wp_error($sola_nl_check)) {
                sola_return_error($sola_nl_check);
                $check = false;
                break;
            } else {
                $check = true;
            }
        }
        if ($check == true) {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("Subscribers Deleted", "sola") . "</p></div>";
        }
    }
    if (isset($_POST['action']) && $_POST["action"] == "delete_multi_camps" && isset($_POST["sola_camp_checkbox"]) && $_POST["sola_camp_checkbox"]) {
        foreach ($_POST["sola_camp_checkbox"] as $camp_id) {
            $sola_nl_check = sola_nl_delete_camp($camp_id);
            if (is_wp_error($sola_nl_check)) {
                sola_return_error($sola_nl_check);
                $check = false;
                break;
            } else {
                $check = true;
            }
        }
        if ($check == true) {
            echo "<div id=\"message\" class=\"updated\"><p>" . __("Campaigns Deleted", "sola") . "</p></div>";
        }
    }
    if (isset($_POST['sola_set_theme'])) {
        //        if (isset($_POST['sola_nl_theme_data']) && $_POST['sola_nl_theme_data'] != '') {
        //            /* theyre using a free or purchased theme and are inserting the data */
        //            var_dump($_POST['sola_nl_theme_data']);
        //            $jsondata = json_decode(stripslashes($_POST['sola_nl_theme_data']));
        //            var_dump($jsondata);
        //            echo $jsondata[2];
        //
        //
        //            exit();
        //        }
        //        else {
        /*albert*/
        if (isset($_POST['theme_id'])) {
            $theme_array = explode(",", $_POST['theme_id']);
            $sola_nl_check = sola_set_theme($theme_array, $_POST['camp_id']);
            if (is_wp_error($sola_nl_check)) {
                sola_return_error($sola_nl_check);
            } else {
                $editor = site_url() . "/wp-admin/admin.php?page=sola-nl-menu&action=editor&camp_id=" . $_POST["camp_id"];
                header('location:' . $editor);
                exit;
            }
        } else {
            $error_data = new WP_Error('sola_error', __('Please select a theme before continuing', 'sola'), '');
            sola_return_error($error_data);
        }
        //        }
    }
    if (isset($_POST['action']) && $_POST['action'] == 'sola_submit_find_us') {
        sola_nl_feedback_head();
        echo "<div class=\"updated\"><p>" . __("Thank You for your feedback!", "sola") . "</p></div>";
    }
    //    if(function_exists('sola_nl_register_pro_version')){
    //        global $sola_nl_pro_version;
    //        if($sola_nl_pro_version <= 2.2){
    //            echo "<div class='error'><p>".__("You are using an outdated version of Sola Newsletters Premium. Please update Sola Newsletters Premium using your Plugins panel", "sola")."</p></div>";
    //        }
    //    }
}