Skip to content

Commit b364cdb

Browse files
committed
Merge branch 'develop' into 7.0dev
# Conflicts: # conf/_application.php # install/_functions_evoupgrade.php
2 parents 8d34e32 + a734527 commit b364cdb

18 files changed

Lines changed: 4640 additions & 3953 deletions

File tree

_transifex/messages.pot

Lines changed: 1448 additions & 1281 deletions
Large diffs are not rendered by default.

conf/_application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Release date (ISO)
2222
* @global string
2323
*/
24-
$app_date = '2017-12-29';
24+
$app_date = '2018-01-01';
2525

2626
/**
2727
* Long version string for checking differences

inc/_core/__core.init.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,10 @@ function build_evobar_menu()
11831183
'text' => T_('Maintenance').'…',
11841184
'href' => $admin_url.'?ctrl=tools',
11851185
);
1186+
$entries['site']['entries']['system']['entries']['auto_upgrade'] = array(
1187+
'text' => T_('Auto-Upgrade').'…',
1188+
'href' => $admin_url.'?ctrl=upgrade',
1189+
);
11861190
$entries['site']['entries']['system']['entries']['syslog'] = array(
11871191
'text' => T_('System log'),
11881192
'href' => $admin_url.'?ctrl=syslog',

inc/_core/model/__core.install.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,12 @@
528528
ecmp_email_text TEXT NULL,
529529
ecmp_email_plaintext TEXT NULL,
530530
ecmp_sent_ts TIMESTAMP NULL,
531+
ecmp_auto_sent_ts TIMESTAMP NULL,
531532
ecmp_renderers VARCHAR(255) COLLATE ascii_general_ci NOT NULL,"/* Do NOT change this field back to TEXT without a very good reason. */."
532533
ecmp_use_wysiwyg TINYINT(1) NOT NULL DEFAULT 0,
533534
ecmp_send_ctsk_ID INT(10) UNSIGNED NULL DEFAULT NULL,
535+
ecmp_auto_send ENUM('no', 'subscription', 'sequence') COLLATE ascii_general_ci NOT NULL DEFAULT 'no',
536+
ecmp_sequence INT UNSIGNED NULL DEFAULT NULL,
534537
PRIMARY KEY (ecmp_ID)
535538
) ENGINE = myisam DEFAULT CHARACTER SET = $db_storage_charset" ),
536539

inc/collections/views/_coll_features.form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176

177177
$Form->begin_fieldset( T_('Post moderation').get_manual_link( 'post-moderation' ) );
178178

179-
$Form->checkbox( 'post_anonymous', $edited_Blog->get_setting( 'post_anonymous' ), T_('New posts by anonymous users'), T_('Check to allow create posts for anonymous users. NOTE: users will be registered after posting automatically.') );
179+
$Form->checkbox( 'post_anonymous', $edited_Blog->get_setting( 'post_anonymous' ), T_('New posts by anonymous users'), T_('Check to allow anonymous users to create new posts (useful for Forums). NOTE: a user accoutn will be automatically created when they post.') );
180180

181181
// Get max allowed visibility status:
182182
$max_allowed_status = get_highest_publish_status( 'comment', $edited_Blog->ID, false );

inc/email_campaigns/model/_emailcampaign.class.php

Lines changed: 80 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ class EmailCampaign extends DataObject
3939

4040
var $sent_ts;
4141

42+
var $auto_sent_ts;
43+
4244
var $use_wysiwyg = 0;
4345

4446
var $send_ctsk_ID;
4547

48+
var $auto_send = 'no';
49+
50+
var $sequence;
51+
4652
var $Newsletter = NULL;
4753

4854
/**
@@ -83,9 +89,12 @@ function __construct( $db_row = NULL )
8389
$this->email_text = $db_row->ecmp_email_text;
8490
$this->email_plaintext = $db_row->ecmp_email_plaintext;
8591
$this->sent_ts = $db_row->ecmp_sent_ts;
92+
$this->auto_sent_ts = $db_row->ecmp_auto_sent_ts;
8693
$this->renderers = $db_row->ecmp_renderers;
8794
$this->use_wysiwyg = $db_row->ecmp_use_wysiwyg;
8895
$this->send_ctsk_ID = $db_row->ecmp_send_ctsk_ID;
96+
$this->auto_send = $db_row->ecmp_auto_send;
97+
$this->sequence = $db_row->ecmp_sequence;
8998
}
9099
}
91100

@@ -447,7 +456,8 @@ function update_recipients( $force_update = false )
447456
SELECT '.$this->ID.', enls_user_ID
448457
FROM T_email__newsletter_subscription
449458
WHERE enls_enlt_ID = '.$this->get( 'enlt_ID' ).'
450-
AND enls_subscribed = 1' );
459+
AND enls_subscribed = 1
460+
ON DUPLICATE KEY UPDATE csnd_camp_ID = csnd_camp_id, csnd_user_ID = csnd_user_ID' );
451461
}
452462

453463

@@ -491,6 +501,16 @@ function load_from_Request()
491501
$this->set_from_Request( 'email_text' );
492502
}
493503

504+
if( param( 'ecmp_auto_send', 'string', NULL ) !== NULL )
505+
{ // Auto send:
506+
$this->set_from_Request( 'auto_send' );
507+
if( $this->get( 'auto_send' ) == 'sequence' )
508+
{ // Day in sequence:
509+
param( 'ecmp_sequence', 'integer', NULL );
510+
$this->set_from_Request( 'sequence', NULL, true );
511+
}
512+
}
513+
494514
return ! param_errors_detected();
495515
}
496516

@@ -578,8 +598,10 @@ function send_email( $user_ID, $email_address = '', $mode = '' )
578598
}
579599
}
580600
else
581-
{ // Send a newsletter to real user
582-
$r = send_mail_to_User( $user_ID, $this->get( 'email_title' ), 'newsletter', $newsletter_params, false, array(), $email_address );
601+
{ // Send a newsletter to real user:
602+
// Force email sending to not activated users if email campaign is configurated to auto sending (e-g to send email on auto subscription on registration):
603+
$force_on_non_activated = in_array( $this->get( 'auto_send' ), array( 'subscription', 'sequence' ) );
604+
$r = send_mail_to_User( $user_ID, $this->get( 'email_title' ), 'newsletter', $newsletter_params, $force_on_non_activated, array(), $email_address );
583605
if( $r )
584606
{ // Update last sending data for newsletter per user:
585607
global $DB, $servertimenow;
@@ -597,17 +619,25 @@ function send_email( $user_ID, $email_address = '', $mode = '' )
597619
/**
598620
* Send email newsletter for all users of this campaign
599621
*
600-
* @param boolean
622+
* @param boolean TRUE to print out messages
623+
* @param array Force users instead of users which are ready to receive this email campaign
601624
*/
602-
function send_all_emails( $display_messages = true )
625+
function send_all_emails( $display_messages = true, $user_IDs = NULL )
603626
{
604627
global $DB, $localtimenow, $mail_log_insert_ID, $Settings, $Messages;
605628

606-
// Send emails only for users which still don't receive emails:
607-
$user_IDs = $this->get_recipients( 'wait' );
629+
if( $user_IDs === NULL )
630+
{ // Send emails only for users which still don't receive emails:
631+
$user_IDs = $this->get_recipients( 'wait' );
632+
}
633+
else
634+
{ // Exclude users which already received this email campaign to avoid double sending even with forcing user IDs:
635+
$receive_user_IDs = $this->get_recipients( 'receive' );
636+
$user_IDs = array_diff( $user_IDs, $receive_user_IDs );
637+
}
608638

609639
if( empty( $user_IDs ) )
610-
{ // No users, Exit here
640+
{ // No users, Exit here:
611641
return;
612642
}
613643

@@ -617,10 +647,7 @@ function send_all_emails( $display_messages = true )
617647
$this->set( 'sent_ts', date( 'Y-m-d H:i:s', $localtimenow ) );
618648
$this->dbupdate();
619649

620-
if( $display_messages )
621-
{ // We need in this cache when display the messages
622-
$UserCache = & get_UserCache();
623-
}
650+
$UserCache = & get_UserCache();
624651

625652
// Get chunk size to limit a sending at a time:
626653
$email_campaign_chunk_size = intval( $Settings->get( 'email_campaign_chunk_size' ) );
@@ -650,10 +677,8 @@ function send_all_emails( $display_messages = true )
650677

651678
if( $result )
652679
{ // Email newsletter was sent for user successfully:
653-
$DB->query( 'UPDATE T_email__campaign_send
654-
SET csnd_emlog_ID = '.$DB->quote( $mail_log_insert_ID ).'
655-
WHERE csnd_camp_ID = '.$DB->quote( $this->ID ).'
656-
AND csnd_user_ID = '.$DB->quote( $user_ID ) );
680+
$DB->query( 'REPLACE INTO T_email__campaign_send ( csnd_camp_ID, csnd_user_ID, csnd_emlog_ID )
681+
VALUES ( '.$DB->quote( $this->ID ).', '.$DB->quote( $user_ID ).', '.$DB->quote( $mail_log_insert_ID ).' )' );
657682

658683
// Update arrays where we store which users received email and who waiting it now:
659684
$this->users['receive'][] = $user_ID;
@@ -692,19 +717,22 @@ function send_all_emails( $display_messages = true )
692717

693718
$DB->commit();
694719

695-
$Messages->clear();
696-
$wait_count = count( $this->users['wait'] );
697-
if( $wait_count > 0 )
698-
{ // Some recipients still wait this newsletter:
699-
$Messages->add( sprintf( T_('Emails have been sent to a chunk of %s recipients. %s recipients were skipped. %s recipients have not been sent to yet.'),
700-
$email_campaign_chunk_size, $email_skip_count, $wait_count ), 'warning' );
701-
}
702-
else
703-
{ // All recipients received this bewsletter:
704-
$Messages->add( T_('Emails have been sent to all recipients of this campaign.'), 'success' );
720+
if( $display_messages )
721+
{ // Print the messages:
722+
$Messages->clear();
723+
$wait_count = count( $this->users['wait'] );
724+
if( $wait_count > 0 )
725+
{ // Some recipients still wait this newsletter:
726+
$Messages->add( sprintf( T_('Emails have been sent to a chunk of %s recipients. %s recipients were skipped. %s recipients have not been sent to yet.'),
727+
$email_campaign_chunk_size, $email_skip_count, $wait_count ), 'warning' );
728+
}
729+
else
730+
{ // All recipients received this bewsletter:
731+
$Messages->add( T_('Emails have been sent to all recipients of this campaign.'), 'success' );
732+
}
733+
echo '<br />';
734+
$Messages->display();
705735
}
706-
echo '<br />';
707-
$Messages->display();
708736
}
709737

710738

@@ -833,6 +861,30 @@ function create_cron_job( $next_chunk = false )
833861

834862
return true;
835863
}
864+
865+
866+
/**
867+
* Get title of sending method
868+
*
869+
* @return string
870+
*/
871+
function get_sending_title()
872+
{
873+
$titles = array(
874+
'no' => T_('Manual'),
875+
'subscription' => T_('At subscription'),
876+
'sequence' => T_('Sequence'),
877+
);
878+
879+
if( isset( $titles[ $this->get( 'auto_send' ) ] ) )
880+
{
881+
return $titles[ $this->get( 'auto_send' ) ]
882+
.( $this->get( 'auto_send' ) == 'sequence' ? ': '.$this->get( 'sequence' ) : '' );
883+
}
884+
885+
// Unknown sending method
886+
return $this->get( 'auto_send' );
887+
}
836888
}
837889

838890
?>

inc/email_campaigns/views/_campaigns.view.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// Create result set:
1919

2020
$SQL = new SQL();
21-
$SQL->SELECT( 'SQL_NO_CACHE ecmp_ID, ecmp_date_ts, enlt_ID, enlt_name, ecmp_email_title, ecmp_sent_ts' );
21+
$SQL->SELECT( 'SQL_NO_CACHE *' );
2222
$SQL->FROM( 'T_email__campaign' );
2323
$SQL->FROM_add( 'INNER JOIN T_email__newsletter ON ecmp_enlt_ID = enlt_ID' );
2424

@@ -28,7 +28,7 @@
2828
$count_SQL->FROM_add( 'INNER JOIN T_email__newsletter ON ecmp_enlt_ID = enlt_ID' );
2929

3030
$Results = new Results( $SQL->get(), 'emcmp_', 'D', $UserSettings->get( 'results_per_page' ), $count_SQL->get() );
31-
31+
$Results->Cache = & get_EmailCampaignCache();
3232
$Results->title = T_('Email campaigns').get_manual_link( 'email-campaigns' );
3333

3434
if( $current_User->check_perm( 'emails', 'edit' ) )
@@ -68,14 +68,31 @@
6868
);
6969

7070
$Results->cols[] = array(
71-
'th' => T_('Sent'),
71+
'th' => T_('Sending'),
72+
'order' => 'ecmp_auto_send',
73+
'th_class' => 'shrinkwrap',
74+
'td_class' => 'nowrap',
75+
'td' => '%{Obj}->get_sending_title()%',
76+
);
77+
78+
$Results->cols[] = array(
79+
'th' => T_('Sent manually'),
7280
'order' => 'ecmp_sent_ts',
7381
'default_dir' => 'D',
7482
'th_class' => 'shrinkwrap',
7583
'td_class' => 'timestamp compact_data',
7684
'td' => '%mysql2localedatetime_spans( #ecmp_sent_ts# )%',
7785
);
7886

87+
$Results->cols[] = array(
88+
'th' => T_('Sent automatically'),
89+
'order' => 'ecmp_auto_sent_ts',
90+
'default_dir' => 'D',
91+
'th_class' => 'shrinkwrap',
92+
'td_class' => 'timestamp compact_data',
93+
'td' => '%mysql2localedatetime_spans( #ecmp_auto_sent_ts# )%',
94+
);
95+
7996
$Results->cols[] = array(
8097
'th' => T_('Actions'),
8198
'th_class' => 'shrinkwrap',

inc/email_campaigns/views/_campaigns_info.form.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@
3232
$Form->begin_fieldset( T_('Campaign info').get_manual_link( 'creating-an-email-campaign' ) );
3333
$Form->text_input( 'ecmp_email_title', $edited_EmailCampaign->get( 'email_title' ) == '' ? $edited_EmailCampaign->get( 'name' ) : $edited_EmailCampaign->get( 'email_title' ), 60, T_('Email title'), '', array( 'maxlength' => 255, 'required' => true ) );
3434
$Form->info( T_('Campaign created'), mysql2localedatetime_spans( $edited_EmailCampaign->get( 'date_ts' ) ) );
35-
$Form->info( T_('Last sent'), $edited_EmailCampaign->get( 'sent_ts' ) ? mysql2localedatetime_spans( $edited_EmailCampaign->get( 'sent_ts' ) ) : T_('Not sent yet') );
35+
$Form->info( T_('Last sent manually'), $edited_EmailCampaign->get( 'sent_ts' ) ? mysql2localedatetime_spans( $edited_EmailCampaign->get( 'sent_ts' ) ) : T_('Not sent yet') );
36+
$Form->info( T_('Last sent automatically'), $edited_EmailCampaign->get( 'auto_sent_ts' ) ? mysql2localedatetime_spans( $edited_EmailCampaign->get( 'auto_sent_ts' ) ) : T_('Not sent yet') );
37+
$Form->radio_input( 'ecmp_auto_send', $edited_EmailCampaign->get( 'auto_send' ), array(
38+
array( 'value' => 'no', 'label' => T_('No (Manual sending only)') ),
39+
array( 'value' => 'subscription', 'label' => T_('At subscription') ),
40+
array( 'value' => 'sequence', 'label' => T_('As part of a sequence') ),
41+
), T_('Auto send'), array( 'lines' => true ) );
42+
$Form->text_input( 'ecmp_sequence', $edited_EmailCampaign->get( 'sequence' ), 10, T_('Day in sequence') );
3643
$Form->end_fieldset();
3744

3845
$Form->begin_fieldset( T_('Newsletter recipients') );
@@ -58,4 +65,24 @@
5865
}
5966
$Form->end_form( $buttons );
6067

61-
?>
68+
?>
69+
<script type="text/javascript">
70+
jQuery( document ).ready( function()
71+
{
72+
jQuery( 'input[name=ecmp_auto_send]' ).click( function() {
73+
visible_ecmp_sequence( jQuery( this ) );
74+
} );
75+
visible_ecmp_sequence( jQuery( 'input[name=ecmp_auto_send]:checked' ) );
76+
} );
77+
function visible_ecmp_sequence( obj )
78+
{
79+
if( obj.val() == 'sequence' )
80+
{
81+
jQuery( '#ffield_ecmp_sequence' ).show();
82+
}
83+
else
84+
{
85+
jQuery( '#ffield_ecmp_sequence' ).hide();
86+
}
87+
}
88+
</script>

inc/regional/countries.ctrl.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@
123123
{ // Enable country by setting flag to true.
124124
$edited_Country->set( 'preferred', 1 );
125125
$Messages->add( sprintf( T_('Added to preferred countries (%s, #%d).'), $edited_Country->name, $edited_Country->ID ), 'success' );
126-
127-
if( ! $edited_Country->get( 'status' ) )
128-
{ // If the country status is empty ( which means 'unknown' ) and the coutnry was marked as prefrerred, than the status must be changed to 'trusted'
129-
$edited_Country->set( 'status', 'trusted' );
130-
}
131126
}
132127

133128
// Update db with new flag value.

inc/regional/views/_country_list.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
{
4444
$SQL->WHERE_and( 'ctry_status IS NULL' );
4545
}
46-
else
46+
elseif( $status != -1 )
4747
{
4848
$SQL->WHERE_and( 'ctry_status = '.$DB->quote( $status ) );
4949
}

0 commit comments

Comments
 (0)