function html($sp)
 {
     echo "<h2>" . __('Attempting to install or repair missing data', 'sendpress') . "</h2><br>";
     SendPress_Data::install();
     @SPNL()->db->subscribers_tracker->create_table();
     @SPNL()->db->url->create_table();
     @SPNL()->db->subscribers_url->create_table();
     echo "<pre>";
     echo SendPress_DB_Tables::check_setup_support();
     echo "</pre>";
 }
    function help_debug()
    {
        global $wp_version, $wpdb;
        $browser = new SendPress_Browser();
        echo "<b>WordPress Version</b>: " . $wp_version . "<br>";
        echo "<b>SendPress Version</b>: " . SENDPRESS_VERSION . "<br>";
        if (defined('SENDPRESS_PRO_VERSION')) {
            echo "<b>SendPress Pro Version</b>: " . SENDPRESS_VERSION . "<br>";
        }
        echo '<b>PHP Version</b>: ' . phpversion() . '<br>';
        $mem = (int) ini_get('memory_limit');
        $used = function_exists('memory_get_usage') ? round(memory_get_usage() / 1024 / 1024, 2) : 0;
        if (!empty($mem) && !empty($used)) {
            $prec = round($used / $mem * 100, 0);
        }
        echo '<b>PHP Memory Limit</b>: ' . $mem . __(' MByte') . '<br>';
        echo '<b>PHP Memory Used</b>: ' . $used . __(' MByte') . '<br>';
        echo '<b>MySQL Version</b>: ' . $wpdb->db_version() . '<br><br>';
        echo '<b>Send Setup</b>: ' . SendPress_Option::get('sendmethod') . '<br><br>';
        SendPress_DB_Tables::check_setup();
        /*
        		echo "<b>Ports:</b><br>";
        	  	$server  = "smtp.sendgrid.net";
        	  	$port   = "25";
        	  	$port2   = "465";
        	  	$port3   = "587";
        	  	$timeout = "1";
        
        	  if ($server and $port and $timeout) {
        	    $port25 =  @fsockopen("$server", $port, $errno, $errstr, $timeout);
        	    $port465 =  @fsockopen("$server", $port2, $errno, $errstr, $timeout);
        	    $port587 =  @fsockopen("$server", $port3, $errno, $errstr, $timeout);
        	  }	
        	  echo "Port 25: ";
        	  if(!$port25){
        	  	 _e('blocked','sendpress');
        	  } else {
        	  	_e('open','sendpress');
        	  }
        	   echo "<br>Port 465: ";
        	  if(!$port465){
        	  	 _e('blocked','sendpress');
        	  } else {
        	  	_e('open','sendpress');
        	  }
        	   echo "<br>Port 587: ";
        	  if(!$port587){
        	  	 _e('blocked','sendpress');
        	  } else {
        	  	_e('open','sendpress');
        	  }  */
        ?>
<br><br>

	  	<b>Support Info:</b>
	  	<textarea readonly="readonly" class="sendpress-sysinfo"  name="sendpress-sysinfo" title="<?php 
        _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'sendpress');
        ?>
"><?php 
        echo esc_html($this->display());
        ?>
</textarea>



	  <?php 
    }
Esempio n. 3
0
<?php

// Prevent loading this file directly
if (!defined('SENDPRESS_VERSION')) {
    header('HTTP/1.0 403 Forbidden');
    die;
}
global $wpdb;
// Create Stats Table
$subscriber_table = SendPress_DB_Tables::subscriber_table();
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$wpdb->flush();
if ($wpdb->get_var("show tables like '{$subscriber_table}'") != $subscriber_table) {
    $sql2 = "CREATE TABLE " . $subscriber_table . " (\n\t\t  subscriberID bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n\t\t  email varchar(100) NOT NULL DEFAULT '',\n\t\t  join_date datetime  NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t  status int(1) NOT NULL DEFAULT '1',\n\t\t  registered datetime  NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t  registered_ip varchar(20) NOT NULL DEFAULT '',\n\t\t  identity_key varchar(60) NOT NULL DEFAULT '',\n\t\t  bounced int(1) NOT NULL DEFAULT '0',\n\t\t  firstname varchar(250) NOT NULL DEFAULT '',\n\t\t  lastname varchar(250) NOT NULL DEFAULT '',\n\t\t  wp_user_id bigint(20) DEFAULT NULL,\n\t\t  PRIMARY KEY (`subscriberID`),\n\t\t  UNIQUE KEY  (`email`) ,\n\t\t  UNIQUE KEY (`identity_key`),\n\t\t  UNIQUE KEY `wp_user_id` (`wp_user_id`)\n\t\t)";
    dbDelta($sql2);
}
$subscriber_list_subscribers = SendPress_DB_Tables::list_subcribers_table();
$wpdb->flush();
if ($wpdb->get_var("show tables like '{$subscriber_list_subscribers}'") != $subscriber_list_subscribers) {
    $sql3 = "CREATE TABLE " . $subscriber_list_subscribers . " (\n\t\t  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t  `listID` int(11) DEFAULT NULL,\n\t\t  `subscriberID` int(11) DEFAULT NULL,\n\t\t  `status` int(1) DEFAULT NULL,\n\t\t  `updated` datetime  NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t  PRIMARY KEY (`id`),\n\t\t  KEY (`listID`) ,\n\t\t  KEY (`subscriberID`) ,\n\t\t  KEY (`status`) ,\n\t\t  UNIQUE KEY `listsub` (`subscriberID`,`listID`)\n\t\t)";
    dbDelta($sql3);
}
$subscriber_queue = SendPress_DB_Tables::queue_table();
$wpdb->flush();
if ($wpdb->get_var("show tables like '{$subscriber_queue}'") != $subscriber_queue) {
    $sql5 = "CREATE TABLE " . $subscriber_queue . " (\n\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t  `subscriberID` int(11) DEFAULT NULL,\n\t  `listID` int(11) DEFAULT NULL,\n\t  `from_name` varchar(64) DEFAULT NULL,\n\t  `from_email` varchar(128) NOT NULL,\n\t  `to_email` varchar(128) NOT NULL,\n\t  `subject` varchar(255) NOT NULL,\n\t  `messageID` varchar(400) NOT NULL,\n\t  `emailID` int(11) NOT NULL,\n\t  `max_attempts` int(11) NOT NULL DEFAULT '3',\n\t  `attempts` int(11) NOT NULL DEFAULT '0',\n\t  `success` tinyint(1) NOT NULL DEFAULT '0',\n\t  `date_published` datetime  NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t  `inprocess` int(1) DEFAULT '0',\n\t  `last_attempt` datetime  NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t  `date_sent` datetime  NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t  PRIMARY KEY (`id`),\n\t  KEY `to_email` (`to_email`),\n\t  KEY `subscriberID` (`subscriberID`),\n\t  KEY `listID` (`listID`),\n\t  KEY `inprocess` (`inprocess`),\n\t  KEY `success` (`success`),\n\t  KEY `max_attempts` (`max_attempts`),\n\t  KEY `attempts` (`attempts`),\n\t  KEY `last_attempt` (`last_attempt`)\n\t)";
    dbDelta($sql5);
}
add_option("sendpress_db_version", SendPress_DB_Tables::$db_version);
 static function auto_cron()
 {
     // make sure we're in wp-cron.php
     if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-cron.php')) {
         // make sure a secret string is provided in the ur
         if (isset($_GET['action']) && $_GET['action'] == 'sendpress') {
             //* Use cache
             static $cron_bg_run = null;
             static $cron_bg_run_weekly = null;
             $time_start = microtime(true);
             $count = SendPress_Data::emails_in_queue();
             $bg = 0;
             $bg_weekly = 0;
             $error = '';
             try {
                 if ($count > 0) {
                     SendPress_Queue::send_mail();
                     $count = SendPress_Data::emails_in_queue();
                 } else {
                     //* If cache is empty, pull transient
                     if (!$cron_bg_run) {
                         $cron_bg_run = get_transient('spnl-background-daily');
                     }
                     //* If transient has expired, do a fresh update check
                     if (!$cron_bg_run) {
                         //* If cache is empty, pull transient
                         if (!$cron_bg_run_weekly) {
                             $cron_bg_run_weekly = get_transient('spnl-background-weekly');
                         }
                         //* If transient has expired, do a fresh update check
                         if (!$cron_bg_run_weekly) {
                             SPNL()->log->prune_logs();
                             SendPress_Data::clean_queue_table();
                             SendPress_DB_Tables::repair_tables();
                             $cron_bg_run_weekly = array('runtime' => date("F j, Y, g:i a"));
                             set_transient('spnl-background-weekly', $cron_bg_run_weekly, 60 * 60 * 24 * 7);
                             $bg_weekly = 1;
                         }
                         //SendPress_Logging::prune_logs();
                         $bg = 1;
                         $cron_bg_run = array('runtime' => date("F j, Y, g:i a"));
                         set_transient('spnl-background-daily', $cron_bg_run, 60 * 60 * 24);
                     }
                 }
             } catch (Exception $e) {
                 $error = $e->getMessage();
                 SPNL()->log->add('Autocron', $error, 0, 'error');
             }
             $attempted_count = SendPress_Option::get('autocron-per-call', 25);
             $pro = 0;
             if (defined('SENDPRESS_PRO_VERSION')) {
                 $pro = SENDPRESS_PRO_VERSION;
             }
             $stuck = SendPress_Data::emails_stuck_in_queue();
             $limit = SendPress_Manager::limit_reached();
             $emails_per_day = SendPress_Option::get('emails-per-day');
             $emails_per_hour = SendPress_Option::get('emails-per-hour');
             $hourly_emails = SendPress_Data::emails_sent_in_queue("hour");
             $emails_so_far = SendPress_Data::emails_sent_in_queue("day");
             $limits = array('autocron' => $attempted_count, 'dl' => $emails_per_day, 'hl' => $emails_per_hour, 'ds' => $emails_so_far, 'hs' => $hourly_emails);
             $time_end = microtime(true);
             $time = $time_end - $time_start;
             echo json_encode(array("error" => $error, "background" => $bg, "weekly" => $bg_weekly, "queue" => $count, "stuck" => $stuck, "version" => SENDPRESS_VERSION, "pro" => $pro, "limit" => $limit, 'info' => $limits, 'time' => number_format($time, 3)));
             die;
         }
     }
 }
 public function stats($email_id)
 {
     global $wpdb;
     $subs_table = SendPress_DB_Tables::subscriber_table();
     $url_table = SPNL()->db("Subscribers_Url")->table_name;
     $q = $wpdb->prepare(" SELECT su.email, st.opened_count as opens, st.opened_at,st.status , SUM(ut.click_count) as clicks FROM {$this->table_name} as st LEFT JOIN {$url_table} as ut on ut.subscriber_id = st.subscriber_id and ut.email_id = st.email_id LEFT JOIN {$subs_table} as su on su.subscriberID = st.subscriber_id WHERE st.email_id = %d and st.status > 0 GROUP BY st.subscriber_id order by su.email  ", $email_id);
     return $wpdb->get_results($q);
 }
Esempio n. 6
0
    public function jaiminho_fix_tables_html()
    {
        var_dump(isset($_POST['fix_tables']));
        global $wpdb;
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        //$wpdb->hide_errors();
        $collate = '';
        if ($wpdb->has_cap('collation')) {
            if (!empty($wpdb->charset)) {
                $collate .= "DEFAULT CHARACTER SET {$wpdb->charset}";
            }
            if (!empty($wpdb->collate)) {
                $collate .= " COLLATE {$wpdb->collate}";
            }
        }
        ?>
			<form method="post">
			<input type="hidden" name="fix_tables" value="true" />
			<?php 
        submit_button(__('Corrigir Tabelas', 'jaiminho'));
        ?>
			</form><?php 
        $args = array('network_id' => null, 'public' => null, 'archived' => null, 'mature' => null, 'spam' => null, 'deleted' => null, 'limit' => null, 'offset' => 0);
        $blogs = wp_get_sites($args);
        echo '<pre>';
        //var_dump($blogs);
        echo '</pre>';
        foreach ($blogs as $blog) {
            switch_to_blog($blog['blog_id']);
            echo '<br>';
            echo get_bloginfo('name');
            echo '<br>';
            echo "<b>Database Tables</b>: <br>";
            // primera tabela
            $subscriber_events_table = new SendPress_DB_Subscribers_Tracker();
            $subscriber_events_table = $subscriber_events_table->table_name;
            if ($wpdb->get_var("show tables like '{$subscriber_events_table}'") != $subscriber_events_table) {
                echo $subscriber_events_table . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command = " CREATE TABLE {$subscriber_events_table} (\nsubscriberID int(11) unsigned NOT NULL,\nemailID int(11) unsigned NOT NULL,\nsent_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', \nopened_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\nstatus tinyint(4) NOT NULL DEFAULT '0',\nPRIMARY KEY  (subscriberID,emailID)\n)  {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $subscriber_events_table . " OK<br>";
            }
            // segunda tabela
            $subscriber_events_table = new SendPress_DB_Subscribers_Url();
            $subscriber_events_table = $subscriber_events_table->table_name;
            if ($wpdb->get_var("show tables like '{$subscriber_events_table}'") != $subscriber_events_table) {
                echo $subscriber_events_table . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command = " CREATE TABLE {$subscriber_events_table} (\nsubscriberID int(11) unsigned NOT NULL,\nemailID int(11) unsigned NOT NULL,\nurlID int(11) unsigned NOT NULL,\nclicked_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', \nclick_count int(11) unsigned NOT NULL,\nPRIMARY KEY  ( subscriberID , emailID , urlID )\n)  {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $subscriber_events_table . " OK<br>";
            }
            //terceira tabela
            $subscriber_events_table = new SendPress_DB_Url();
            $subscriber_events_table = $subscriber_events_table->table_name;
            if ($wpdb->get_var("show tables like '{$subscriber_events_table}'") != $subscriber_events_table) {
                echo $subscriber_events_table . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command = " CREATE TABLE {$subscriber_events_table} (urlID int(11) unsigned NOT NULL AUTO_INCREMENT, url text,hash varchar(255) DEFAULT NULL, PRIMARY KEY  (urlID), KEY hash (hash))  {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $subscriber_events_table . " OK<br>";
            }
            // quarta tabela
            $report_url_table = SendPress_DB_Tables::report_url_table();
            if ($wpdb->get_var("show tables like '{$report_url_table}'") != $report_url_table) {
                echo $report_url_table . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command = " CREATE TABLE {$report_url_table} (\nurlID int(11) unsigned NOT NULL AUTO_INCREMENT,\nurl varchar(2000) DEFAULT NULL,\nreportID int(11) DEFAULT NULL,\nPRIMARY KEY  (urlID),\nKEY reportID (reportID),\nKEY url (url(255))\n) {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $report_url_table . " OK<br>";
            }
            // quinta tabela
            $subscriber_status_table = SendPress_DB_Tables::subscriber_status_table();
            if ($wpdb->get_var("show tables like '{$subscriber_status_table}'") != $subscriber_status_table) {
                echo $subscriber_status_table . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command = " CREATE TABLE {$subscriber_status_table} (\nstatusid int(11) unsigned NOT NULL AUTO_INCREMENT, \nstatus varchar(255) DEFAULT NULL, \nPRIMARY KEY  (statusid)\n) {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $subscriber_status_table . " OK<br>";
            }
            // sexta tabela
            $subscriber_table = SendPress_DB_Tables::subscriber_table();
            if ($wpdb->get_var("show tables like '{$subscriber_table}'") != $subscriber_table) {
                echo $subscriber_table . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command = " CREATE TABLE {$subscriber_table} (\nsubscriberID bigint(20) unsigned NOT NULL AUTO_INCREMENT, \nemail varchar(100) NOT NULL DEFAULT '', \njoin_date datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \nstatus int(1) NOT NULL DEFAULT '1', \nregistered datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \nregistered_ip varchar(20) NOT NULL DEFAULT '', \nidentity_key varchar(60) NOT NULL DEFAULT '', \nbounced int(1) NOT NULL DEFAULT '0', \nfirstname varchar(250) NOT NULL DEFAULT '', \nlastname varchar(250) NOT NULL DEFAULT '', \nwp_user_id bigint(20) DEFAULT NULL, \nphonenumber varchar(12) DEFAULT NULL, \nsalutation varchar(40) DEFAULT NULL,\nPRIMARY KEY  (subscriberID), \nUNIQUE KEY email (email) , \nUNIQUE KEY identity_key (identity_key), \nUNIQUE KEY wp_user_id (wp_user_id)\n) {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $subscriber_table . " OK<br>";
            }
            //setima tabela
            $subscriber_list_subscribers = SendPress_DB_Tables::list_subcribers_table();
            if ($wpdb->get_var("show tables like '{$subscriber_list_subscribers}'") != $subscriber_list_subscribers) {
                echo $subscriber_list_subscribers . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command .= " CREATE TABLE {$subscriber_list_subscribers} (\nid int(11) unsigned NOT NULL AUTO_INCREMENT, \nlistID int(11) DEFAULT NULL, \nsubscriberID int(11) DEFAULT NULL, \nstatus int(1) DEFAULT NULL, \nupdated datetime NOT NULL DEFAULT '0000-00-00 00:00:00', \nPRIMARY KEY  (id), \nKEY listID (listID) , \nKEY subscriberID (subscriberID) , \nKEY status (status), \nUNIQUE KEY listsub (subscriberID,listID)\n) {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $subscriber_list_subscribers . " OK<br>";
            }
            //oitava tabela
            $subscriber_queue = SendPress_DB_Tables::queue_table();
            if ($wpdb->get_var("show tables like '{$subscriber_queue}'") != $subscriber_queue) {
                echo $subscriber_queue . " Not Installed<br>";
                if (isset($_POST['fix_tables'])) {
                    $command .= " CREATE TABLE {$subscriber_queue} (\nid int(11) NOT NULL AUTO_INCREMENT, \nsubscriberID int(11) DEFAULT NULL, \nlistID int(11) DEFAULT NULL, \nfrom_name varchar(64) DEFAULT NULL, \nfrom_email varchar(128) NOT NULL, \nto_email varchar(128) NOT NULL, \nsubject varchar(255) NOT NULL, \nmessageID varchar(400) NOT NULL, \nemailID int(11) NOT NULL, \nmax_attempts int(11) NOT NULL DEFAULT '3', \nattempts int(11) NOT NULL DEFAULT '0', \nsuccess tinyint(1) NOT NULL DEFAULT '0', \ndate_published datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \ninprocess int(1) DEFAULT '0', \nlast_attempt datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \ndate_sent datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \nPRIMARY KEY  (id), \nKEY to_email (to_email), \nKEY subscriberID (subscriberID), \nKEY listID (listID), \nKEY inprocess (inprocess), \nKEY success (success), \nKEY max_attempts (max_attempts), \nKEY attempts (attempts), \nKEY last_attempt (last_attempt),\nKEY date_sent (date_sent),\nKEY success_date (success,last_attempt,max_attempts,attempts,inprocess,date_sent)\n) {$collate};\n";
                    $return = dbDelta($command);
                    echo $return["wp_sendpress_report_url"];
                }
            } else {
                echo $subscriber_queue . " OK<br>";
            }
            echo "<br>";
            echo '<br>';
        }
        restore_current_blog();
    }
<?php

// Prevent loading this file directly
if (!defined('SENDPRESS_VERSION')) {
    header('HTTP/1.0 403 Forbidden');
    die;
}
global $wpdb;
$table_to_update = SendPress_DB_Tables::list_subcribers_table();
if ($wpdb->get_var("SHOW COLUMNS FROM " . $table_to_update . " LIKE 'updated'") == false) {
    $wpdb->query("ALTER TABLE " . $table_to_update . " ADD COLUMN `updated` datetime DEFAULT NULL");
}
    function html($sp)
    {
        ?>
<form method="post" id="post">
		<!--
		<div style="float:right;" >
			<a href="<?php 
        echo SendPress_Admin::link('Settings_Advanced');
        ?>
" class="btn btn-large btn-default" ><i class="icon-remove"></i> <?php 
        _e('Cancel', 'sendpress');
        ?>
</a> <a href="#" id="save-update" class="btn btn-primary btn-large"><i class="icon-white icon-ok"></i> <?php 
        _e('Save', 'sendpress');
        ?>
</a>
		</div>
		-->
		<br class="clear">
				<br class="clear">
		<div class="sp-row">
			<div class="sp-50 sp-first">
			<?php 
        $this->panel_start(__('Database Repair', 'sendpress'));
        ?>
				<p><?php 
        _e('Reset our new template system back to default and fix some postmeta issues', 'sendpress');
        ?>
.</p>
				<a class="btn btn-primary btn-block" href="<?php 
        echo SendPress_Admin::link('Settings_Dbfix');
        ?>
"><?php 
        _e('Data Fix Options', 'sendpress');
        ?>
</a>
			<?php 
        $this->panel_end();
        ?>
			<div class="panel panel-default">
			  <div class="panel-heading">
			    <h3 class="panel-title"><?php 
        _e('Javascript', 'sendpress');
        ?>
 & <?php 
        _e('CSS', 'sendpress');
        ?>
</h3>
			  </div>
			  <div class="panel-body">

				<?php 
        $widget_options = SendPress_Option::get('widget_options');
        //print_r($widget_options);
        ?>
					<input class="turnoff-css-checkbox sendpress_checkbox" value="<?php 
        echo $widget_options['load_css'];
        ?>
" type="checkbox" <?php 
        if ($widget_options['load_css'] == 1) {
            echo 'checked';
        }
        ?>
 id="load_css" name="load_css"/>  <?php 
        _e('Disable front end CSS', 'sendpress');
        ?>
<br>
					
					<input class="turnoff-ajax-checkbox sendpress_checkbox" value="<?php 
        echo $widget_options['load_ajax'];
        ?>
" type="checkbox" <?php 
        if ($widget_options['load_ajax'] == 1) {
            echo 'checked';
        }
        ?>
 id="load_ajax" name="load_ajax"/>  <?php 
        _e('Disable signup form ajax', 'sendpress');
        ?>
<br>

					
					<input class="footer-scripts-checkbox sendpress_checkbox" value="<?php 
        echo $widget_options['load_scripts_in_footer'];
        ?>
" type="checkbox" <?php 
        if ($widget_options['load_scripts_in_footer'] == 1) {
            echo 'checked';
        }
        ?>
 id="load_scripts_in_footer" name="load_scripts_in_footer"/>  <?php 
        _e('Load Javascript in Footer', 'sendpress');
        ?>
 
				
				</div>
			</div>

			<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('Use Shortcodes in Widgets', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
					<p><?php 
        _e('Want to use Shortcodes in your Widgets, but all you get is', 'sendpress');
        ?>
 [shortcode]?  <?php 
        _e('Turn on this option and we\'ll make sure your shortcodes work in widgets', 'sendpress');
        ?>
.</p>
					
					<?php 
        $ctype = SendPress_Option::get('sp_widget_shortdoces');
        ?>
					<input type="checkbox" name="sp_widget_shortdoces" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> Turn on Widget Shortcodes
				</div>
			</div>

			<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('Optional Settings', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
				<?php 
        $ctype = SendPress_Option::get('old_permalink');
        ?>
				<input type="checkbox" name="old_permalink" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Use old permalink with', 'sendpress');
        ?>
 ?sendpress=.
				<br><br>
				<?php 
        $ctype = SendPress_Option::get('skip_mailto');
        ?>
				<input type="checkbox" name="skip_mailto" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Do not track mailto links in email', 'sendpress');
        ?>
.
				<br><br>
				<?php 
        $ctype = SendPress_Option::get('enable_email_template_edit');
        ?>
				<input type="checkbox" name="enable_email_template_edit" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Override email template settings', 'sendpress');
        ?>
.
				

				</div>
			</div>


			<h2><?php 
        _e('Table Info', 'sendpress');
        ?>
</h2>
				<pre><?php 
        echo SendPress_DB_Tables::check_setup_support();
        ?>
</pre>
				<a class="btn btn-danger" href="<?php 
        echo SendPress_Admin::link('Settings_Install');
        ?>
"><?php 
        _e('Install Missing Tables', 'sendpress');
        ?>
</a>
				<a class="btn btn-warning" href="<?php 
        echo SendPress_Admin::link('Settings_Install', array('action' => 'events-repair'));
        ?>
"><?php 
        _e('Repair Events Tables', 'sendpress');
        ?>
</a>
				<a class="btn btn-primary" href="<?php 
        echo SendPress_Admin::link('Settings_Fixposts');
        ?>
"><?php 
        _e('Templates Check', 'sendpress');
        ?>
</a>

			</div>	
			<div class="sp-50">
				<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('Tracking', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
				<?php 
        $ctype = SendPress_Option::get('allow_tracking');
        ?>
			<input type="checkbox" name="allow_tracking" value="yes" <?php 
        if ($ctype == 'yes') {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Allow tracking of this WordPress installs anonymous data', 'sendpress');
        ?>
.
				<p>	
			<?php 
        _e('To maintain a plugin as big as SendPress, we need to know what we\'re dealing: what kinds of other plugins our users are using, what themes, etc. Please allow us to track that data from your install. It will add your email to our support system to assist in AutoCron problems.', 'sendpress');
        ?>
.</p>
		</div></div>
			<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('System Limits', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
					<p><?php 
        _e('Please take care when changing these settings. We have attempted to set these to work on almost all servers. If you have a faster server you may be able to increase the limits below or if you are having troubles you may need to decrease the settings', 'sendpress');
        ?>
.</p>
					<hr>
					<?php 
        _e('Users to Sync per ajax call', 'sendpress');
        ?>
: <?php 
        $this->select('sync-per-call', SendPress_Option::get('sync-per-call', 250));
        ?>
 <?php 
        _e('Default', 'sendpress');
        ?>
: 250
					<hr>
					<?php 
        _e('Emails sent per AutoCron execution', 'sendpress');
        ?>
: <?php 
        $this->select('autocron-per-call', SendPress_Option::get('autocron-per-call', 25), array(1, 5, 10, 15, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100));
        ?>
 <?php 
        _e('Default', 'sendpress');
        ?>
: 25<br>
					<small><?php 
        _e('If AutoCron errors it will shut itself off', 'sendpress');
        ?>
.</small>
					<hr>
					<?php 
        _e('WordPress cron emails sent per execution', 'sendpress');
        ?>
: <?php 
        $this->select('wpcron-per-call', SendPress_Option::get('wpcron-per-call', 25), array(1, 5, 10, 15, 25, 30, 35, 40, 45, 50, 100, 250, 500, 1000));
        ?>
 <?php 
        _e('Default', 'sendpress');
        ?>
: 25<br>
					<hr>
					<?php 
        _e('Queue History', 'sendpress');
        ?>
:  <?php 
        $this->select('queue-history', SendPress_Option::get('queue-history', 7), array(7, 14, 21, 28, 35, 42, 49));
        ?>
 <?php 
        _e('Days', 'sendpress');
        ?>
 <br><small><?php 
        _e('Default', 'sendpress');
        ?>
: 7 Days</small>
					<hr>
					<?php 
        _e('Add Emails to Queue', 'sendpress');
        ?>
:  <?php 
        $this->select('queue-per-call', SendPress_Option::get('queue-per-call', 1000), array(50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000));
        ?>
 <?php 
        _e('Emails', 'sendpress');
        ?>
 <br><small><?php 
        _e('Default', 'sendpress');
        ?>
: 1000 <?php 
        _e('Emails', 'sendpress');
        ?>
</small>
				</div>
			</div>
			<?php 
        do_action('sendpress_advanced_settings');
        ?>
				
			


			
			
			</div>

		</div>
		<?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
		</form>
		<?php 
    }
<?php

// Prevent loading this file directly
if (!defined('SENDPRESS_VERSION')) {
    header('HTTP/1.0 403 Forbidden');
    die;
}
global $wpdb;
// Create Stats Table
//$subscriber_open_table =  SendPress_Table_Manager::subscriber_open_table();
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$subscriber_events_table = SendPress_DB_Tables::subscriber_event_table();
$wpdb->flush();
if ($wpdb->get_var("show tables like '{$subscriber_events_table}'") != $subscriber_events_table) {
    $sqltable = "CREATE TABLE " . $subscriber_events_table . " (\n    `eventID` int(11) unsigned NOT NULL AUTO_INCREMENT,\n    `subscriberID` int(11) unsigned NOT NULL,\n    `reportID` int(11) unsigned DEFAULT NULL,\n    `urlID` int(11) unsigned DEFAULT NULL,\n    `listID` int(11) unsigned DEFAULT NULL,\n    `eventdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n    `ip`  varchar(400) DEFAULT NULL,\n    `devicetype`  varchar(50) DEFAULT NULL,\n    `device`  varchar(50) DEFAULT NULL,\n    `type` varchar(50) DEFAULT NULL,\n    PRIMARY KEY (`eventID`),\n    KEY `subscriberID` (`subscriberID`),\n    KEY `reportID` (`reportID`),\n    KEY `urlID` (`urlID`),\n    KEY `listID` (`listID`),\n    KEY `eventdate` (`eventdate`),\n    KEY `type` (`type`)\n  )";
    dbDelta($sqltable);
}
$report_url_table = SendPress_DB_Tables::report_url_table();
$wpdb->flush();
if ($wpdb->get_var("show tables like '{$report_url_table}'") != $report_url_table) {
    $sqltable = "CREATE TABLE " . $report_url_table . " (\n  `urlID` int(11) unsigned NOT NULL AUTO_INCREMENT,\n  `url` varchar(2000) DEFAULT NULL,\n  `reportID` int(11) DEFAULT NULL,\n  PRIMARY KEY (`urlID`),\n  KEY `url` (`url`),\n  KEY `reportID` (`reportID`)\n)";
    dbDelta($sqltable);
}
$wpdb->flush();
 static function install()
 {
     global $wpdb;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $wpdb->hide_errors();
     $collate = '';
     if ($wpdb->has_cap('collation')) {
         if (!empty($wpdb->charset)) {
             $collate .= "DEFAULT CHARACTER SET {$wpdb->charset}";
         }
         if (!empty($wpdb->collate)) {
             $collate .= " COLLATE {$wpdb->collate}";
         }
     }
     /*
                 
                 THE RULES FOR DBDELTA
     
                 You must put each field on its own line in your SQL statement.
                 You must have two spaces between the words PRIMARY KEY and the definition of your primary key.
                 You must use the key word KEY rather than its synonym INDEX and you must include at least one KEY.
                 You must not use any apostrophes or backticks around field names.
     */
     // Create Stats Table
     $subscriber_table = SendPress_DB_Tables::subscriber_table();
     //if($wpdb->get_var("show tables like '$subscriber_table'") != $subscriber_table) {
     $command = '';
     $command .= " CREATE TABLE {$subscriber_table} (\nsubscriberID bigint(20) unsigned NOT NULL AUTO_INCREMENT, \nemail varchar(100) NOT NULL DEFAULT '', \njoin_date datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \nstatus int(1) NOT NULL DEFAULT '1', \nregistered datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \nregistered_ip varchar(20) NOT NULL DEFAULT '', \nidentity_key varchar(60) NOT NULL DEFAULT '', \nbounced int(1) NOT NULL DEFAULT '0', \nfirstname varchar(250) NOT NULL DEFAULT '', \nlastname varchar(250) NOT NULL DEFAULT '', \nwp_user_id bigint(20) DEFAULT NULL, \nPRIMARY KEY  (subscriberID), \nUNIQUE KEY email (email) , \nUNIQUE KEY identity_key (identity_key), \nUNIQUE KEY wp_user_id (wp_user_id)\n) {$collate};\n";
     //dbDelta($command);
     //}
     $subscriber_list_subscribers = SendPress_DB_Tables::list_subcribers_table();
     $command .= " CREATE TABLE {$subscriber_list_subscribers} (\nid int(11) unsigned NOT NULL AUTO_INCREMENT, \nlistID int(11) DEFAULT NULL, \nsubscriberID int(11) DEFAULT NULL, \nstatus int(1) DEFAULT NULL, \nupdated datetime NOT NULL DEFAULT '0000-00-00 00:00:00', \nPRIMARY KEY  (id), \nKEY listID (listID) , \nKEY subscriberID (subscriberID) , \nKEY status (status), \nUNIQUE KEY listsub (subscriberID,listID)\n) {$collate};\n";
     //dbDelta($command);
     $subscriber_meta = SendPress_DB_Tables::subscriber_meta_table();
     $command .= " CREATE TABLE {$subscriber_meta} (\nsmeta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, \nsubscriberID bigint(20) unsigned NOT NULL DEFAULT '0', \nlistID bigint(20) unsigned NULL DEFAULT '0', \nmeta_key varchar(255) DEFAULT NULL, \nmeta_value longtext, \nPRIMARY KEY  (smeta_id), \nKEY listID (listID), \nKEY subscriberID (subscriberID), \nKEY meta_key (meta_key)\n) {$collate};\n";
     //dbDelta($command);
     $subscriber_queue = SendPress_DB_Tables::queue_table();
     $command .= " CREATE TABLE {$subscriber_queue} (\nid int(11) NOT NULL AUTO_INCREMENT, \nsubscriberID int(11) DEFAULT NULL, \nlistID int(11) DEFAULT NULL, \nfrom_name varchar(64) DEFAULT NULL, \nfrom_email varchar(128) NOT NULL, \nto_email varchar(128) NOT NULL, \nsubject varchar(255) NOT NULL, \nmessageID varchar(400) NOT NULL, \nemailID int(11) NOT NULL, \nmax_attempts int(11) NOT NULL DEFAULT '3', \nattempts int(11) NOT NULL DEFAULT '0', \nsuccess tinyint(1) NOT NULL DEFAULT '0', \ndate_published datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \ninprocess int(1) DEFAULT '0', \nlast_attempt datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \ndate_sent datetime  NOT NULL DEFAULT '0000-00-00 00:00:00', \nPRIMARY KEY  (id), \nKEY to_email (to_email), \nKEY subscriberID (subscriberID), \nKEY listID (listID), \nKEY inprocess (inprocess), \nKEY success (success), \nKEY max_attempts (max_attempts), \nKEY attempts (attempts), \nKEY last_attempt (last_attempt),\nKEY date_sent (date_sent),\nKEY success_date (success,last_attempt,max_attempts,attempts,inprocess,date_sent)\n) {$collate};\n";
     // dbDelta($command);
     $subscriber_events_table = SendPress_DB_Tables::subscriber_event_table();
     $command .= " CREATE TABLE {$subscriber_events_table} (\neventID int(11) unsigned NOT NULL AUTO_INCREMENT, \nsubscriberID int(11) unsigned NOT NULL, \nreportID int(11) unsigned DEFAULT NULL, \nurlID int(11) unsigned DEFAULT NULL, \nlistID int(11) unsigned DEFAULT NULL, \neventdate datetime NOT NULL DEFAULT '0000-00-00 00:00:00', \nip  varchar(400) DEFAULT NULL, \ndevicetype  varchar(50) DEFAULT NULL, \ndevice  varchar(50) DEFAULT NULL, \ntype varchar(50) DEFAULT NULL, \nPRIMARY KEY  (eventID), \nKEY subscriberID (subscriberID), \nKEY reportID (reportID), \nKEY urlID (urlID), \nKEY listID (listID), \nKEY eventdate (eventdate), \nKEY type (type)\n) {$collate};\n";
     //dbDelta($command);
     $report_url_table = SendPress_DB_Tables::report_url_table();
     $command .= " CREATE TABLE {$report_url_table} (\nurlID int(11) unsigned NOT NULL AUTO_INCREMENT, \nurl varchar(2000) DEFAULT NULL, \nreportID int(11) DEFAULT NULL, \nPRIMARY KEY  (urlID), \nKEY reportID (reportID), \nKEY url (url(255))\n) {$collate};\n";
     //  dbDelta($command);
     $subscriber_status_table = SendPress_DB_Tables::subscriber_status_table();
     $command .= " CREATE TABLE {$subscriber_status_table} (\nstatusid int(11) unsigned NOT NULL AUTO_INCREMENT, \nstatus varchar(255) DEFAULT NULL, \nPRIMARY KEY  (statusid)\n) {$collate};\n";
     /*
     $subscriber_tracker_table =  SendPress_DB_Tables::subscriber_tracker_table();
     $command .= " CREATE TABLE $subscriber_tracker_table (
       subscriberID int(11) unsigned NOT NULL,
       emailID int(11) unsigned NOT NULL,
       sent_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 
       opened_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
       status tinyint(4) NOT NULL DEFAULT '0',
       PRIMARY KEY  (subscriberID,emailID)
     )  $collate;\n"; 
     */
     /*
     $subscriber_url_table =  SendPress_DB_Tables::subscriber_url_table();
     $command .= " CREATE TABLE $subscriber_url_table (
         subscriberID int(11) unsigned NOT NULL,
         emailID int(11) unsigned NOT NULL,
         urlID int(11) unsigned NOT NULL,
         clicked_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 
         click_count int(11) unsigned NOT NULL,
         PRIMARY KEY  ( subscriberID , emailID , urlID )
     )  $collate;\n"; 
     */
     /*
     $url_table =  SendPress_DB_Tables::url_table();
     $command .= " CREATE TABLE $url_table (
       urlID int(11) unsigned NOT NULL AUTO_INCREMENT,
       url text,
       hash varchar(255) DEFAULT NULL, 
       PRIMARY KEY  (urlID),
       KEY hash (hash)
     )  $collate;\n"; 
     */
     dbDelta($command);
     $unconfirmed = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$subscriber_status_table} WHERE statusid = %d", 1));
     if ($unconfirmed != null) {
         $wpdb->update($subscriber_status_table, array('status' => 'Unconfirmed'), array('statusid' => 1), array('%s'), array('%d'));
     } else {
         $wpdb->insert($subscriber_status_table, array('statusid' => 1, 'status' => 'Unconfirmed'), array('%d', '%s'));
     }
     $active = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$subscriber_status_table} WHERE statusid = %d", 2));
     if ($active != null) {
         $wpdb->update($subscriber_status_table, array('status' => 'Active'), array('statusid' => 2), array('%s'), array('%d'));
     } else {
         $wpdb->insert($subscriber_status_table, array('statusid' => 2, 'status' => 'Active'), array('%d', '%s'));
     }
     $unsubscribed = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$subscriber_status_table} WHERE statusid = %d", 3));
     if ($unsubscribed != null) {
         $wpdb->update($subscriber_status_table, array('status' => 'Unsubscribed'), array('statusid' => 3), array('%s'), array('%d'));
     } else {
         $wpdb->insert($subscriber_status_table, array('statusid' => 3, 'status' => 'Unsubscribed'), array('%d', '%s'));
     }
     $bounced = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$subscriber_status_table} WHERE statusid = %d", 4));
     if ($bounced != null) {
         $wpdb->update($subscriber_status_table, array('status' => 'Bounced'), array('statusid' => 4), array('%s'), array('%d'));
     } else {
         $wpdb->insert($subscriber_status_table, array('statusid' => 4, 'status' => 'Bounced'), array('%d', '%s'));
     }
 }
Esempio n. 11
0
<?php

// Prevent loading this file directly
if (!defined('SENDPRESS_VERSION')) {
    header('HTTP/1.0 403 Forbidden');
    die;
}
global $wpdb;
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$subscriber_events_table = SendPress_DB_Tables::subscriber_event_table();
$wpdb->flush();
if ($wpdb->get_var("show tables like '{$subscriber_events_table}'") != $subscriber_events_table) {
    $sqltable = "CREATE TABLE " . $subscriber_events_table . " (\n\t  `eventID` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t  `subscriberID` int(11) unsigned NOT NULL,\n\t  `reportID` int(11) unsigned NOT NULL,\n\t  `urlID` int(11) unsigned DEFAULT NULL,\n\t  `eventdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t  `ip`  varchar(400) DEFAULT NULL,\n\t  `devicetype`  varchar(50) DEFAULT NULL,\n\t  `device`  varchar(50) DEFAULT NULL,\n\t  `type` varchar(50) DEFAULT NULL,\n\t  PRIMARY KEY (`eventID`),\n\t  KEY `subscriberID` (`subscriberID`),\n\t  KEY `reportID` (`reportID`),\n\t  KEY `urlID` (`urlID`),\n\t  KEY `eventdate` (`eventdate`),\n\t  KEY `type` (`type`)\n\t)";
    dbDelta($sqltable);
}
Esempio n. 12
0
<?php

// Prevent loading this file directly
if (!defined('SENDPRESS_VERSION')) {
    header('HTTP/1.0 403 Forbidden');
    die;
}
global $wpdb;
// Create Stats Table
$subscriber_status_table = SendPress_DB_Tables::subscriber_status_table();
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$wpdb->flush();
if ($wpdb->get_var("show tables like '{$subscriber_status_table}'") != $subscriber_status_table) {
    $sqltable = "CREATE TABLE " . $subscriber_status_table . " (\n\t\t\t  `statusid` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t  `status` varchar(255) DEFAULT NULL,\n\t\t\t  PRIMARY KEY (`statusid`)\n\t\t\t)";
    dbDelta($sqltable);
}
$unconfirmed = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$subscriber_status_table} WHERE statusid = %d", 1));
if ($unconfirmed != null) {
    $wpdb->update($subscriber_status_table, array('status' => 'Unconfirmed'), array('statusid' => 1), array('%s'), array('%d'));
} else {
    $wpdb->insert($subscriber_status_table, array('statusid' => 1, 'status' => 'Unconfirmed'), array('%d', '%s'));
}
$active = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$subscriber_status_table} WHERE statusid = %d", 2));
if ($active != null) {
    $wpdb->update($subscriber_status_table, array('status' => 'Active'), array('statusid' => 2), array('%s'), array('%d'));
} else {
    $wpdb->insert($subscriber_status_table, array('statusid' => 2, 'status' => 'Active'), array('%d', '%s'));
}
$unsubscribed = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$subscriber_status_table} WHERE statusid = %d", 3));
if ($unsubscribed != null) {
    $wpdb->update($subscriber_status_table, array('status' => 'Unsubscribed'), array('statusid' => 3), array('%s'), array('%d'));
Esempio n. 13
0
 static function plugin_install()
 {
     if (version_compare($GLOBALS['wp_version'], SENDPRESS_MINIMUM_WP_VERSION, '<')) {
         deactivate_plugins(__FILE__);
         wp_die(sprintf(__('SendPress requires WordPress version %s or later.', 'sendpress'), SENDPRESS_MINIMUM_WP_VERSION));
     } else {
         SendPress_DB_Tables::install();
         @SPNL()->db->subscribers_tracker->create_table();
         @SPNL()->db->subscribers_url->create_table();
         @SPNL()->db->url->create_table();
     }
     //Make sure we stop the old action from running
     wp_clear_scheduled_hook('sendpress_cron_action_run');
     flush_rewrite_rules();
     SendPress::add_cron();
     SendPress_Option::set('install_date', time());
 }