Version Description
(May 10, 2016) = * Closed Enhancement: Create new audit trail class - Issue #425 * Closed Enhancement: Raise minimum WordPress version to 4.1 - Issue #423 * Closed Enhancement: WordPress Compatibility with 4.5.2 - Issue #422 * Closed Enhancement: Move installation process into new QSM_Install class - Issue #416 * Closed Enhancement: Update links for plugin on Plugins page - Issue #415 * Closed Bug: Activating plugin on fresh install causes unexpected output warning - Issue #414 * Closed User Request: Shortcode parameter to override amount of questions - Issue #345 * Closed Enhancement: Limit per user - upgrade to include non-logged in users - Issue #301
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 4.7.1 |
Comparing to | |
See all releases |
Code changes from version 4.7.0 to 4.7.1
- CHANGELOG.md +9 -1
- ISSUE_TEMPLATE.md +16 -0
- mlw_quizmaster2.php +19 -9
- php/about-page.php +1 -1
- php/admin-results-page.php +4 -35
- php/class-qmn-quiz-creator.php +8 -75
- php/class-qmn-quiz-manager.php +69 -20
- php/class-qmn-review-message.php +10 -1
- php/class-qmn-tracking.php +1 -1
- php/class-qsm-audit.php +59 -0
- php/class-qsm-install.php +657 -0
- php/install.php +0 -157
- php/options-page-certificate-tab.php +1 -17
- php/options-page-email-tab.php +7 -58
- php/options-page-leaderboard-tab.php +1 -17
- php/options-page-option-tab.php +3 -22
- php/options-page-questions-tab.php +14 -122
- php/options-page-results-page-tab.php +6 -44
- php/options-page-style-tab.php +4 -23
- php/options-page-text-tab.php +3 -22
- php/options-page-tools-tab.php +1 -17
- php/updates.php +0 -433
- readme.txt +15 -13
CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 4.6.6 (January 11, 2016) =
|
2 |
* Fixes bug preventing some users to not be able to submit quiz
|
3 |
* Fixes bug causing undefined titles for some users
|
@@ -21,7 +29,7 @@
|
|
21 |
|
22 |
= 4.6.2 (October 21, 2015) =
|
23 |
* Bug fix for browsers with JavaScript turned off
|
24 |
-
|
25 |
= 4.6.1 (October 20, 2015) =
|
26 |
* Bug fix for rare bug preventing IE usage on a small number of sites
|
27 |
|
1 |
+
= 4.6.7 (January 22, 2016) =
|
2 |
+
* Fixes bug causing multiple response to be on a single line for some users
|
3 |
+
* Fixes bug causing the incorrect/correct CSS class from being not added on results page correctly
|
4 |
+
* Fixes bug causing unexpected output error when activating plugin
|
5 |
+
* Changes comment section to default to off in newer quizzes
|
6 |
+
* Adds link to online academy to help page
|
7 |
+
* Cleans up installation function code
|
8 |
+
|
9 |
= 4.6.6 (January 11, 2016) =
|
10 |
* Fixes bug preventing some users to not be able to submit quiz
|
11 |
* Fixes bug causing undefined titles for some users
|
29 |
|
30 |
= 4.6.2 (October 21, 2015) =
|
31 |
* Bug fix for browsers with JavaScript turned off
|
32 |
+
|
33 |
= 4.6.1 (October 20, 2015) =
|
34 |
* Bug fix for rare bug preventing IE usage on a small number of sites
|
35 |
|
ISSUE_TEMPLATE.md
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Please provide the following information when creating your issues:
|
2 |
+
|
3 |
+
## General description
|
4 |
+
If this is a bug, give a general description of what you are experiencing. If this is a feature request, include what the feature your are requesting.
|
5 |
+
|
6 |
+
## Expected behavior
|
7 |
+
If you are reporting a bug, please describe what you are expecting the plugin to do. If this is a feature request, delete this section.
|
8 |
+
|
9 |
+
## Actual behavior
|
10 |
+
If you are reporting a bug, please describe what you are experiencing. If this is a feature request, delete this section.
|
11 |
+
|
12 |
+
## Steps to reproduce the behavior
|
13 |
+
If you are reporting a bug, describe the exact steps you are taking that results in the behavior described above. If this is a feature request, delete this section.
|
14 |
+
|
15 |
+
## Feature request
|
16 |
+
If you are reporting a bug, delete this section. If you are requesting a feature, please explain what you would like to have in the plugin. Please include examples of other systems/software that may have similar features as well as the exact way you would use this feature.
|
mlw_quizmaster2.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
-
* Version: 4.7.
|
6 |
* Author: Frank Corso
|
7 |
* Author URI: http://www.quizandsurveymaster.com/
|
8 |
* Plugin URI: http://www.quizandsurveymaster.com/
|
@@ -10,9 +10,11 @@
|
|
10 |
* Domain Path: /languages
|
11 |
*
|
12 |
* @author Frank Corso
|
13 |
-
* @version 4.7.
|
14 |
*/
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
|
|
|
|
16 |
/**
|
17 |
* This class is the main class of the plugin
|
18 |
*
|
@@ -28,7 +30,7 @@ class MLWQuizMasterNext
|
|
28 |
* @var string
|
29 |
* @since 4.0.0
|
30 |
*/
|
31 |
-
public $version = '4.7.
|
32 |
|
33 |
/**
|
34 |
* QMN Alert Manager Object
|
@@ -62,6 +64,14 @@ class MLWQuizMasterNext
|
|
62 |
*/
|
63 |
public $log_manager;
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
/**
|
66 |
* Main Construct Function
|
67 |
*
|
@@ -72,8 +82,7 @@ class MLWQuizMasterNext
|
|
72 |
* @uses MLWQuizMasterNext::add_hooks() Adds actions to hooks and filters
|
73 |
* @return void
|
74 |
*/
|
75 |
-
public function __construct()
|
76 |
-
{
|
77 |
$this->load_dependencies();
|
78 |
$this->add_hooks();
|
79 |
}
|
@@ -87,11 +96,14 @@ class MLWQuizMasterNext
|
|
87 |
private function load_dependencies()
|
88 |
{
|
89 |
|
90 |
-
include("php/install.php");
|
91 |
|
92 |
include("php/class-qmn-log-manager.php");
|
93 |
$this->log_manager = new QMN_Log_Manager;
|
94 |
|
|
|
|
|
|
|
95 |
if ( is_admin() ) {
|
96 |
include("php/stats-page.php");
|
97 |
include("php/quizzes-page.php");
|
@@ -121,7 +133,6 @@ class MLWQuizMasterNext
|
|
121 |
include("php/class-qmn-quiz-manager.php");
|
122 |
|
123 |
include("php/leaderboard-shortcode.php");
|
124 |
-
include("php/updates.php");
|
125 |
include("php/widgets.php");
|
126 |
include("php/template-variables.php");
|
127 |
include("php/adverts-generate.php");
|
@@ -150,7 +161,6 @@ class MLWQuizMasterNext
|
|
150 |
{
|
151 |
add_action('admin_menu', array( $this, 'setup_admin_menu'));
|
152 |
add_action('admin_head', array( $this, 'admin_head'), 900);
|
153 |
-
add_action('admin_init', 'mlw_quiz_update');
|
154 |
add_action('widgets_init', create_function('', 'return register_widget("Mlw_Qmn_Leaderboard_Widget");'));
|
155 |
add_shortcode('mlw_quizmaster_leaderboard', 'mlw_quiz_leaderboard_shortcode');
|
156 |
add_action('plugins_loaded', array( $this, 'setup_translations'));
|
@@ -273,5 +283,5 @@ class MLWQuizMasterNext
|
|
273 |
}
|
274 |
|
275 |
$mlwQuizMasterNext = new MLWQuizMasterNext();
|
276 |
-
register_activation_hook( __FILE__, '
|
277 |
?>
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
+
* Version: 4.7.1
|
6 |
* Author: Frank Corso
|
7 |
* Author URI: http://www.quizandsurveymaster.com/
|
8 |
* Plugin URI: http://www.quizandsurveymaster.com/
|
10 |
* Domain Path: /languages
|
11 |
*
|
12 |
* @author Frank Corso
|
13 |
+
* @version 4.7.1
|
14 |
*/
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
16 |
+
|
17 |
+
define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
18 |
/**
|
19 |
* This class is the main class of the plugin
|
20 |
*
|
30 |
* @var string
|
31 |
* @since 4.0.0
|
32 |
*/
|
33 |
+
public $version = '4.7.1';
|
34 |
|
35 |
/**
|
36 |
* QMN Alert Manager Object
|
64 |
*/
|
65 |
public $log_manager;
|
66 |
|
67 |
+
/**
|
68 |
+
* QSM Audit Manager Object
|
69 |
+
*
|
70 |
+
* @var object
|
71 |
+
* @since 4.7.1
|
72 |
+
*/
|
73 |
+
public $audit_manager;
|
74 |
+
|
75 |
/**
|
76 |
* Main Construct Function
|
77 |
*
|
82 |
* @uses MLWQuizMasterNext::add_hooks() Adds actions to hooks and filters
|
83 |
* @return void
|
84 |
*/
|
85 |
+
public function __construct() {
|
|
|
86 |
$this->load_dependencies();
|
87 |
$this->add_hooks();
|
88 |
}
|
96 |
private function load_dependencies()
|
97 |
{
|
98 |
|
99 |
+
include("php/class-qsm-install.php");
|
100 |
|
101 |
include("php/class-qmn-log-manager.php");
|
102 |
$this->log_manager = new QMN_Log_Manager;
|
103 |
|
104 |
+
include( "php/class-qsm-audit.php" );
|
105 |
+
$this->audit_manager = new QSM_Audit();
|
106 |
+
|
107 |
if ( is_admin() ) {
|
108 |
include("php/stats-page.php");
|
109 |
include("php/quizzes-page.php");
|
133 |
include("php/class-qmn-quiz-manager.php");
|
134 |
|
135 |
include("php/leaderboard-shortcode.php");
|
|
|
136 |
include("php/widgets.php");
|
137 |
include("php/template-variables.php");
|
138 |
include("php/adverts-generate.php");
|
161 |
{
|
162 |
add_action('admin_menu', array( $this, 'setup_admin_menu'));
|
163 |
add_action('admin_head', array( $this, 'admin_head'), 900);
|
|
|
164 |
add_action('widgets_init', create_function('', 'return register_widget("Mlw_Qmn_Leaderboard_Widget");'));
|
165 |
add_shortcode('mlw_quizmaster_leaderboard', 'mlw_quiz_leaderboard_shortcode');
|
166 |
add_action('plugins_loaded', array( $this, 'setup_translations'));
|
283 |
}
|
284 |
|
285 |
$mlwQuizMasterNext = new MLWQuizMasterNext();
|
286 |
+
register_activation_hook( __FILE__, array( 'QSM_Install', 'install' ) );
|
287 |
?>
|
php/about-page.php
CHANGED
@@ -59,7 +59,7 @@ function mlw_generate_about_page()
|
|
59 |
</div>
|
60 |
<div id="mlw_quiz_changelog" class="qmn_tab" style="display: none;">
|
61 |
<h2>Changelog</h2>
|
62 |
-
<?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next',
|
63 |
</div>
|
64 |
<div id="qmn_contributors" class="qmn_tab" style="display:none;">
|
65 |
<h2>GitHub Contributors</h2>
|
59 |
</div>
|
60 |
<div id="mlw_quiz_changelog" class="qmn_tab" style="display: none;">
|
61 |
<h2>Changelog</h2>
|
62 |
+
<?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 21 ); ?>
|
63 |
</div>
|
64 |
<div id="qmn_contributors" class="qmn_tab" style="display:none;">
|
65 |
<h2>GitHub Contributors</h2>
|
php/admin-results-page.php
CHANGED
@@ -32,26 +32,9 @@ function mlw_generate_quiz_results()
|
|
32 |
),
|
33 |
array( '%d' )
|
34 |
);
|
35 |
-
if ( $results )
|
36 |
-
{
|
37 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your results has been deleted successfully.','quiz-master-next'), 'success');
|
38 |
-
|
39 |
-
//Insert Action Into Audit Trail
|
40 |
-
global $current_user;
|
41 |
-
get_currentuserinfo();
|
42 |
-
$wpdb->insert(
|
43 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
44 |
-
array(
|
45 |
-
'action_user' => $current_user->display_name,
|
46 |
-
'action' => "Results Has Been Deleted From: $mlw_delete_results_name",
|
47 |
-
'time' => date("h:i:s A m/d/Y")
|
48 |
-
),
|
49 |
-
array(
|
50 |
-
'%s',
|
51 |
-
'%s',
|
52 |
-
'%s'
|
53 |
-
)
|
54 |
-
);
|
55 |
}
|
56 |
else
|
57 |
{
|
@@ -80,22 +63,8 @@ function mlw_generate_quiz_results()
|
|
80 |
array( '%d' )
|
81 |
);
|
82 |
}
|
83 |
-
|
84 |
-
|
85 |
-
get_currentuserinfo();
|
86 |
-
$wpdb->insert(
|
87 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
88 |
-
array(
|
89 |
-
'action_user' => $current_user->display_name,
|
90 |
-
'action' => "Results Have Been Bulk Deleted",
|
91 |
-
'time' => date("h:i:s A m/d/Y")
|
92 |
-
),
|
93 |
-
array(
|
94 |
-
'%s',
|
95 |
-
'%s',
|
96 |
-
'%s'
|
97 |
-
)
|
98 |
-
);
|
99 |
}
|
100 |
}
|
101 |
|
32 |
),
|
33 |
array( '%d' )
|
34 |
);
|
35 |
+
if ( $results ) {
|
|
|
36 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your results has been deleted successfully.','quiz-master-next'), 'success');
|
37 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Results Has Been Deleted From: $mlw_delete_results_name" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
else
|
40 |
{
|
63 |
array( '%d' )
|
64 |
);
|
65 |
}
|
66 |
+
|
67 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Results Have Been Bulk Deleted" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
}
|
70 |
|
php/class-qmn-quiz-creator.php
CHANGED
@@ -371,8 +371,7 @@ class QMNQuizCreator
|
|
371 |
if ($results != false)
|
372 |
{
|
373 |
$new_quiz = $wpdb->insert_id;
|
374 |
-
|
375 |
-
get_currentuserinfo();
|
376 |
$quiz_post = array(
|
377 |
'post_title' => $quiz_name,
|
378 |
'post_content' => "[mlw_quizmaster quiz=$new_quiz]",
|
@@ -384,22 +383,7 @@ class QMNQuizCreator
|
|
384 |
add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
|
385 |
|
386 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your new quiz has been created successfully. To begin editing your quiz, click the Edit link on the new quiz.', 'quiz-master-next'), 'success');
|
387 |
-
|
388 |
-
global $current_user;
|
389 |
-
get_currentuserinfo();
|
390 |
-
$wpdb->insert(
|
391 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
392 |
-
array(
|
393 |
-
'action_user' => $current_user->display_name,
|
394 |
-
'action' => "New Quiz Has Been Created: $quiz_name",
|
395 |
-
'time' => date("h:i:s A m/d/Y")
|
396 |
-
),
|
397 |
-
array(
|
398 |
-
'%s',
|
399 |
-
'%s',
|
400 |
-
'%s'
|
401 |
-
)
|
402 |
-
);
|
403 |
do_action('qmn_quiz_created', $new_quiz);
|
404 |
}
|
405 |
else
|
@@ -459,23 +443,7 @@ class QMNQuizCreator
|
|
459 |
}
|
460 |
wp_reset_postdata();
|
461 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been deleted successfully.', 'quiz-master-next'), 'success');
|
462 |
-
|
463 |
-
//Insert Action Into Audit Trail
|
464 |
-
global $current_user;
|
465 |
-
get_currentuserinfo();
|
466 |
-
$wpdb->insert(
|
467 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
468 |
-
array(
|
469 |
-
'action_user' => $current_user->display_name,
|
470 |
-
'action' => "Quiz Has Been Deleted: $quiz_name",
|
471 |
-
'time' => date("h:i:s A m/d/Y")
|
472 |
-
),
|
473 |
-
array(
|
474 |
-
'%s',
|
475 |
-
'%s',
|
476 |
-
'%s'
|
477 |
-
)
|
478 |
-
);
|
479 |
}
|
480 |
else
|
481 |
{
|
@@ -507,26 +475,9 @@ class QMNQuizCreator
|
|
507 |
),
|
508 |
array( '%d' )
|
509 |
);
|
510 |
-
if ($results
|
511 |
-
{
|
512 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz name has been updated successfully.', 'quiz-master-next'), 'success');
|
513 |
-
|
514 |
-
//Insert Action Into Audit Trail
|
515 |
-
global $current_user;
|
516 |
-
get_currentuserinfo();
|
517 |
-
$wpdb->insert(
|
518 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
519 |
-
array(
|
520 |
-
'action_user' => $current_user->display_name,
|
521 |
-
'action' => "Quiz Name Has Been Edited: $quiz_name",
|
522 |
-
'time' => date("h:i:s A m/d/Y")
|
523 |
-
),
|
524 |
-
array(
|
525 |
-
'%s',
|
526 |
-
'%s',
|
527 |
-
'%s'
|
528 |
-
)
|
529 |
-
);
|
530 |
}
|
531 |
else
|
532 |
{
|
@@ -662,10 +613,8 @@ class QMNQuizCreator
|
|
662 |
)
|
663 |
);
|
664 |
$mlw_new_id = $wpdb->insert_id;
|
665 |
-
if ($results
|
666 |
-
|
667 |
-
global $current_user;
|
668 |
-
get_currentuserinfo();
|
669 |
$quiz_post = array(
|
670 |
'post_title' => $quiz_name,
|
671 |
'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
|
@@ -676,23 +625,7 @@ class QMNQuizCreator
|
|
676 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
677 |
add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
|
678 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been duplicated successfully.', 'quiz-master-next'), 'success');
|
679 |
-
|
680 |
-
//Insert Action Into Audit Trail
|
681 |
-
global $current_user;
|
682 |
-
get_currentuserinfo();
|
683 |
-
$wpdb->insert(
|
684 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
685 |
-
array(
|
686 |
-
'action_user' => $current_user->display_name,
|
687 |
-
'action' => "New Quiz Has Been Created: $quiz_name",
|
688 |
-
'time' => date("h:i:s A m/d/Y")
|
689 |
-
),
|
690 |
-
array(
|
691 |
-
'%s',
|
692 |
-
'%s',
|
693 |
-
'%s'
|
694 |
-
)
|
695 |
-
);
|
696 |
do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
|
697 |
}
|
698 |
else
|
371 |
if ($results != false)
|
372 |
{
|
373 |
$new_quiz = $wpdb->insert_id;
|
374 |
+
$current_user = wp_get_current_user();
|
|
|
375 |
$quiz_post = array(
|
376 |
'post_title' => $quiz_name,
|
377 |
'post_content' => "[mlw_quizmaster quiz=$new_quiz]",
|
383 |
add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
|
384 |
|
385 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your new quiz has been created successfully. To begin editing your quiz, click the Edit link on the new quiz.', 'quiz-master-next'), 'success');
|
386 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "New Quiz Has Been Created: $quiz_name" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
do_action('qmn_quiz_created', $new_quiz);
|
388 |
}
|
389 |
else
|
443 |
}
|
444 |
wp_reset_postdata();
|
445 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been deleted successfully.', 'quiz-master-next'), 'success');
|
446 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Quiz Has Been Deleted: $quiz_name" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
}
|
448 |
else
|
449 |
{
|
475 |
),
|
476 |
array( '%d' )
|
477 |
);
|
478 |
+
if ( false != $results ) {
|
|
|
479 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz name has been updated successfully.', 'quiz-master-next'), 'success');
|
480 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Quiz Name Has Been Edited: $quiz_name" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
}
|
482 |
else
|
483 |
{
|
613 |
)
|
614 |
);
|
615 |
$mlw_new_id = $wpdb->insert_id;
|
616 |
+
if ( false != $results ) {
|
617 |
+
$current_user = wp_get_current_user();
|
|
|
|
|
618 |
$quiz_post = array(
|
619 |
'post_title' => $quiz_name,
|
620 |
'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
|
625 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
626 |
add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
|
627 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been duplicated successfully.', 'quiz-master-next'), 'success');
|
628 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "New Quiz Has Been Created: $quiz_name" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
|
630 |
}
|
631 |
else
|
php/class-qmn-quiz-manager.php
CHANGED
@@ -52,7 +52,8 @@ class QMNQuizManager
|
|
52 |
public function display_shortcode($atts)
|
53 |
{
|
54 |
extract(shortcode_atts(array(
|
55 |
-
'quiz' => 0
|
|
|
56 |
), $atts));
|
57 |
|
58 |
global $wpdb;
|
@@ -62,6 +63,7 @@ class QMNQuizManager
|
|
62 |
$qmn_json_data = array();
|
63 |
$qmn_allowed_visit = true;
|
64 |
$mlwQuizMasterNext->quizCreator->set_id($quiz);
|
|
|
65 |
|
66 |
//Legacy variable
|
67 |
global $mlw_qmn_quiz;
|
@@ -109,6 +111,12 @@ class QMNQuizManager
|
|
109 |
'quiz_system' => $qmn_quiz_options->system
|
110 |
);
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
echo "<script>
|
113 |
if (window.qmn_quiz_data === undefined) {
|
114 |
window.qmn_quiz_data = new Object();
|
@@ -125,7 +133,7 @@ class QMNQuizManager
|
|
125 |
//Check if we should be showing quiz or results page
|
126 |
if ($qmn_allowed_visit && !isset($_POST["complete_quiz"]) && $qmn_quiz_options->quiz_name != '')
|
127 |
{
|
128 |
-
$qmn_quiz_questions = $this->load_questions($quiz, $qmn_quiz_options, true);
|
129 |
$qmn_quiz_answers = $this->create_answer_array($qmn_quiz_questions);
|
130 |
$return_display .= $this->display_quiz($qmn_quiz_options, $qmn_quiz_questions, $qmn_quiz_answers, $qmn_array_for_variables);
|
131 |
}
|
@@ -173,22 +181,33 @@ class QMNQuizManager
|
|
173 |
* @since 4.0.0
|
174 |
* @param int $quiz_id The id for the quiz
|
175 |
* @param array $quiz_options The database row for the quiz
|
|
|
|
|
176 |
* @return array The questions for the quiz
|
177 |
*/
|
178 |
-
public function load_questions($quiz_id, $quiz_options, $is_quiz_page)
|
179 |
-
|
|
|
180 |
global $wpdb;
|
181 |
$order_by_sql = "ORDER BY question_order ASC";
|
182 |
$limit_sql = '';
|
183 |
-
|
184 |
-
|
|
|
185 |
$order_by_sql = "ORDER BY rand()";
|
186 |
}
|
187 |
-
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
-
|
|
|
|
|
192 |
}
|
193 |
|
194 |
/**
|
@@ -534,6 +553,13 @@ class QMNQuizManager
|
|
534 |
{
|
535 |
global $qmn_allowed_visit;
|
536 |
$result_display = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
$result_display = apply_filters('qmn_begin_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
|
538 |
if (!$qmn_allowed_visit)
|
539 |
{
|
@@ -596,6 +622,7 @@ class QMNQuizManager
|
|
596 |
'email' => $qmn_array_for_variables['user_email'],
|
597 |
'phone' => $qmn_array_for_variables['user_phone'],
|
598 |
'user' => $qmn_array_for_variables['user_id'],
|
|
|
599 |
'time_taken' => $qmn_array_for_variables['time_taken'],
|
600 |
'time_taken_real' => date( "Y-m-d H:i:s", strtotime( $qmn_array_for_variables['time_taken'] ) ),
|
601 |
'quiz_results' => $mlw_quiz_results,
|
@@ -617,6 +644,7 @@ class QMNQuizManager
|
|
617 |
'%s',
|
618 |
'%s',
|
619 |
'%s',
|
|
|
620 |
'%d'
|
621 |
)
|
622 |
);
|
@@ -1204,19 +1232,40 @@ function qmn_scheduled_timeframe_check($display, $qmn_quiz_options, $qmn_array_f
|
|
1204 |
}
|
1205 |
|
1206 |
add_filter('qmn_begin_shortcode', 'qmn_total_user_tries_check', 10, 3);
|
1207 |
-
|
1208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1209 |
global $qmn_allowed_visit;
|
1210 |
-
if ( $qmn_quiz_options->total_user_tries != 0
|
1211 |
-
|
|
|
1212 |
global $wpdb;
|
1213 |
-
$
|
1214 |
-
|
1215 |
-
if
|
1216 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1217 |
$qmn_allowed_visit = false;
|
1218 |
-
$mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->total_user_tries_text, ENT_QUOTES));
|
1219 |
-
$mlw_message = apply_filters( 'mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
|
1220 |
$display .= $mlw_message;
|
1221 |
}
|
1222 |
}
|
52 |
public function display_shortcode($atts)
|
53 |
{
|
54 |
extract(shortcode_atts(array(
|
55 |
+
'quiz' => 0,
|
56 |
+
'question_amount' => 0
|
57 |
), $atts));
|
58 |
|
59 |
global $wpdb;
|
63 |
$qmn_json_data = array();
|
64 |
$qmn_allowed_visit = true;
|
65 |
$mlwQuizMasterNext->quizCreator->set_id($quiz);
|
66 |
+
$question_amount = intval( $question_amount );
|
67 |
|
68 |
//Legacy variable
|
69 |
global $mlw_qmn_quiz;
|
111 |
'quiz_system' => $qmn_quiz_options->system
|
112 |
);
|
113 |
|
114 |
+
if ( $_SERVER["REMOTE_ADDR"] ) {
|
115 |
+
$qmn_array_for_variables['user_ip'] = $_SERVER["REMOTE_ADDR"];
|
116 |
+
} else {
|
117 |
+
$qmn_array_for_variables['user_ip'] = "Unknown";
|
118 |
+
}
|
119 |
+
|
120 |
echo "<script>
|
121 |
if (window.qmn_quiz_data === undefined) {
|
122 |
window.qmn_quiz_data = new Object();
|
133 |
//Check if we should be showing quiz or results page
|
134 |
if ($qmn_allowed_visit && !isset($_POST["complete_quiz"]) && $qmn_quiz_options->quiz_name != '')
|
135 |
{
|
136 |
+
$qmn_quiz_questions = $this->load_questions( $quiz, $qmn_quiz_options, true, $question_amount );
|
137 |
$qmn_quiz_answers = $this->create_answer_array($qmn_quiz_questions);
|
138 |
$return_display .= $this->display_quiz($qmn_quiz_options, $qmn_quiz_questions, $qmn_quiz_answers, $qmn_array_for_variables);
|
139 |
}
|
181 |
* @since 4.0.0
|
182 |
* @param int $quiz_id The id for the quiz
|
183 |
* @param array $quiz_options The database row for the quiz
|
184 |
+
* @param bool $is_quiz_page If the page being loaded is the quiz page or not
|
185 |
+
* @param int $question_amount The amount of questions entered using the shortcode attribute
|
186 |
* @return array The questions for the quiz
|
187 |
*/
|
188 |
+
public function load_questions( $quiz_id, $quiz_options, $is_quiz_page, $question_amount ) {
|
189 |
+
|
190 |
+
// Prepare variables
|
191 |
global $wpdb;
|
192 |
$order_by_sql = "ORDER BY question_order ASC";
|
193 |
$limit_sql = '';
|
194 |
+
|
195 |
+
// Checks if the questions should be randomized
|
196 |
+
if ( $quiz_options->randomness_order == 1 || $quiz_options->randomness_order == 2 ) {
|
197 |
$order_by_sql = "ORDER BY rand()";
|
198 |
}
|
199 |
+
|
200 |
+
// Check if we should load all questions or only a selcted amount
|
201 |
+
if ($is_quiz_page && ( $quiz_options->question_from_total != 0 || $question_amount !== 0 ) ) {
|
202 |
+
if ( $question_amount !== 0 ) {
|
203 |
+
$limit_sql = " LIMIT $question_amount";
|
204 |
+
} else {
|
205 |
+
$limit_sql = " LIMIT " . intval( $quiz_options->question_from_total );
|
206 |
+
}
|
207 |
}
|
208 |
+
|
209 |
+
// Returns an array of all the loaded questions
|
210 |
+
return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_questions WHERE quiz_id=%d AND deleted=0 " . $order_by_sql . $limit_sql, $quiz_id ) );
|
211 |
}
|
212 |
|
213 |
/**
|
553 |
{
|
554 |
global $qmn_allowed_visit;
|
555 |
$result_display = '';
|
556 |
+
|
557 |
+
if ( $_SERVER["REMOTE_ADDR"] ) {
|
558 |
+
$qmn_array_for_variables['user_ip'] = $_SERVER["REMOTE_ADDR"];
|
559 |
+
} else {
|
560 |
+
$qmn_array_for_variables['user_ip'] = "Unknown";
|
561 |
+
}
|
562 |
+
|
563 |
$result_display = apply_filters('qmn_begin_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
|
564 |
if (!$qmn_allowed_visit)
|
565 |
{
|
622 |
'email' => $qmn_array_for_variables['user_email'],
|
623 |
'phone' => $qmn_array_for_variables['user_phone'],
|
624 |
'user' => $qmn_array_for_variables['user_id'],
|
625 |
+
'user_ip' => $qmn_array_for_variables['user_ip'],
|
626 |
'time_taken' => $qmn_array_for_variables['time_taken'],
|
627 |
'time_taken_real' => date( "Y-m-d H:i:s", strtotime( $qmn_array_for_variables['time_taken'] ) ),
|
628 |
'quiz_results' => $mlw_quiz_results,
|
644 |
'%s',
|
645 |
'%s',
|
646 |
'%s',
|
647 |
+
'%s',
|
648 |
'%d'
|
649 |
)
|
650 |
);
|
1232 |
}
|
1233 |
|
1234 |
add_filter('qmn_begin_shortcode', 'qmn_total_user_tries_check', 10, 3);
|
1235 |
+
|
1236 |
+
/**
|
1237 |
+
* Checks if user has already reach the user limit of the quiz
|
1238 |
+
*
|
1239 |
+
* @since 4.8.0
|
1240 |
+
* @param string $display The HTML displayed for the quiz
|
1241 |
+
* @param array $qmn_quiz_options The settings for the quiz
|
1242 |
+
* @param array $qmn_array_for_variables The array of data by the quiz
|
1243 |
+
* @return string The altered HTML display for the quiz
|
1244 |
+
*/
|
1245 |
+
function qmn_total_user_tries_check( $display, $qmn_quiz_options, $qmn_array_for_variables ) {
|
1246 |
+
|
1247 |
global $qmn_allowed_visit;
|
1248 |
+
if ( $qmn_quiz_options->total_user_tries != 0 ) {
|
1249 |
+
|
1250 |
+
// Prepares the variables
|
1251 |
global $wpdb;
|
1252 |
+
$mlw_qmn_user_try_count = 0;
|
1253 |
+
|
1254 |
+
// Checks if the user is logged in. If so, check by user id. If not, check by IP.
|
1255 |
+
if ( is_user_logged_in() ) {
|
1256 |
+
$current_user = wp_get_current_user();
|
1257 |
+
$mlw_qmn_user_try_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_results WHERE user=%d AND deleted='0' AND quiz_id=%d", $current_user->ID, $qmn_array_for_variables['quiz_id'] ) );
|
1258 |
+
} else {
|
1259 |
+
$mlw_qmn_user_try_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_results WHERE user_ip='%s' AND deleted='0' AND quiz_id=%d", $qmn_array_for_variables['user_ip'], $qmn_array_for_variables['quiz_id'] ) );
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
// If user has already reached the limit for this quiz
|
1263 |
+
if ( $mlw_qmn_user_try_count >= $qmn_quiz_options->total_user_tries ) {
|
1264 |
+
|
1265 |
+
// Stops the quiz and prepares entered text
|
1266 |
$qmn_allowed_visit = false;
|
1267 |
+
$mlw_message = wpautop( htmlspecialchars_decode( $qmn_quiz_options->total_user_tries_text, ENT_QUOTES ) );
|
1268 |
+
$mlw_message = apply_filters( 'mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables );
|
1269 |
$display .= $mlw_message;
|
1270 |
}
|
1271 |
}
|
php/class-qmn-review-message.php
CHANGED
@@ -22,9 +22,18 @@ class QMN_Review_Message {
|
|
22 |
* @since 4.5.0
|
23 |
*/
|
24 |
function __construct() {
|
25 |
-
$this->
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/**
|
29 |
* Checks if message should be displayed
|
30 |
*
|
22 |
* @since 4.5.0
|
23 |
*/
|
24 |
function __construct() {
|
25 |
+
$this->add_hooks();
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* Adds check message to admin_init hook
|
30 |
+
*
|
31 |
+
* @since 4.8.0
|
32 |
+
*/
|
33 |
+
public function add_hooks() {
|
34 |
+
add_action( 'admin_init', array( $this, 'check_message_display' ) );
|
35 |
+
}
|
36 |
+
|
37 |
/**
|
38 |
* Checks if message should be displayed
|
39 |
*
|
php/class-qmn-tracking.php
CHANGED
@@ -164,7 +164,7 @@ class QMNTracking
|
|
164 |
$data['current_version'] = get_option('mlw_quiz_master_version');
|
165 |
|
166 |
$data['quiz_options'] = $wpdb->get_results( "SELECT quiz_name, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp,
|
167 |
-
user_email, user_phone, comment_section, question_from_total, total_user_tries, pagination, timer_limit, question_numbering, last_activity, require_log_in, limit_total_entries, disable_answer_onselect, ajax_show_correct, quiz_views, quiz_taken FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0" );
|
168 |
|
169 |
|
170 |
$this->data = $data;
|
164 |
$data['current_version'] = get_option('mlw_quiz_master_version');
|
165 |
|
166 |
$data['quiz_options'] = $wpdb->get_results( "SELECT quiz_name, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp,
|
167 |
+
user_email, user_phone, comment_section, question_from_total, total_user_tries, certificate_template, pagination, timer_limit, question_numbering, theme_selected, last_activity, require_log_in, limit_total_entries, disable_answer_onselect, ajax_show_correct, quiz_views, quiz_taken FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0" );
|
168 |
|
169 |
|
170 |
$this->data = $data;
|
php/class-qsm-audit.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This class handles the audit trail of the plugin
|
7 |
+
*/
|
8 |
+
class QSM_Audit {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Adds new audit to Audit Trail table
|
12 |
+
*
|
13 |
+
* @since 4.7.1
|
14 |
+
* @param string $action The action that is to be saved into the audit trail
|
15 |
+
* @return bool Returns true if successfull and false if fails
|
16 |
+
*/
|
17 |
+
public function new_audit( $action, $user = null ) {
|
18 |
+
|
19 |
+
// Sanitizes action just in case 3rd party uses this funtion
|
20 |
+
$action = sanitize_text_field( $action );
|
21 |
+
|
22 |
+
// Retrieves current user's data
|
23 |
+
if ( is_null( $user ) ) {
|
24 |
+
$current_user = wp_get_current_user();
|
25 |
+
} else {
|
26 |
+
$current_user = $user;
|
27 |
+
}
|
28 |
+
|
29 |
+
// Returns if the current user is not valid
|
30 |
+
if ( ! ( $current_user instanceof WP_User ) ) {
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
|
34 |
+
global $wpdb;
|
35 |
+
|
36 |
+
// Inserts new audit into table
|
37 |
+
$inserted = $wpdb->insert(
|
38 |
+
$wpdb->prefix . "mlw_qm_audit_trail",
|
39 |
+
array(
|
40 |
+
'action_user' => $current_user->display_name,
|
41 |
+
'action' => $action,
|
42 |
+
'time' => date("h:i:s A m/d/Y")
|
43 |
+
),
|
44 |
+
array(
|
45 |
+
'%s',
|
46 |
+
'%s',
|
47 |
+
'%s'
|
48 |
+
)
|
49 |
+
);
|
50 |
+
|
51 |
+
// If the insert returns false, then return false
|
52 |
+
if ( false === $inserted ) {
|
53 |
+
return false;
|
54 |
+
}
|
55 |
+
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
?>
|
php/class-qsm-install.php
ADDED
@@ -0,0 +1,657 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class that handles installation, updates, and plugin row meta
|
7 |
+
*
|
8 |
+
* @since 4.7.1
|
9 |
+
*/
|
10 |
+
class QSM_Install {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Main Constructor
|
14 |
+
*
|
15 |
+
* @uses QSM_Install::add_hooks
|
16 |
+
* @since 4.7.1
|
17 |
+
*/
|
18 |
+
function __construct() {
|
19 |
+
$this->add_hooks();
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Adds the various class functions to hooks and filters
|
24 |
+
*
|
25 |
+
* @since 4.7.1
|
26 |
+
*/
|
27 |
+
public function add_hooks() {
|
28 |
+
add_action( 'admin_init', array( $this, 'update' ) );
|
29 |
+
add_filter( 'plugin_action_links_' . QSM_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
|
30 |
+
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Installs the plugin and its database tables
|
35 |
+
*
|
36 |
+
* @since 4.7.1
|
37 |
+
*/
|
38 |
+
public static function install() {
|
39 |
+
|
40 |
+
global $wpdb;
|
41 |
+
$charset_collate = $wpdb->get_charset_collate();
|
42 |
+
|
43 |
+
$quiz_table_name = $wpdb->prefix . "mlw_quizzes";
|
44 |
+
$question_table_name = $wpdb->prefix . "mlw_questions";
|
45 |
+
$results_table_name = $wpdb->prefix . "mlw_results";
|
46 |
+
$audit_table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
47 |
+
|
48 |
+
if( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_table_name'" ) != $quiz_table_name ) {
|
49 |
+
$sql = "CREATE TABLE $quiz_table_name (
|
50 |
+
quiz_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
51 |
+
quiz_name TEXT NOT NULL,
|
52 |
+
message_before TEXT NOT NULL,
|
53 |
+
message_after TEXT NOT NULL,
|
54 |
+
message_comment TEXT NOT NULL,
|
55 |
+
message_end_template TEXT NOT NULL,
|
56 |
+
user_email_template TEXT NOT NULL,
|
57 |
+
admin_email_template TEXT NOT NULL,
|
58 |
+
submit_button_text TEXT NOT NULL,
|
59 |
+
name_field_text TEXT NOT NULL,
|
60 |
+
business_field_text TEXT NOT NULL,
|
61 |
+
email_field_text TEXT NOT NULL,
|
62 |
+
phone_field_text TEXT NOT NULL,
|
63 |
+
comment_field_text TEXT NOT NULL,
|
64 |
+
email_from_text TEXT NOT NULL,
|
65 |
+
question_answer_template TEXT NOT NULL,
|
66 |
+
leaderboard_template TEXT NOT NULL,
|
67 |
+
system INT NOT NULL,
|
68 |
+
randomness_order INT NOT NULL,
|
69 |
+
loggedin_user_contact INT NOT NULL,
|
70 |
+
show_score INT NOT NULL,
|
71 |
+
send_user_email INT NOT NULL,
|
72 |
+
send_admin_email INT NOT NULL,
|
73 |
+
contact_info_location INT NOT NULL,
|
74 |
+
user_name INT NOT NULL,
|
75 |
+
user_comp INT NOT NULL,
|
76 |
+
user_email INT NOT NULL,
|
77 |
+
user_phone INT NOT NULL,
|
78 |
+
admin_email TEXT NOT NULL,
|
79 |
+
comment_section INT NOT NULL,
|
80 |
+
question_from_total INT NOT NULL,
|
81 |
+
total_user_tries INT NOT NULL,
|
82 |
+
total_user_tries_text TEXT NOT NULL,
|
83 |
+
certificate_template TEXT NOT NULL,
|
84 |
+
social_media INT NOT NULL,
|
85 |
+
social_media_text TEXT NOT NULL,
|
86 |
+
pagination INT NOT NULL,
|
87 |
+
pagination_text TEXT NOT NULL,
|
88 |
+
timer_limit INT NOT NULL,
|
89 |
+
quiz_stye TEXT NOT NULL,
|
90 |
+
question_numbering INT NOT NULL,
|
91 |
+
quiz_settings TEXT NOT NULL,
|
92 |
+
theme_selected TEXT NOT NULL,
|
93 |
+
last_activity DATETIME NOT NULL,
|
94 |
+
require_log_in INT NOT NULL,
|
95 |
+
require_log_in_text TEXT NOT NULL,
|
96 |
+
limit_total_entries INT NOT NULL,
|
97 |
+
limit_total_entries_text TEXT NOT NULL,
|
98 |
+
scheduled_timeframe TEXT NOT NULL,
|
99 |
+
scheduled_timeframe_text TEXT NOT NULL,
|
100 |
+
disable_answer_onselect INT NOT NULL,
|
101 |
+
ajax_show_correct INT NOT NULL,
|
102 |
+
quiz_views INT NOT NULL,
|
103 |
+
quiz_taken INT NOT NULL,
|
104 |
+
deleted INT NOT NULL,
|
105 |
+
PRIMARY KEY (quiz_id)
|
106 |
+
) $charset_collate;";
|
107 |
+
|
108 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
109 |
+
dbDelta( $sql );
|
110 |
+
}
|
111 |
+
|
112 |
+
if( $wpdb->get_var( "SHOW TABLES LIKE '$question_table_name'" ) != $question_table_name ) {
|
113 |
+
$sql = "CREATE TABLE $question_table_name (
|
114 |
+
question_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
115 |
+
quiz_id INT NOT NULL,
|
116 |
+
question_name TEXT NOT NULL,
|
117 |
+
answer_array TEXT NOT NULL,
|
118 |
+
answer_one TEXT NOT NULL,
|
119 |
+
answer_one_points INT NOT NULL,
|
120 |
+
answer_two TEXT NOT NULL,
|
121 |
+
answer_two_points INT NOT NULL,
|
122 |
+
answer_three TEXT NOT NULL,
|
123 |
+
answer_three_points INT NOT NULL,
|
124 |
+
answer_four TEXT NOT NULL,
|
125 |
+
answer_four_points INT NOT NULL,
|
126 |
+
answer_five TEXT NOT NULL,
|
127 |
+
answer_five_points INT NOT NULL,
|
128 |
+
answer_six TEXT NOT NULL,
|
129 |
+
answer_six_points INT NOT NULL,
|
130 |
+
correct_answer INT NOT NULL,
|
131 |
+
question_answer_info TEXT NOT NULL,
|
132 |
+
comments INT NOT NULL,
|
133 |
+
hints TEXT NOT NULL,
|
134 |
+
question_order INT NOT NULL,
|
135 |
+
question_type INT NOT NULL,
|
136 |
+
question_type_new TEXT NOT NULL,
|
137 |
+
question_settings TEXT NOT NULL,
|
138 |
+
category TEXT NOT NULL,
|
139 |
+
deleted INT NOT NULL,
|
140 |
+
PRIMARY KEY (question_id)
|
141 |
+
) $charset_collate;";
|
142 |
+
|
143 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
144 |
+
dbDelta( $sql );
|
145 |
+
}
|
146 |
+
|
147 |
+
if( $wpdb->get_var( "SHOW TABLES LIKE '$results_table_name'" ) != $results_table_name ) {
|
148 |
+
$sql = "CREATE TABLE $results_table_name (
|
149 |
+
result_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
150 |
+
quiz_id INT NOT NULL,
|
151 |
+
quiz_name TEXT NOT NULL,
|
152 |
+
quiz_system INT NOT NULL,
|
153 |
+
point_score INT NOT NULL,
|
154 |
+
correct_score INT NOT NULL,
|
155 |
+
correct INT NOT NULL,
|
156 |
+
total INT NOT NULL,
|
157 |
+
name TEXT NOT NULL,
|
158 |
+
business TEXT NOT NULL,
|
159 |
+
email TEXT NOT NULL,
|
160 |
+
phone TEXT NOT NULL,
|
161 |
+
user INT NOT NULL,
|
162 |
+
user_ip TEXT NOT NULL,
|
163 |
+
time_taken TEXT NOT NULL,
|
164 |
+
time_taken_real DATETIME NOT NULL,
|
165 |
+
quiz_results TEXT NOT NULL,
|
166 |
+
deleted INT NOT NULL,
|
167 |
+
PRIMARY KEY (result_id)
|
168 |
+
) $charset_collate;";
|
169 |
+
|
170 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
171 |
+
dbDelta( $sql );
|
172 |
+
}
|
173 |
+
|
174 |
+
if( $wpdb->get_var( "SHOW TABLES LIKE '$audit_table_name'" ) != $audit_table_name ) {
|
175 |
+
$sql = "CREATE TABLE $audit_table_name (
|
176 |
+
trail_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
177 |
+
action_user TEXT NOT NULL,
|
178 |
+
action TEXT NOT NULL,
|
179 |
+
time TEXT NOT NULL,
|
180 |
+
PRIMARY KEY (trail_id)
|
181 |
+
) $charset_collate;";
|
182 |
+
|
183 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
184 |
+
dbDelta( $sql );
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Updates the plugin
|
190 |
+
*
|
191 |
+
* @since 4.7.1
|
192 |
+
*/
|
193 |
+
public function update() {
|
194 |
+
global $mlwQuizMasterNext;
|
195 |
+
$data = $mlwQuizMasterNext->version;
|
196 |
+
if ( ! get_option('qmn_original_version'))
|
197 |
+
{
|
198 |
+
add_option('qmn_original_version' , $data);
|
199 |
+
}
|
200 |
+
if ( ! get_option('mlw_quiz_master_version'))
|
201 |
+
{
|
202 |
+
add_option('mlw_quiz_master_version' , $data);
|
203 |
+
}
|
204 |
+
elseif (get_option('mlw_quiz_master_version') != $data)
|
205 |
+
{
|
206 |
+
global $wpdb;
|
207 |
+
$table_name = $wpdb->prefix . "mlw_quizzes";
|
208 |
+
//Update 0.5
|
209 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'comment_section'") != "comment_section")
|
210 |
+
{
|
211 |
+
$sql = "ALTER TABLE ".$table_name." ADD comment_field_text TEXT NOT NULL AFTER phone_field_text";
|
212 |
+
$results = $wpdb->query( $sql );
|
213 |
+
$sql = "ALTER TABLE ".$table_name." ADD comment_section INT NOT NULL AFTER admin_email";
|
214 |
+
$results = $wpdb->query( $sql );
|
215 |
+
$sql = "ALTER TABLE ".$table_name." ADD message_comment TEXT NOT NULL AFTER message_after";
|
216 |
+
$results = $wpdb->query( $sql );
|
217 |
+
$update_sql = "UPDATE ".$table_name." SET comment_field_text='Comments', comment_section=1, message_comment='Enter You Text Here'";
|
218 |
+
$results = $wpdb->query( $update_sql );
|
219 |
+
}
|
220 |
+
|
221 |
+
//Update 0.9.2
|
222 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'leaderboard_template'") != "leaderboard_template")
|
223 |
+
{
|
224 |
+
$sql = "ALTER TABLE ".$table_name." ADD leaderboard_template TEXT NOT NULL AFTER comment_field_text";
|
225 |
+
$results = $wpdb->query( $sql );
|
226 |
+
$mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
|
227 |
+
1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
|
228 |
+
2. %SECOND_PLACE_NAME%-%SECOND_PLACE_SCORE%<br />
|
229 |
+
3. %THIRD_PLACE_NAME%-%THIRD_PLACE_SCORE%<br />
|
230 |
+
4. %FOURTH_PLACE_NAME%-%FOURTH_PLACE_SCORE%<br />
|
231 |
+
5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
|
232 |
+
$update_sql = "UPDATE ".$table_name." SET leaderboard_template='".$mlw_leaderboard_default."'";
|
233 |
+
$results = $wpdb->query( $update_sql );
|
234 |
+
}
|
235 |
+
|
236 |
+
//Update 0.9.4
|
237 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'randomness_order'") != "randomness_order")
|
238 |
+
{
|
239 |
+
$sql = "ALTER TABLE ".$table_name." ADD randomness_order INT NOT NULL AFTER system";
|
240 |
+
$results = $wpdb->query( $sql );
|
241 |
+
$update_sql = "UPDATE ".$table_name." SET randomness_order=0";
|
242 |
+
$results = $wpdb->query( $update_sql );
|
243 |
+
}
|
244 |
+
|
245 |
+
//Update 0.9.5
|
246 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_answer_template'") != "question_answer_template")
|
247 |
+
{
|
248 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_answer_template TEXT NOT NULL AFTER comment_field_text";
|
249 |
+
$results = $wpdb->query( $sql );
|
250 |
+
$mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
|
251 |
+
$update_sql = "UPDATE ".$table_name." SET question_answer_template='".$mlw_question_answer_default."'";
|
252 |
+
$results = $wpdb->query( $update_sql );
|
253 |
+
}
|
254 |
+
|
255 |
+
//Update 0.9.6
|
256 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'contact_info_location'") != "contact_info_location")
|
257 |
+
{
|
258 |
+
$sql = "ALTER TABLE ".$table_name." ADD contact_info_location INT NOT NULL AFTER send_admin_email";
|
259 |
+
$results = $wpdb->query( $sql );
|
260 |
+
$update_sql = "UPDATE ".$table_name." SET contact_info_location=0";
|
261 |
+
$results = $wpdb->query( $update_sql );
|
262 |
+
}
|
263 |
+
|
264 |
+
//Update 1.0
|
265 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'email_from_text'") != "email_from_text")
|
266 |
+
{
|
267 |
+
$sql = "ALTER TABLE ".$table_name." ADD email_from_text TEXT NOT NULL AFTER comment_field_text";
|
268 |
+
$results = $wpdb->query( $sql );
|
269 |
+
$update_sql = "UPDATE ".$table_name." SET email_from_text='Wordpress'";
|
270 |
+
$results = $wpdb->query( $update_sql );
|
271 |
+
}
|
272 |
+
|
273 |
+
//Update 1.3.1
|
274 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'loggedin_user_contact'") != "loggedin_user_contact")
|
275 |
+
{
|
276 |
+
$sql = "ALTER TABLE ".$table_name." ADD loggedin_user_contact INT NOT NULL AFTER randomness_order";
|
277 |
+
$results = $wpdb->query( $sql );
|
278 |
+
$update_sql = "UPDATE ".$table_name." SET loggedin_user_contact=0";
|
279 |
+
$results = $wpdb->query( $update_sql );
|
280 |
+
}
|
281 |
+
|
282 |
+
//Update 1.5.1
|
283 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_from_total'") != "question_from_total")
|
284 |
+
{
|
285 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_from_total INT NOT NULL AFTER comment_section";
|
286 |
+
$results = $wpdb->query( $sql );
|
287 |
+
$update_sql = "UPDATE ".$table_name." SET question_from_total=0";
|
288 |
+
$results = $wpdb->query( $update_sql );
|
289 |
+
}
|
290 |
+
|
291 |
+
//Update 1.6.1
|
292 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries'") != "total_user_tries")
|
293 |
+
{
|
294 |
+
$sql = "ALTER TABLE ".$table_name." ADD total_user_tries INT NOT NULL AFTER question_from_total";
|
295 |
+
$results = $wpdb->query( $sql );
|
296 |
+
$update_sql = "UPDATE ".$table_name." SET total_user_tries=0";
|
297 |
+
$results = $wpdb->query( $update_sql );
|
298 |
+
}
|
299 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries_text'") != "total_user_tries_text")
|
300 |
+
{
|
301 |
+
$sql = "ALTER TABLE ".$table_name." ADD total_user_tries_text TEXT NOT NULL AFTER total_user_tries";
|
302 |
+
$results = $wpdb->query( $sql );
|
303 |
+
$update_sql = "UPDATE ".$table_name." SET total_user_tries_text='Enter Your Text Here'";
|
304 |
+
$results = $wpdb->query( $update_sql );
|
305 |
+
}
|
306 |
+
|
307 |
+
//Update 1.8.1
|
308 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'message_end_template'") != "message_end_template")
|
309 |
+
{
|
310 |
+
$sql = "ALTER TABLE ".$table_name." ADD message_end_template TEXT NOT NULL AFTER message_comment";
|
311 |
+
$results = $wpdb->query( $sql );
|
312 |
+
$update_sql = "UPDATE ".$table_name." SET message_end_template=''";
|
313 |
+
$results = $wpdb->query( $update_sql );
|
314 |
+
}
|
315 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'certificate_template'") != "certificate_template")
|
316 |
+
{
|
317 |
+
$sql = "ALTER TABLE ".$table_name." ADD certificate_template TEXT NOT NULL AFTER total_user_tries_text";
|
318 |
+
$results = $wpdb->query( $sql );
|
319 |
+
$update_sql = "UPDATE ".$table_name." SET certificate_template='Enter your text here!'";
|
320 |
+
$results = $wpdb->query( $update_sql );
|
321 |
+
}
|
322 |
+
|
323 |
+
//Update 1.9.1
|
324 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'social_media'") != "social_media")
|
325 |
+
{
|
326 |
+
$sql = "ALTER TABLE ".$table_name." ADD social_media INT NOT NULL AFTER certificate_template";
|
327 |
+
$results = $wpdb->query( $sql );
|
328 |
+
$update_sql = "UPDATE ".$table_name." SET social_media='0'";
|
329 |
+
$results = $wpdb->query( $update_sql );
|
330 |
+
}
|
331 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'social_media_text'") != "social_media_text")
|
332 |
+
{
|
333 |
+
$sql = "ALTER TABLE ".$table_name." ADD social_media_text TEXT NOT NULL AFTER social_media";
|
334 |
+
$results = $wpdb->query( $sql );
|
335 |
+
$update_sql = "UPDATE ".$table_name." SET social_media_text='I just score a %CORRECT_SCORE%% on %QUIZ_NAME%!'";
|
336 |
+
$results = $wpdb->query( $update_sql );
|
337 |
+
}
|
338 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'pagination'") != "pagination")
|
339 |
+
{
|
340 |
+
$sql = "ALTER TABLE ".$table_name." ADD pagination INT NOT NULL AFTER social_media_text";
|
341 |
+
$results = $wpdb->query( $sql );
|
342 |
+
$update_sql = "UPDATE ".$table_name." SET pagination=0";
|
343 |
+
$results = $wpdb->query( $update_sql );
|
344 |
+
}
|
345 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'pagination_text'") != "pagination_text")
|
346 |
+
{
|
347 |
+
$sql = "ALTER TABLE ".$table_name." ADD pagination_text TEXT NOT NULL AFTER pagination";
|
348 |
+
$results = $wpdb->query( $sql );
|
349 |
+
$update_sql = "UPDATE ".$table_name." SET pagination_text='Next'";
|
350 |
+
$results = $wpdb->query( $update_sql );
|
351 |
+
}
|
352 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'timer_limit'") != "timer_limit")
|
353 |
+
{
|
354 |
+
$sql = "ALTER TABLE ".$table_name." ADD timer_limit INT NOT NULL AFTER pagination_text";
|
355 |
+
$results = $wpdb->query( $sql );
|
356 |
+
$update_sql = "UPDATE ".$table_name." SET timer_limit=0";
|
357 |
+
$results = $wpdb->query( $update_sql );
|
358 |
+
}
|
359 |
+
|
360 |
+
//Update 2.1.1
|
361 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'quiz_stye'") != "quiz_stye")
|
362 |
+
{
|
363 |
+
$sql = "ALTER TABLE ".$table_name." ADD quiz_stye TEXT NOT NULL AFTER timer_limit";
|
364 |
+
$results = $wpdb->query( $sql );
|
365 |
+
$mlw_style_default = "
|
366 |
+
div.mlw_qmn_quiz input[type=radio],
|
367 |
+
div.mlw_qmn_quiz input[type=submit],
|
368 |
+
div.mlw_qmn_quiz label {
|
369 |
+
cursor: pointer;
|
370 |
+
}
|
371 |
+
div.mlw_qmn_quiz input:not([type=submit]):focus,
|
372 |
+
div.mlw_qmn_quiz textarea:focus {
|
373 |
+
background: #eaeaea;
|
374 |
+
}
|
375 |
+
div.mlw_qmn_quiz {
|
376 |
+
text-align: left;
|
377 |
+
}
|
378 |
+
div.quiz_section {
|
379 |
+
|
380 |
+
}
|
381 |
+
div.mlw_qmn_timer {
|
382 |
+
position:fixed;
|
383 |
+
top:200px;
|
384 |
+
right:0px;
|
385 |
+
width:130px;
|
386 |
+
color:#00CCFF;
|
387 |
+
border-radius: 15px;
|
388 |
+
background:#000000;
|
389 |
+
text-align: center;
|
390 |
+
padding: 15px 15px 15px 15px
|
391 |
+
}
|
392 |
+
div.mlw_qmn_quiz input[type=submit],
|
393 |
+
a.mlw_qmn_quiz_link
|
394 |
+
{
|
395 |
+
border-radius: 4px;
|
396 |
+
position: relative;
|
397 |
+
background-image: linear-gradient(#fff,#dedede);
|
398 |
+
background-color: #eee;
|
399 |
+
border: #ccc solid 1px;
|
400 |
+
color: #333;
|
401 |
+
text-shadow: 0 1px 0 rgba(255,255,255,.5);
|
402 |
+
box-sizing: border-box;
|
403 |
+
display: inline-block;
|
404 |
+
padding: 5px 5px 5px 5px;
|
405 |
+
margin: auto;
|
406 |
+
}";
|
407 |
+
$update_sql = "UPDATE ".$table_name." SET quiz_stye='".$mlw_style_default."'";
|
408 |
+
$results = $wpdb->query( $update_sql );
|
409 |
+
}
|
410 |
+
|
411 |
+
//Update 2.2.1
|
412 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_numbering'") != "question_numbering")
|
413 |
+
{
|
414 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_numbering INT NOT NULL AFTER quiz_stye";
|
415 |
+
$results = $wpdb->query( $sql );
|
416 |
+
$update_sql = "UPDATE ".$table_name." SET question_numbering='0'";
|
417 |
+
$results = $wpdb->query( $update_sql );
|
418 |
+
}
|
419 |
+
|
420 |
+
//Update 2.8.1
|
421 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'quiz_settings'") != "quiz_settings")
|
422 |
+
{
|
423 |
+
$sql = "ALTER TABLE ".$table_name." ADD quiz_settings TEXT NOT NULL AFTER question_numbering";
|
424 |
+
$results = $wpdb->query( $sql );
|
425 |
+
$update_sql = "UPDATE ".$table_name." SET quiz_settings=''";
|
426 |
+
$results = $wpdb->query( $update_sql );
|
427 |
+
}
|
428 |
+
|
429 |
+
//Update 3.0.1
|
430 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'theme_selected'") != "theme_selected")
|
431 |
+
{
|
432 |
+
$sql = "ALTER TABLE ".$table_name." ADD theme_selected TEXT NOT NULL AFTER quiz_settings";
|
433 |
+
$results = $wpdb->query( $sql );
|
434 |
+
$update_sql = "UPDATE ".$table_name." SET theme_selected='default'";
|
435 |
+
$results = $wpdb->query( $update_sql );
|
436 |
+
}
|
437 |
+
|
438 |
+
//Update 3.3.1
|
439 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'last_activity'") != "last_activity")
|
440 |
+
{
|
441 |
+
$sql = "ALTER TABLE ".$table_name." ADD last_activity DATETIME NOT NULL AFTER theme_selected";
|
442 |
+
$results = $wpdb->query( $sql );
|
443 |
+
$update_sql = "UPDATE ".$table_name." SET last_activity='".date("Y-m-d H:i:s")."'";
|
444 |
+
$results = $wpdb->query( $update_sql );
|
445 |
+
}
|
446 |
+
|
447 |
+
//Update 3.5.1
|
448 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'require_log_in'") != "require_log_in")
|
449 |
+
{
|
450 |
+
$sql = "ALTER TABLE ".$table_name." ADD require_log_in INT NOT NULL AFTER last_activity";
|
451 |
+
$results = $wpdb->query( $sql );
|
452 |
+
$update_sql = "UPDATE ".$table_name." SET require_log_in='0'";
|
453 |
+
$results = $wpdb->query( $update_sql );
|
454 |
+
}
|
455 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'require_log_in_text'") != "require_log_in_text")
|
456 |
+
{
|
457 |
+
$sql = "ALTER TABLE ".$table_name." ADD require_log_in_text TEXT NOT NULL AFTER require_log_in";
|
458 |
+
$results = $wpdb->query( $sql );
|
459 |
+
$update_sql = "UPDATE ".$table_name." SET require_log_in_text='Enter Text Here'";
|
460 |
+
$results = $wpdb->query( $update_sql );
|
461 |
+
}
|
462 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries'") != "limit_total_entries")
|
463 |
+
{
|
464 |
+
$sql = "ALTER TABLE ".$table_name." ADD limit_total_entries INT NOT NULL AFTER require_log_in_text";
|
465 |
+
$results = $wpdb->query( $sql );
|
466 |
+
$update_sql = "UPDATE ".$table_name." SET limit_total_entries='0'";
|
467 |
+
$results = $wpdb->query( $update_sql );
|
468 |
+
}
|
469 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries_text'") != "limit_total_entries_text")
|
470 |
+
{
|
471 |
+
$sql = "ALTER TABLE ".$table_name." ADD limit_total_entries_text TEXT NOT NULL AFTER limit_total_entries";
|
472 |
+
$results = $wpdb->query( $sql );
|
473 |
+
$update_sql = "UPDATE ".$table_name." SET limit_total_entries_text='Enter Text Here'";
|
474 |
+
$results = $wpdb->query( $update_sql );
|
475 |
+
}
|
476 |
+
|
477 |
+
//Update 3.7.1
|
478 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe'") != "scheduled_timeframe")
|
479 |
+
{
|
480 |
+
$sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe TEXT NOT NULL AFTER limit_total_entries_text";
|
481 |
+
$results = $wpdb->query( $sql );
|
482 |
+
$update_sql = "UPDATE ".$table_name." SET scheduled_timeframe=''";
|
483 |
+
$results = $wpdb->query( $update_sql );
|
484 |
+
}
|
485 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe_text'") != "scheduled_timeframe_text")
|
486 |
+
{
|
487 |
+
$sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe_text TEXT NOT NULL AFTER scheduled_timeframe";
|
488 |
+
$results = $wpdb->query( $sql );
|
489 |
+
$update_sql = "UPDATE ".$table_name." SET scheduled_timeframe_text='Enter Text Here'";
|
490 |
+
$results = $wpdb->query( $update_sql );
|
491 |
+
}
|
492 |
+
|
493 |
+
//Update 4.3.0
|
494 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'disable_answer_onselect'") != "disable_answer_onselect")
|
495 |
+
{
|
496 |
+
$sql = "ALTER TABLE ".$table_name." ADD disable_answer_onselect INT NOT NULL AFTER scheduled_timeframe_text";
|
497 |
+
$results = $wpdb->query( $sql );
|
498 |
+
$update_sql = "UPDATE ".$table_name." SET disable_answer_onselect=0";
|
499 |
+
$results = $wpdb->query( $update_sql );
|
500 |
+
}
|
501 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'ajax_show_correct'") != "ajax_show_correct")
|
502 |
+
{
|
503 |
+
$sql = "ALTER TABLE ".$table_name." ADD ajax_show_correct INT NOT NULL AFTER disable_answer_onselect";
|
504 |
+
$results = $wpdb->query( $sql );
|
505 |
+
$update_sql = "UPDATE ".$table_name." SET ajax_show_correct=0";
|
506 |
+
$results = $wpdb->query( $update_sql );
|
507 |
+
}
|
508 |
+
|
509 |
+
global $wpdb;
|
510 |
+
$table_name = $wpdb->prefix . "mlw_questions";
|
511 |
+
//Update 0.5
|
512 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'comments'") != "comments")
|
513 |
+
{
|
514 |
+
$sql = "ALTER TABLE ".$table_name." ADD comments INT NOT NULL AFTER correct_answer";
|
515 |
+
$results = $wpdb->query( $sql );
|
516 |
+
$sql = "ALTER TABLE ".$table_name." ADD hints TEXT NOT NULL AFTER comments";
|
517 |
+
$results = $wpdb->query( $sql );
|
518 |
+
$update_sql = "UPDATE ".$table_name." SET comments=1, hints=''";
|
519 |
+
$results = $wpdb->query( $update_sql );
|
520 |
+
}
|
521 |
+
//Update 0.8
|
522 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_order'") != "question_order")
|
523 |
+
{
|
524 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_order INT NOT NULL AFTER hints";
|
525 |
+
$results = $wpdb->query( $sql );
|
526 |
+
$update_sql = "UPDATE ".$table_name." SET question_order=0";
|
527 |
+
$results = $wpdb->query( $update_sql );
|
528 |
+
}
|
529 |
+
|
530 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_type'") != "question_type")
|
531 |
+
{
|
532 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_type INT NOT NULL AFTER question_order";
|
533 |
+
$results = $wpdb->query( $sql );
|
534 |
+
$update_sql = "UPDATE ".$table_name." SET question_type=0";
|
535 |
+
$results = $wpdb->query( $update_sql );
|
536 |
+
}
|
537 |
+
|
538 |
+
//Update 1.1.1
|
539 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_answer_info'") != "question_answer_info")
|
540 |
+
{
|
541 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_answer_info TEXT NOT NULL AFTER correct_answer";
|
542 |
+
$results = $wpdb->query( $sql );
|
543 |
+
$update_sql = "UPDATE ".$table_name." SET question_answer_info=''";
|
544 |
+
$results = $wpdb->query( $update_sql );
|
545 |
+
}
|
546 |
+
|
547 |
+
//Update 2.5.1
|
548 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'answer_array'") != "answer_array")
|
549 |
+
{
|
550 |
+
$sql = "ALTER TABLE ".$table_name." ADD answer_array TEXT NOT NULL AFTER question_name";
|
551 |
+
$results = $wpdb->query( $sql );
|
552 |
+
$update_sql = "UPDATE ".$table_name." SET answer_array=''";
|
553 |
+
$results = $wpdb->query( $update_sql );
|
554 |
+
}
|
555 |
+
|
556 |
+
//Update 3.1.1
|
557 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_settings'") != "question_settings")
|
558 |
+
{
|
559 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_settings TEXT NOT NULL AFTER question_type";
|
560 |
+
$results = $wpdb->query( $sql );
|
561 |
+
$update_sql = "UPDATE ".$table_name." SET question_settings=''";
|
562 |
+
$results = $wpdb->query( $update_sql );
|
563 |
+
}
|
564 |
+
|
565 |
+
//Update 4.0.0
|
566 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'category'") != "category")
|
567 |
+
{
|
568 |
+
$sql = "ALTER TABLE ".$table_name." ADD category TEXT NOT NULL AFTER question_settings";
|
569 |
+
$results = $wpdb->query( $sql );
|
570 |
+
$update_sql = "UPDATE ".$table_name." SET category=''";
|
571 |
+
$results = $wpdb->query( $update_sql );
|
572 |
+
}
|
573 |
+
|
574 |
+
//Update 4.0.0
|
575 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_type_new'") != "question_type_new")
|
576 |
+
{
|
577 |
+
$sql = "ALTER TABLE ".$table_name." ADD question_type_new TEXT NOT NULL AFTER question_type";
|
578 |
+
$results = $wpdb->query( $sql );
|
579 |
+
$update_sql = "UPDATE ".$table_name." SET question_type_new=question_type";
|
580 |
+
$results = $wpdb->query( $update_sql );
|
581 |
+
}
|
582 |
+
|
583 |
+
//Update 2.6.1
|
584 |
+
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" );
|
585 |
+
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_questions CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
|
586 |
+
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_quizzes CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
|
587 |
+
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_results CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
|
588 |
+
|
589 |
+
|
590 |
+
global $wpdb;
|
591 |
+
$table_name = $wpdb->prefix . "mlw_results";
|
592 |
+
//Update 2.6.4
|
593 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'user'") != "user")
|
594 |
+
{
|
595 |
+
$sql = "ALTER TABLE ".$table_name." ADD user INT NOT NULL AFTER phone";
|
596 |
+
$results = $wpdb->query( $sql );
|
597 |
+
$update_sql = "UPDATE ".$table_name." SET user=0";
|
598 |
+
$results = $wpdb->query( $update_sql );
|
599 |
+
}
|
600 |
+
|
601 |
+
// Update 4.8.0
|
602 |
+
if( $wpdb->get_var( "SHOW COLUMNS FROM $table_name LIKE 'user_ip'" ) != "user_ip" ) {
|
603 |
+
$sql = "ALTER TABLE $table_name ADD user_ip TEXT NOT NULL AFTER user";
|
604 |
+
$results = $wpdb->query( $sql );
|
605 |
+
$update_sql = "UPDATE $table_name SET user_ip='Unknown'";
|
606 |
+
$results = $wpdb->query( $update_sql );
|
607 |
+
}
|
608 |
+
|
609 |
+
|
610 |
+
update_option('mlw_quiz_master_version' , $data);
|
611 |
+
if(!isset($_GET['activate-multi']))
|
612 |
+
{
|
613 |
+
wp_safe_redirect( admin_url( 'index.php?page=mlw_qmn_about' ) );
|
614 |
+
exit;
|
615 |
+
}
|
616 |
+
}
|
617 |
+
if ( ! get_option('mlw_advert_shows'))
|
618 |
+
{
|
619 |
+
add_option('mlw_advert_shows' , 'true');
|
620 |
+
}
|
621 |
+
}
|
622 |
+
|
623 |
+
/**
|
624 |
+
* Adds new links to the plugin action links
|
625 |
+
*
|
626 |
+
* @since 4.7.1
|
627 |
+
*/
|
628 |
+
public function plugin_action_links( $links ) {
|
629 |
+
$action_links = array(
|
630 |
+
'settings' => '<a href="' . admin_url( 'admin.php?page=' . QSM_PLUGIN_BASENAME ) . '" title="' . esc_attr( __( 'Quizzes/Surveys', 'quiz-master-next' ) ) . '">' . __( 'Quizzes/Surveys', 'quiz-master-next' ) . '</a>',
|
631 |
+
);
|
632 |
+
return array_merge( $action_links, $links );
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Adds new links to the plugin row meta
|
637 |
+
*
|
638 |
+
* @since 4.7.1
|
639 |
+
*/
|
640 |
+
public function plugin_row_meta( $links, $file ) {
|
641 |
+
if ( $file == QSM_PLUGIN_BASENAME ) {
|
642 |
+
$row_meta = array(
|
643 |
+
'docs' => '<a href="' . esc_url( 'http://quizandsurveymaster.com/documentation/?utm_source=plugin-row-meta&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=documentation' ) . '" title="' . esc_attr( __( 'View Documentation', 'quiz-master-next' ) ) . '">' . __( 'Documentation', 'quiz-master-next' ) . '</a>',
|
644 |
+
'academy' => '<a href="' . esc_url( 'http://quizandsurveymaster.com/online-academy/?utm_source=plugin-row-meta&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=online_academy' ) . '" title="' . esc_attr( __( 'Watch Online Academy Videos', 'quiz-master-next' ) ) . '">' . __( 'Online Academy', 'quiz-master-next' ) . '</a>',
|
645 |
+
'support' => '<a href="' . admin_url( 'admin.php?page=mlw_quiz_help' ) . '" title="' . esc_attr( __( 'Create Support Ticket', 'quiz-master-next' ) ) . '">' . __( 'Support', 'quiz-master-next' ) . '</a>',
|
646 |
+
);
|
647 |
+
return array_merge( $links, $row_meta );
|
648 |
+
}
|
649 |
+
|
650 |
+
return (array) $links;
|
651 |
+
|
652 |
+
}
|
653 |
+
}
|
654 |
+
|
655 |
+
$qsm_install = new QSM_Install();
|
656 |
+
|
657 |
+
?>
|
php/install.php
DELETED
@@ -1,157 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
-
/**
|
4 |
-
* This is the install file for QMN. It installs all neccessary databases, pages, etc.
|
5 |
-
*
|
6 |
-
* @return void
|
7 |
-
* @since 4.4.0
|
8 |
-
*/
|
9 |
-
function mlw_quiz_activate()
|
10 |
-
{
|
11 |
-
global $wpdb;
|
12 |
-
$charset_collate = $wpdb->get_charset_collate();
|
13 |
-
|
14 |
-
$quiz_table_name = $wpdb->prefix . "mlw_quizzes";
|
15 |
-
$question_table_name = $wpdb->prefix . "mlw_questions";
|
16 |
-
$results_table_name = $wpdb->prefix . "mlw_results";
|
17 |
-
$audit_table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
18 |
-
|
19 |
-
if( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_table_name'" ) != $quiz_table_name ) {
|
20 |
-
$sql = "CREATE TABLE $quiz_table_name (
|
21 |
-
quiz_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
22 |
-
quiz_name TEXT NOT NULL,
|
23 |
-
message_before TEXT NOT NULL,
|
24 |
-
message_after TEXT NOT NULL,
|
25 |
-
message_comment TEXT NOT NULL,
|
26 |
-
message_end_template TEXT NOT NULL,
|
27 |
-
user_email_template TEXT NOT NULL,
|
28 |
-
admin_email_template TEXT NOT NULL,
|
29 |
-
submit_button_text TEXT NOT NULL,
|
30 |
-
name_field_text TEXT NOT NULL,
|
31 |
-
business_field_text TEXT NOT NULL,
|
32 |
-
email_field_text TEXT NOT NULL,
|
33 |
-
phone_field_text TEXT NOT NULL,
|
34 |
-
comment_field_text TEXT NOT NULL,
|
35 |
-
email_from_text TEXT NOT NULL,
|
36 |
-
question_answer_template TEXT NOT NULL,
|
37 |
-
leaderboard_template TEXT NOT NULL,
|
38 |
-
system INT NOT NULL,
|
39 |
-
randomness_order INT NOT NULL,
|
40 |
-
loggedin_user_contact INT NOT NULL,
|
41 |
-
show_score INT NOT NULL,
|
42 |
-
send_user_email INT NOT NULL,
|
43 |
-
send_admin_email INT NOT NULL,
|
44 |
-
contact_info_location INT NOT NULL,
|
45 |
-
user_name INT NOT NULL,
|
46 |
-
user_comp INT NOT NULL,
|
47 |
-
user_email INT NOT NULL,
|
48 |
-
user_phone INT NOT NULL,
|
49 |
-
admin_email TEXT NOT NULL,
|
50 |
-
comment_section INT NOT NULL,
|
51 |
-
question_from_total INT NOT NULL,
|
52 |
-
total_user_tries INT NOT NULL,
|
53 |
-
total_user_tries_text TEXT NOT NULL,
|
54 |
-
certificate_template TEXT NOT NULL,
|
55 |
-
social_media INT NOT NULL,
|
56 |
-
social_media_text TEXT NOT NULL,
|
57 |
-
pagination INT NOT NULL,
|
58 |
-
pagination_text TEXT NOT NULL,
|
59 |
-
timer_limit INT NOT NULL,
|
60 |
-
quiz_stye TEXT NOT NULL,
|
61 |
-
question_numbering INT NOT NULL,
|
62 |
-
quiz_settings TEXT NOT NULL,
|
63 |
-
theme_selected TEXT NOT NULL,
|
64 |
-
last_activity DATETIME NOT NULL,
|
65 |
-
require_log_in INT NOT NULL,
|
66 |
-
require_log_in_text TEXT NOT NULL,
|
67 |
-
limit_total_entries INT NOT NULL,
|
68 |
-
limit_total_entries_text TEXT NOT NULL,
|
69 |
-
scheduled_timeframe TEXT NOT NULL,
|
70 |
-
scheduled_timeframe_text TEXT NOT NULL,
|
71 |
-
disable_answer_onselect INT NOT NULL,
|
72 |
-
ajax_show_correct INT NOT NULL,
|
73 |
-
quiz_views INT NOT NULL,
|
74 |
-
quiz_taken INT NOT NULL,
|
75 |
-
deleted INT NOT NULL,
|
76 |
-
PRIMARY KEY (quiz_id)
|
77 |
-
) $charset_collate;";
|
78 |
-
|
79 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
80 |
-
dbDelta( $sql );
|
81 |
-
}
|
82 |
-
|
83 |
-
if( $wpdb->get_var( "SHOW TABLES LIKE '$question_table_name'" ) != $question_table_name ) {
|
84 |
-
$sql = "CREATE TABLE $question_table_name (
|
85 |
-
question_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
86 |
-
quiz_id INT NOT NULL,
|
87 |
-
question_name TEXT NOT NULL,
|
88 |
-
answer_array TEXT NOT NULL,
|
89 |
-
answer_one TEXT NOT NULL,
|
90 |
-
answer_one_points INT NOT NULL,
|
91 |
-
answer_two TEXT NOT NULL,
|
92 |
-
answer_two_points INT NOT NULL,
|
93 |
-
answer_three TEXT NOT NULL,
|
94 |
-
answer_three_points INT NOT NULL,
|
95 |
-
answer_four TEXT NOT NULL,
|
96 |
-
answer_four_points INT NOT NULL,
|
97 |
-
answer_five TEXT NOT NULL,
|
98 |
-
answer_five_points INT NOT NULL,
|
99 |
-
answer_six TEXT NOT NULL,
|
100 |
-
answer_six_points INT NOT NULL,
|
101 |
-
correct_answer INT NOT NULL,
|
102 |
-
question_answer_info TEXT NOT NULL,
|
103 |
-
comments INT NOT NULL,
|
104 |
-
hints TEXT NOT NULL,
|
105 |
-
question_order INT NOT NULL,
|
106 |
-
question_type INT NOT NULL,
|
107 |
-
question_type_new TEXT NOT NULL,
|
108 |
-
question_settings TEXT NOT NULL,
|
109 |
-
category TEXT NOT NULL,
|
110 |
-
deleted INT NOT NULL,
|
111 |
-
PRIMARY KEY (question_id)
|
112 |
-
) $charset_collate;";
|
113 |
-
|
114 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
115 |
-
dbDelta( $sql );
|
116 |
-
}
|
117 |
-
|
118 |
-
if( $wpdb->get_var( "SHOW TABLES LIKE '$results_table_name'" ) != $results_table_name ) {
|
119 |
-
$sql = "CREATE TABLE $results_table_name (
|
120 |
-
result_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
121 |
-
quiz_id INT NOT NULL,
|
122 |
-
quiz_name TEXT NOT NULL,
|
123 |
-
quiz_system INT NOT NULL,
|
124 |
-
point_score INT NOT NULL,
|
125 |
-
correct_score INT NOT NULL,
|
126 |
-
correct INT NOT NULL,
|
127 |
-
total INT NOT NULL,
|
128 |
-
name TEXT NOT NULL,
|
129 |
-
business TEXT NOT NULL,
|
130 |
-
email TEXT NOT NULL,
|
131 |
-
phone TEXT NOT NULL,
|
132 |
-
user INT NOT NULL,
|
133 |
-
time_taken TEXT NOT NULL,
|
134 |
-
time_taken_real DATETIME NOT NULL,
|
135 |
-
quiz_results TEXT NOT NULL,
|
136 |
-
deleted INT NOT NULL,
|
137 |
-
PRIMARY KEY (result_id)
|
138 |
-
) $charset_collate;";
|
139 |
-
|
140 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
141 |
-
dbDelta( $sql );
|
142 |
-
}
|
143 |
-
|
144 |
-
if( $wpdb->get_var( "SHOW TABLES LIKE '$audit_table_name'" ) != $audit_table_name ) {
|
145 |
-
$sql = "CREATE TABLE $audit_table_name (
|
146 |
-
trail_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
147 |
-
action_user TEXT NOT NULL,
|
148 |
-
action TEXT NOT NULL,
|
149 |
-
time TEXT NOT NULL,
|
150 |
-
PRIMARY KEY (trail_id)
|
151 |
-
) $charset_collate;";
|
152 |
-
|
153 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
154 |
-
dbDelta( $sql );
|
155 |
-
}
|
156 |
-
}
|
157 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
php/options-page-certificate-tab.php
CHANGED
@@ -60,23 +60,7 @@ function mlw_options_certificate_tab_content()
|
|
60 |
if ( $update_results ) {
|
61 |
|
62 |
$mlwQuizMasterNext->alertManager->newAlert(__('The certificate has been updated successfully.', 'quiz-master-next'), 'success');
|
63 |
-
|
64 |
-
//Insert Action Into Audit Trail
|
65 |
-
global $current_user;
|
66 |
-
get_currentuserinfo();
|
67 |
-
$wpdb->insert(
|
68 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
69 |
-
array(
|
70 |
-
'action_user' => $current_user->display_name,
|
71 |
-
'action' => "Certificate Options Have Been Edited For Quiz Number $mlw_certificate_id",
|
72 |
-
'time' => date("h:i:s A m/d/Y")
|
73 |
-
),
|
74 |
-
array(
|
75 |
-
'%s',
|
76 |
-
'%s',
|
77 |
-
'%s'
|
78 |
-
)
|
79 |
-
);
|
80 |
} else {
|
81 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0012'), 'error');
|
82 |
$mlwQuizMasterNext->log_manager->add("Error 0012", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
60 |
if ( $update_results ) {
|
61 |
|
62 |
$mlwQuizMasterNext->alertManager->newAlert(__('The certificate has been updated successfully.', 'quiz-master-next'), 'success');
|
63 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Certificate Options Have Been Edited For Quiz Number $mlw_certificate_id" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
} else {
|
65 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0012'), 'error');
|
66 |
$mlwQuizMasterNext->log_manager->add("Error 0012", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
php/options-page-email-tab.php
CHANGED
@@ -46,26 +46,9 @@ function mlw_options_emails_tab_content()
|
|
46 |
}
|
47 |
//Update email template with new array then check to see if worked
|
48 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_email_array, $mlw_qmn_add_email_id ) );
|
49 |
-
if ($mlw_new_email_results
|
50 |
-
{
|
51 |
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
52 |
-
|
53 |
-
//Insert Action Into Audit Trail
|
54 |
-
global $current_user;
|
55 |
-
get_currentuserinfo();
|
56 |
-
$wpdb->insert(
|
57 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
58 |
-
array(
|
59 |
-
'action_user' => $current_user->display_name,
|
60 |
-
'action' => "New User Email Has Been Created For Quiz Number $mlw_qmn_add_email_id",
|
61 |
-
'time' => date("h:i:s A m/d/Y")
|
62 |
-
),
|
63 |
-
array(
|
64 |
-
'%s',
|
65 |
-
'%s',
|
66 |
-
'%s'
|
67 |
-
)
|
68 |
-
);
|
69 |
}
|
70 |
else
|
71 |
{
|
@@ -114,26 +97,9 @@ function mlw_options_emails_tab_content()
|
|
114 |
}
|
115 |
//Update email template with new array then check to see if worked
|
116 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET admin_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_email_array, $mlw_qmn_add_email_id ) );
|
117 |
-
if ($mlw_new_email_results
|
118 |
-
{
|
119 |
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
120 |
-
|
121 |
-
//Insert Action Into Audit Trail
|
122 |
-
global $current_user;
|
123 |
-
get_currentuserinfo();
|
124 |
-
$wpdb->insert(
|
125 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
126 |
-
array(
|
127 |
-
'action_user' => $current_user->display_name,
|
128 |
-
'action' => "New Admin Email Has Been Created For Quiz Number $mlw_qmn_add_email_id",
|
129 |
-
'time' => date("h:i:s A m/d/Y")
|
130 |
-
),
|
131 |
-
array(
|
132 |
-
'%s',
|
133 |
-
'%s',
|
134 |
-
'%s'
|
135 |
-
)
|
136 |
-
);
|
137 |
}
|
138 |
else
|
139 |
{
|
@@ -219,26 +185,9 @@ function mlw_options_emails_tab_content()
|
|
219 |
),
|
220 |
array( '%d' )
|
221 |
);
|
222 |
-
if ($mlw_new_email_results
|
223 |
-
|
224 |
-
$mlwQuizMasterNext->
|
225 |
-
|
226 |
-
//Insert Action Into Audit Trail
|
227 |
-
global $current_user;
|
228 |
-
get_currentuserinfo();
|
229 |
-
$wpdb->insert(
|
230 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
231 |
-
array(
|
232 |
-
'action_user' => $current_user->display_name,
|
233 |
-
'action' => "Email Templates Have Been Saved For Quiz Number $mlw_qmn_email_id",
|
234 |
-
'time' => date("h:i:s A m/d/Y")
|
235 |
-
),
|
236 |
-
array(
|
237 |
-
'%s',
|
238 |
-
'%s',
|
239 |
-
'%s'
|
240 |
-
)
|
241 |
-
);
|
242 |
}
|
243 |
else
|
244 |
{
|
46 |
}
|
47 |
//Update email template with new array then check to see if worked
|
48 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_email_array, $mlw_qmn_add_email_id ) );
|
49 |
+
if ( false != $mlw_new_email_results ) {
|
|
|
50 |
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
51 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "New User Email Has Been Created For Quiz Number $mlw_qmn_add_email_id" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
else
|
54 |
{
|
97 |
}
|
98 |
//Update email template with new array then check to see if worked
|
99 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET admin_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_email_array, $mlw_qmn_add_email_id ) );
|
100 |
+
if ( false != $mlw_new_email_results ) {
|
|
|
101 |
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
102 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "New Admin Email Has Been Created For Quiz Number $mlw_qmn_add_email_id" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
else
|
105 |
{
|
185 |
),
|
186 |
array( '%d' )
|
187 |
);
|
188 |
+
if ( false != $mlw_new_email_results ) {
|
189 |
+
$mlwQuizMasterNext->alertManager->newAlert( __( 'The email has been updated successfully.', 'quiz-master-next' ), 'success' );
|
190 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Email Templates Have Been Saved For Quiz Number $mlw_qmn_email_id" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
else
|
193 |
{
|
php/options-page-leaderboard-tab.php
CHANGED
@@ -47,23 +47,7 @@ function mlw_options_leaderboard_tab_content()
|
|
47 |
);
|
48 |
if ( $results ) {
|
49 |
$mlwQuizMasterNext->alertManager->newAlert(__('The leaderboards has been updated successfully.', 'quiz-master-next'), 'success');
|
50 |
-
|
51 |
-
//Insert Action Into Audit Trail
|
52 |
-
global $current_user;
|
53 |
-
get_currentuserinfo();
|
54 |
-
$wpdb->insert(
|
55 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
56 |
-
array(
|
57 |
-
'action_user' => $current_user->display_name,
|
58 |
-
'action' => "Leaderboard Options Have Been Edited For Quiz Number $mlw_leaderboard_quiz_id",
|
59 |
-
'time' => date("h:i:s A m/d/Y")
|
60 |
-
),
|
61 |
-
array(
|
62 |
-
'%s',
|
63 |
-
'%s',
|
64 |
-
'%s'
|
65 |
-
)
|
66 |
-
);
|
67 |
} else {
|
68 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0009'), 'error');
|
69 |
$mlwQuizMasterNext->log_manager->add("Error 0009", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
47 |
);
|
48 |
if ( $results ) {
|
49 |
$mlwQuizMasterNext->alertManager->newAlert(__('The leaderboards has been updated successfully.', 'quiz-master-next'), 'success');
|
50 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Leaderboard Options Have Been Edited For Quiz Number $mlw_leaderboard_quiz_id" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
} else {
|
52 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0009'), 'error');
|
53 |
$mlwQuizMasterNext->log_manager->add("Error 0009", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
php/options-page-option-tab.php
CHANGED
@@ -105,29 +105,10 @@ function mlw_options_option_tab_content()
|
|
105 |
),
|
106 |
array( '%d' )
|
107 |
);
|
108 |
-
if ($results
|
109 |
-
{
|
110 |
$mlwQuizMasterNext->alertManager->newAlert(__('The options has been updated successfully.', 'quiz-master-next'), 'success');
|
111 |
-
|
112 |
-
|
113 |
-
global $current_user;
|
114 |
-
get_currentuserinfo();
|
115 |
-
$wpdb->insert(
|
116 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
117 |
-
array(
|
118 |
-
'action_user' => $current_user->display_name,
|
119 |
-
'action' => "Options Have Been Edited For Quiz Number $quiz_id",
|
120 |
-
'time' => date("h:i:s A m/d/Y")
|
121 |
-
),
|
122 |
-
array(
|
123 |
-
'%s',
|
124 |
-
'%s',
|
125 |
-
'%s'
|
126 |
-
)
|
127 |
-
);
|
128 |
-
}
|
129 |
-
else
|
130 |
-
{
|
131 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0008'), 'error');
|
132 |
$mlwQuizMasterNext->log_manager->add("Error 0008", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
133 |
}
|
105 |
),
|
106 |
array( '%d' )
|
107 |
);
|
108 |
+
if ( false != $results ) {
|
|
|
109 |
$mlwQuizMasterNext->alertManager->newAlert(__('The options has been updated successfully.', 'quiz-master-next'), 'success');
|
110 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Options Have Been Edited For Quiz Number $quiz_id" );
|
111 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0008'), 'error');
|
113 |
$mlwQuizMasterNext->log_manager->add("Error 0008", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
114 |
}
|
php/options-page-questions-tab.php
CHANGED
@@ -63,23 +63,7 @@ function mlw_options_questions_tab_content()
|
|
63 |
}
|
64 |
if ( ! $success ) {
|
65 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question order has been updated successfully.', 'quiz-master-next'), 'success');
|
66 |
-
|
67 |
-
//Insert Action Into Audit Trail
|
68 |
-
global $current_user;
|
69 |
-
get_currentuserinfo();
|
70 |
-
$results = $wpdb->insert(
|
71 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
72 |
-
array(
|
73 |
-
'action_user' => $current_user->display_name,
|
74 |
-
'action' => "Question Order Has Been Updated On Quiz: $quiz_id",
|
75 |
-
'time' => date("h:i:s A m/d/Y")
|
76 |
-
),
|
77 |
-
array(
|
78 |
-
'%s',
|
79 |
-
'%s',
|
80 |
-
'%s'
|
81 |
-
)
|
82 |
-
);
|
83 |
}
|
84 |
}
|
85 |
|
@@ -165,29 +149,10 @@ function mlw_options_questions_tab_content()
|
|
165 |
),
|
166 |
array( '%d' )
|
167 |
);
|
168 |
-
if ($results
|
169 |
-
{
|
170 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been updated successfully.', 'quiz-master-next'), 'success');
|
171 |
-
|
172 |
-
|
173 |
-
global $current_user;
|
174 |
-
get_currentuserinfo();
|
175 |
-
$wpdb->insert(
|
176 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
177 |
-
array(
|
178 |
-
'action_user' => $current_user->display_name,
|
179 |
-
'action' => "Question Has Been Edited: $edit_question_name",
|
180 |
-
'time' => date("h:i:s A m/d/Y")
|
181 |
-
),
|
182 |
-
array(
|
183 |
-
'%s',
|
184 |
-
'%s',
|
185 |
-
'%s'
|
186 |
-
)
|
187 |
-
);
|
188 |
-
}
|
189 |
-
else
|
190 |
-
{
|
191 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0004'), 'error');
|
192 |
$mlwQuizMasterNext->log_manager->add("Error 0004", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
193 |
}
|
@@ -210,29 +175,10 @@ function mlw_options_questions_tab_content()
|
|
210 |
),
|
211 |
array( '%d' )
|
212 |
);
|
213 |
-
if ($results
|
214 |
-
{
|
215 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been deleted successfully.', 'quiz-master-next'), 'success');
|
216 |
-
|
217 |
-
|
218 |
-
global $current_user;
|
219 |
-
get_currentuserinfo();
|
220 |
-
$wpdb->insert(
|
221 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
222 |
-
array(
|
223 |
-
'action_user' => $current_user->display_name,
|
224 |
-
'action' => "Question Has Been Deleted: $mlw_question_id",
|
225 |
-
'time' => date("h:i:s A m/d/Y")
|
226 |
-
),
|
227 |
-
array(
|
228 |
-
'%s',
|
229 |
-
'%s',
|
230 |
-
'%s'
|
231 |
-
)
|
232 |
-
);
|
233 |
-
}
|
234 |
-
else
|
235 |
-
{
|
236 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0005'), 'error');
|
237 |
$mlwQuizMasterNext->log_manager->add("Error 0005", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
238 |
}
|
@@ -302,29 +248,10 @@ function mlw_options_questions_tab_content()
|
|
302 |
)
|
303 |
);
|
304 |
|
305 |
-
if ($results
|
306 |
-
{
|
307 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been duplicated successfully.', 'quiz-master-next'), 'success');
|
308 |
-
|
309 |
-
|
310 |
-
global $current_user;
|
311 |
-
get_currentuserinfo();
|
312 |
-
$wpdb->insert(
|
313 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
314 |
-
array(
|
315 |
-
'action_user' => $current_user->display_name,
|
316 |
-
'action' => "Question Has Been Duplicated: $mlw_question_id",
|
317 |
-
'time' => date("h:i:s A m/d/Y")
|
318 |
-
),
|
319 |
-
array(
|
320 |
-
'%s',
|
321 |
-
'%s',
|
322 |
-
'%s'
|
323 |
-
)
|
324 |
-
);
|
325 |
-
}
|
326 |
-
else
|
327 |
-
{
|
328 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0019'), 'error');
|
329 |
$mlwQuizMasterNext->log_manager->add("Error 00019", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
330 |
}
|
@@ -399,29 +326,10 @@ function mlw_options_questions_tab_content()
|
|
399 |
'%d'
|
400 |
)
|
401 |
);
|
402 |
-
if ($results
|
403 |
-
{
|
404 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been created successfully.', 'quiz-master-next'), 'success');
|
405 |
-
|
406 |
-
|
407 |
-
global $current_user;
|
408 |
-
get_currentuserinfo();
|
409 |
-
$wpdb->insert(
|
410 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
411 |
-
array(
|
412 |
-
'action_user' => $current_user->display_name,
|
413 |
-
'action' => "Question Has Been Added: $question_name",
|
414 |
-
'time' => date("h:i:s A m/d/Y")
|
415 |
-
),
|
416 |
-
array(
|
417 |
-
'%s',
|
418 |
-
'%s',
|
419 |
-
'%s'
|
420 |
-
)
|
421 |
-
);
|
422 |
-
}
|
423 |
-
else
|
424 |
-
{
|
425 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0006'), 'error');
|
426 |
$mlwQuizMasterNext->log_manager->add("Error 0006", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
427 |
}
|
@@ -467,23 +375,7 @@ function mlw_options_questions_tab_content()
|
|
467 |
);
|
468 |
if ( false !== $results ) {
|
469 |
$mlwQuizMasterNext->alertManager->newAlert( __( 'The question has been created successfully.', 'quiz-master-next' ), 'success' );
|
470 |
-
|
471 |
-
//Insert Action Into Audit Trail
|
472 |
-
global $current_user;
|
473 |
-
get_currentuserinfo();
|
474 |
-
$wpdb->insert(
|
475 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
476 |
-
array(
|
477 |
-
'action_user' => $current_user->display_name,
|
478 |
-
'action' => "Question Has Been Added: {$importing_question->question_name}",
|
479 |
-
'time' => date("h:i:s A m/d/Y")
|
480 |
-
),
|
481 |
-
array(
|
482 |
-
'%s',
|
483 |
-
'%s',
|
484 |
-
'%s'
|
485 |
-
)
|
486 |
-
);
|
487 |
} else {
|
488 |
$mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next' ), '0023' ), 'error' );
|
489 |
$mlwQuizMasterNext->log_manager->add( "Error 0023", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error' );
|
63 |
}
|
64 |
if ( ! $success ) {
|
65 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question order has been updated successfully.', 'quiz-master-next'), 'success');
|
66 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Question Order Has Been Updated On Quiz: $quiz_id" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
}
|
69 |
|
149 |
),
|
150 |
array( '%d' )
|
151 |
);
|
152 |
+
if ( false != $results ) {
|
|
|
153 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been updated successfully.', 'quiz-master-next'), 'success');
|
154 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Question Has Been Edited: $edit_question_name" );
|
155 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0004'), 'error');
|
157 |
$mlwQuizMasterNext->log_manager->add("Error 0004", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
158 |
}
|
175 |
),
|
176 |
array( '%d' )
|
177 |
);
|
178 |
+
if ( false != $results ) {
|
|
|
179 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been deleted successfully.', 'quiz-master-next'), 'success');
|
180 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Question Has Been Deleted: $mlw_question_id" );
|
181 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0005'), 'error');
|
183 |
$mlwQuizMasterNext->log_manager->add("Error 0005", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
184 |
}
|
248 |
)
|
249 |
);
|
250 |
|
251 |
+
if ( false != $results ) {
|
|
|
252 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been duplicated successfully.', 'quiz-master-next'), 'success');
|
253 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Question Has Been Duplicated: $mlw_question_id" );
|
254 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0019'), 'error');
|
256 |
$mlwQuizMasterNext->log_manager->add("Error 00019", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
257 |
}
|
326 |
'%d'
|
327 |
)
|
328 |
);
|
329 |
+
if ( false != $results ) {
|
|
|
330 |
$mlwQuizMasterNext->alertManager->newAlert(__('The question has been created successfully.', 'quiz-master-next'), 'success');
|
331 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Question Has Been Added: $question_name" );
|
332 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0006'), 'error');
|
334 |
$mlwQuizMasterNext->log_manager->add("Error 0006", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
335 |
}
|
375 |
);
|
376 |
if ( false !== $results ) {
|
377 |
$mlwQuizMasterNext->alertManager->newAlert( __( 'The question has been created successfully.', 'quiz-master-next' ), 'success' );
|
378 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Question Has Been Added: {$importing_question->question_name}" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
} else {
|
380 |
$mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next' ), '0023' ), 'error' );
|
381 |
$mlwQuizMasterNext->log_manager->add( "Error 0023", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error' );
|
php/options-page-results-page-tab.php
CHANGED
@@ -50,29 +50,10 @@ function mlw_options_results_tab_content()
|
|
50 |
|
51 |
//Update message_after with new array then check to see if worked
|
52 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after=%s, last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_landing_array, $mlw_qmn_landing_id ) );
|
53 |
-
if ($mlw_new_landing_results
|
54 |
-
{
|
55 |
$mlwQuizMasterNext->alertManager->newAlert(__('The results page has been added successfully.', 'quiz-master-next'), 'success');
|
56 |
-
|
57 |
-
|
58 |
-
global $current_user;
|
59 |
-
get_currentuserinfo();
|
60 |
-
$wpdb->insert(
|
61 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
62 |
-
array(
|
63 |
-
'action_user' => $current_user->display_name,
|
64 |
-
'action' => "New Results Page Has Been Created For Quiz Number $mlw_qmn_landing_id",
|
65 |
-
'time' => date("h:i:s A m/d/Y")
|
66 |
-
),
|
67 |
-
array(
|
68 |
-
'%s',
|
69 |
-
'%s',
|
70 |
-
'%s'
|
71 |
-
)
|
72 |
-
);
|
73 |
-
}
|
74 |
-
else
|
75 |
-
{
|
76 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0013'), 'error');
|
77 |
$mlwQuizMasterNext->log_manager->add("Error 0013", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
78 |
}
|
@@ -99,29 +80,10 @@ function mlw_options_results_tab_content()
|
|
99 |
}
|
100 |
$mlw_qmn_new_landing_array = serialize($mlw_qmn_new_landing_array);
|
101 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_new_landing_array, $mlw_qmn_landing_id ) );
|
102 |
-
if ($mlw_new_landing_results
|
103 |
-
{
|
104 |
$mlwQuizMasterNext->alertManager->newAlert(__('The results page has been saved successfully.', 'quiz-master-next'), 'success');
|
105 |
-
|
106 |
-
|
107 |
-
global $current_user;
|
108 |
-
get_currentuserinfo();
|
109 |
-
$wpdb->insert(
|
110 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
111 |
-
array(
|
112 |
-
'action_user' => $current_user->display_name,
|
113 |
-
'action' => "Results Pages Have Been Saved For Quiz Number $mlw_qmn_landing_id",
|
114 |
-
'time' => date("h:i:s A m/d/Y")
|
115 |
-
),
|
116 |
-
array(
|
117 |
-
'%s',
|
118 |
-
'%s',
|
119 |
-
'%s'
|
120 |
-
)
|
121 |
-
);
|
122 |
-
}
|
123 |
-
else
|
124 |
-
{
|
125 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0014'), 'error');
|
126 |
$mlwQuizMasterNext->log_manager->add("Error 0014", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
127 |
}
|
50 |
|
51 |
//Update message_after with new array then check to see if worked
|
52 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after=%s, last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_landing_array, $mlw_qmn_landing_id ) );
|
53 |
+
if ( false != $mlw_new_landing_results ) {
|
|
|
54 |
$mlwQuizMasterNext->alertManager->newAlert(__('The results page has been added successfully.', 'quiz-master-next'), 'success');
|
55 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "New Results Page Has Been Created For Quiz Number $mlw_qmn_landing_id" );
|
56 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0013'), 'error');
|
58 |
$mlwQuizMasterNext->log_manager->add("Error 0013", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
59 |
}
|
80 |
}
|
81 |
$mlw_qmn_new_landing_array = serialize($mlw_qmn_new_landing_array);
|
82 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_new_landing_array, $mlw_qmn_landing_id ) );
|
83 |
+
if ( false != $mlw_new_landing_results ) {
|
|
|
84 |
$mlwQuizMasterNext->alertManager->newAlert(__('The results page has been saved successfully.', 'quiz-master-next'), 'success');
|
85 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Results Pages Have Been Saved For Quiz Number $mlw_qmn_landing_id" );
|
86 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0014'), 'error');
|
88 |
$mlwQuizMasterNext->log_manager->add("Error 0014", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
89 |
}
|
php/options-page-style-tab.php
CHANGED
@@ -34,29 +34,10 @@ function mlw_options_styling_tab_content()
|
|
34 |
|
35 |
//Save the new css
|
36 |
$mlw_save_stle_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET quiz_stye='%s', theme_selected='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_style, $mlw_qmn_theme, $mlw_qmn_style_id ) );
|
37 |
-
if ($mlw_save_stle_results
|
38 |
-
{
|
39 |
$mlwQuizMasterNext->alertManager->newAlert(__('The style has been saved successfully.', 'quiz-master-next'), 'success');
|
40 |
-
|
41 |
-
|
42 |
-
global $current_user;
|
43 |
-
get_currentuserinfo();
|
44 |
-
$wpdb->insert(
|
45 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
46 |
-
array(
|
47 |
-
'action_user' => $current_user->display_name,
|
48 |
-
'action' => "Styles Have Been Saved For Quiz Number $mlw_qmn_style_id",
|
49 |
-
'time' => date("h:i:s A m/d/Y")
|
50 |
-
),
|
51 |
-
array(
|
52 |
-
'%s',
|
53 |
-
'%s',
|
54 |
-
'%s'
|
55 |
-
)
|
56 |
-
);
|
57 |
-
}
|
58 |
-
else
|
59 |
-
{
|
60 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0015'), 'error');
|
61 |
$mlwQuizMasterNext->log_manager->add("Error 0015", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
62 |
}
|
@@ -113,7 +94,7 @@ function mlw_options_styling_tab_content()
|
|
113 |
?>
|
114 |
<div onclick="mlw_qmn_theme('<?php echo $slug; ?>');" id="mlw_qmn_theme_block_<?php echo $slug; ?>" class="mlw_qmn_themeBlock <?php if ($mlw_quiz_options->theme_selected == $slug) {echo 'mlw_qmn_themeBlockActive';} ?>"><?php echo $template["name"]; ?></div>
|
115 |
<?php
|
116 |
-
}
|
117 |
?>
|
118 |
<div onclick="mlw_qmn_theme('default');" id="mlw_qmn_theme_block_default" class="mlw_qmn_themeBlock <?php if ($mlw_quiz_options->theme_selected == 'default') {echo 'mlw_qmn_themeBlockActive';} ?>"><?php _e('Custom', 'quiz-master-next'); ?></div>
|
119 |
<script>
|
34 |
|
35 |
//Save the new css
|
36 |
$mlw_save_stle_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET quiz_stye='%s', theme_selected='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_style, $mlw_qmn_theme, $mlw_qmn_style_id ) );
|
37 |
+
if ( false != $mlw_save_stle_results ) {
|
|
|
38 |
$mlwQuizMasterNext->alertManager->newAlert(__('The style has been saved successfully.', 'quiz-master-next'), 'success');
|
39 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Styles Have Been Saved For Quiz Number $mlw_qmn_style_id" );
|
40 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0015'), 'error');
|
42 |
$mlwQuizMasterNext->log_manager->add("Error 0015", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
43 |
}
|
94 |
?>
|
95 |
<div onclick="mlw_qmn_theme('<?php echo $slug; ?>');" id="mlw_qmn_theme_block_<?php echo $slug; ?>" class="mlw_qmn_themeBlock <?php if ($mlw_quiz_options->theme_selected == $slug) {echo 'mlw_qmn_themeBlockActive';} ?>"><?php echo $template["name"]; ?></div>
|
96 |
<?php
|
97 |
+
}
|
98 |
?>
|
99 |
<div onclick="mlw_qmn_theme('default');" id="mlw_qmn_theme_block_default" class="mlw_qmn_themeBlock <?php if ($mlw_quiz_options->theme_selected == 'default') {echo 'mlw_qmn_themeBlockActive';} ?>"><?php _e('Custom', 'quiz-master-next'); ?></div>
|
100 |
<script>
|
php/options-page-text-tab.php
CHANGED
@@ -97,29 +97,10 @@ function mlw_options_text_tab_content()
|
|
97 |
),
|
98 |
array( '%d' )
|
99 |
);
|
100 |
-
if ($results
|
101 |
-
{
|
102 |
$mlwQuizMasterNext->alertManager->newAlert(__('The templates has been updated successfully.', 'quiz-master-next'), 'success');
|
103 |
-
|
104 |
-
|
105 |
-
global $current_user;
|
106 |
-
get_currentuserinfo();
|
107 |
-
$wpdb->insert(
|
108 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
109 |
-
array(
|
110 |
-
'action_user' => $current_user->display_name,
|
111 |
-
'action' => "Templates Have Been Edited For Quiz Number $quiz_id",
|
112 |
-
'time' => date("h:i:s A m/d/Y")
|
113 |
-
),
|
114 |
-
array(
|
115 |
-
'%s',
|
116 |
-
'%s',
|
117 |
-
'%s'
|
118 |
-
)
|
119 |
-
);
|
120 |
-
}
|
121 |
-
else
|
122 |
-
{
|
123 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0007'), 'error');
|
124 |
$mlwQuizMasterNext->log_manager->add("Error 0007", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
125 |
}
|
97 |
),
|
98 |
array( '%d' )
|
99 |
);
|
100 |
+
if ( false != $results ) {
|
|
|
101 |
$mlwQuizMasterNext->alertManager->newAlert(__('The templates has been updated successfully.', 'quiz-master-next'), 'success');
|
102 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Templates Have Been Edited For Quiz Number $quiz_id" );
|
103 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0007'), 'error');
|
105 |
$mlwQuizMasterNext->log_manager->add("Error 0007", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
106 |
}
|
php/options-page-tools-tab.php
CHANGED
@@ -47,23 +47,7 @@ function mlw_options_tools_tab_content()
|
|
47 |
);
|
48 |
if ( $results ) {
|
49 |
$mlwQuizMasterNext->alertManager->newAlert(__('The stats has been reset successfully.', 'quiz-master-next'), 'success');
|
50 |
-
|
51 |
-
//Insert Action Into Audit Trail
|
52 |
-
global $current_user;
|
53 |
-
get_currentuserinfo();
|
54 |
-
$wpdb->insert(
|
55 |
-
$wpdb->prefix . "mlw_qm_audit_trail",
|
56 |
-
array(
|
57 |
-
'action_user' => $current_user->display_name,
|
58 |
-
'action' => "Quiz Stats Have Been Reset For Quiz Number $mlw_reset_stats_quiz_id",
|
59 |
-
'time' => date("h:i:s A m/d/Y")
|
60 |
-
),
|
61 |
-
array(
|
62 |
-
'%s',
|
63 |
-
'%s',
|
64 |
-
'%s'
|
65 |
-
)
|
66 |
-
);
|
67 |
} else {
|
68 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0010'), 'error');
|
69 |
$mlwQuizMasterNext->log_manager->add("Error 0010", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
47 |
);
|
48 |
if ( $results ) {
|
49 |
$mlwQuizMasterNext->alertManager->newAlert(__('The stats has been reset successfully.', 'quiz-master-next'), 'success');
|
50 |
+
$mlwQuizMasterNext->audit_manager->new_audit( "Quiz Stats Have Been Reset For Quiz Number $mlw_reset_stats_quiz_id" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
} else {
|
52 |
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0010'), 'error');
|
53 |
$mlwQuizMasterNext->log_manager->add("Error 0010", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
php/updates.php
DELETED
@@ -1,433 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
-
/*
|
4 |
-
This is the update function for the plugin. When the plugin gets updated, the database changes are done here. This function is placed in the init of wordpress.
|
5 |
-
*/
|
6 |
-
|
7 |
-
/**
|
8 |
-
* This is the update file for the plugin. All updates to the database happen here.
|
9 |
-
*
|
10 |
-
*@return void
|
11 |
-
* @since 4.4.0
|
12 |
-
*/
|
13 |
-
function mlw_quiz_update()
|
14 |
-
{
|
15 |
-
global $mlwQuizMasterNext;
|
16 |
-
$data = $mlwQuizMasterNext->version;
|
17 |
-
if ( ! get_option('qmn_original_version'))
|
18 |
-
{
|
19 |
-
add_option('qmn_original_version' , $data);
|
20 |
-
}
|
21 |
-
if ( ! get_option('mlw_quiz_master_version'))
|
22 |
-
{
|
23 |
-
add_option('mlw_quiz_master_version' , $data);
|
24 |
-
}
|
25 |
-
elseif (get_option('mlw_quiz_master_version') != $data)
|
26 |
-
{
|
27 |
-
global $wpdb;
|
28 |
-
$table_name = $wpdb->prefix . "mlw_quizzes";
|
29 |
-
//Update 0.5
|
30 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'comment_section'") != "comment_section")
|
31 |
-
{
|
32 |
-
$sql = "ALTER TABLE ".$table_name." ADD comment_field_text TEXT NOT NULL AFTER phone_field_text";
|
33 |
-
$results = $wpdb->query( $sql );
|
34 |
-
$sql = "ALTER TABLE ".$table_name." ADD comment_section INT NOT NULL AFTER admin_email";
|
35 |
-
$results = $wpdb->query( $sql );
|
36 |
-
$sql = "ALTER TABLE ".$table_name." ADD message_comment TEXT NOT NULL AFTER message_after";
|
37 |
-
$results = $wpdb->query( $sql );
|
38 |
-
$update_sql = "UPDATE ".$table_name." SET comment_field_text='Comments', comment_section=1, message_comment='Enter You Text Here'";
|
39 |
-
$results = $wpdb->query( $update_sql );
|
40 |
-
}
|
41 |
-
|
42 |
-
//Update 0.9.2
|
43 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'leaderboard_template'") != "leaderboard_template")
|
44 |
-
{
|
45 |
-
$sql = "ALTER TABLE ".$table_name." ADD leaderboard_template TEXT NOT NULL AFTER comment_field_text";
|
46 |
-
$results = $wpdb->query( $sql );
|
47 |
-
$mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
|
48 |
-
1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
|
49 |
-
2. %SECOND_PLACE_NAME%-%SECOND_PLACE_SCORE%<br />
|
50 |
-
3. %THIRD_PLACE_NAME%-%THIRD_PLACE_SCORE%<br />
|
51 |
-
4. %FOURTH_PLACE_NAME%-%FOURTH_PLACE_SCORE%<br />
|
52 |
-
5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
|
53 |
-
$update_sql = "UPDATE ".$table_name." SET leaderboard_template='".$mlw_leaderboard_default."'";
|
54 |
-
$results = $wpdb->query( $update_sql );
|
55 |
-
}
|
56 |
-
|
57 |
-
//Update 0.9.4
|
58 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'randomness_order'") != "randomness_order")
|
59 |
-
{
|
60 |
-
$sql = "ALTER TABLE ".$table_name." ADD randomness_order INT NOT NULL AFTER system";
|
61 |
-
$results = $wpdb->query( $sql );
|
62 |
-
$update_sql = "UPDATE ".$table_name." SET randomness_order=0";
|
63 |
-
$results = $wpdb->query( $update_sql );
|
64 |
-
}
|
65 |
-
|
66 |
-
//Update 0.9.5
|
67 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_answer_template'") != "question_answer_template")
|
68 |
-
{
|
69 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_answer_template TEXT NOT NULL AFTER comment_field_text";
|
70 |
-
$results = $wpdb->query( $sql );
|
71 |
-
$mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
|
72 |
-
$update_sql = "UPDATE ".$table_name." SET question_answer_template='".$mlw_question_answer_default."'";
|
73 |
-
$results = $wpdb->query( $update_sql );
|
74 |
-
}
|
75 |
-
|
76 |
-
//Update 0.9.6
|
77 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'contact_info_location'") != "contact_info_location")
|
78 |
-
{
|
79 |
-
$sql = "ALTER TABLE ".$table_name." ADD contact_info_location INT NOT NULL AFTER send_admin_email";
|
80 |
-
$results = $wpdb->query( $sql );
|
81 |
-
$update_sql = "UPDATE ".$table_name." SET contact_info_location=0";
|
82 |
-
$results = $wpdb->query( $update_sql );
|
83 |
-
}
|
84 |
-
|
85 |
-
//Update 1.0
|
86 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'email_from_text'") != "email_from_text")
|
87 |
-
{
|
88 |
-
$sql = "ALTER TABLE ".$table_name." ADD email_from_text TEXT NOT NULL AFTER comment_field_text";
|
89 |
-
$results = $wpdb->query( $sql );
|
90 |
-
$update_sql = "UPDATE ".$table_name." SET email_from_text='Wordpress'";
|
91 |
-
$results = $wpdb->query( $update_sql );
|
92 |
-
}
|
93 |
-
|
94 |
-
//Update 1.3.1
|
95 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'loggedin_user_contact'") != "loggedin_user_contact")
|
96 |
-
{
|
97 |
-
$sql = "ALTER TABLE ".$table_name." ADD loggedin_user_contact INT NOT NULL AFTER randomness_order";
|
98 |
-
$results = $wpdb->query( $sql );
|
99 |
-
$update_sql = "UPDATE ".$table_name." SET loggedin_user_contact=0";
|
100 |
-
$results = $wpdb->query( $update_sql );
|
101 |
-
}
|
102 |
-
|
103 |
-
//Update 1.5.1
|
104 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_from_total'") != "question_from_total")
|
105 |
-
{
|
106 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_from_total INT NOT NULL AFTER comment_section";
|
107 |
-
$results = $wpdb->query( $sql );
|
108 |
-
$update_sql = "UPDATE ".$table_name." SET question_from_total=0";
|
109 |
-
$results = $wpdb->query( $update_sql );
|
110 |
-
}
|
111 |
-
|
112 |
-
//Update 1.6.1
|
113 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries'") != "total_user_tries")
|
114 |
-
{
|
115 |
-
$sql = "ALTER TABLE ".$table_name." ADD total_user_tries INT NOT NULL AFTER question_from_total";
|
116 |
-
$results = $wpdb->query( $sql );
|
117 |
-
$update_sql = "UPDATE ".$table_name." SET total_user_tries=0";
|
118 |
-
$results = $wpdb->query( $update_sql );
|
119 |
-
}
|
120 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries_text'") != "total_user_tries_text")
|
121 |
-
{
|
122 |
-
$sql = "ALTER TABLE ".$table_name." ADD total_user_tries_text TEXT NOT NULL AFTER total_user_tries";
|
123 |
-
$results = $wpdb->query( $sql );
|
124 |
-
$update_sql = "UPDATE ".$table_name." SET total_user_tries_text='Enter Your Text Here'";
|
125 |
-
$results = $wpdb->query( $update_sql );
|
126 |
-
}
|
127 |
-
|
128 |
-
//Update 1.8.1
|
129 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'message_end_template'") != "message_end_template")
|
130 |
-
{
|
131 |
-
$sql = "ALTER TABLE ".$table_name." ADD message_end_template TEXT NOT NULL AFTER message_comment";
|
132 |
-
$results = $wpdb->query( $sql );
|
133 |
-
$update_sql = "UPDATE ".$table_name." SET message_end_template=''";
|
134 |
-
$results = $wpdb->query( $update_sql );
|
135 |
-
}
|
136 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'certificate_template'") != "certificate_template")
|
137 |
-
{
|
138 |
-
$sql = "ALTER TABLE ".$table_name." ADD certificate_template TEXT NOT NULL AFTER total_user_tries_text";
|
139 |
-
$results = $wpdb->query( $sql );
|
140 |
-
$update_sql = "UPDATE ".$table_name." SET certificate_template='Enter your text here!'";
|
141 |
-
$results = $wpdb->query( $update_sql );
|
142 |
-
}
|
143 |
-
|
144 |
-
//Update 1.9.1
|
145 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'social_media'") != "social_media")
|
146 |
-
{
|
147 |
-
$sql = "ALTER TABLE ".$table_name." ADD social_media INT NOT NULL AFTER certificate_template";
|
148 |
-
$results = $wpdb->query( $sql );
|
149 |
-
$update_sql = "UPDATE ".$table_name." SET social_media='0'";
|
150 |
-
$results = $wpdb->query( $update_sql );
|
151 |
-
}
|
152 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'social_media_text'") != "social_media_text")
|
153 |
-
{
|
154 |
-
$sql = "ALTER TABLE ".$table_name." ADD social_media_text TEXT NOT NULL AFTER social_media";
|
155 |
-
$results = $wpdb->query( $sql );
|
156 |
-
$update_sql = "UPDATE ".$table_name." SET social_media_text='I just score a %CORRECT_SCORE%% on %QUIZ_NAME%!'";
|
157 |
-
$results = $wpdb->query( $update_sql );
|
158 |
-
}
|
159 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'pagination'") != "pagination")
|
160 |
-
{
|
161 |
-
$sql = "ALTER TABLE ".$table_name." ADD pagination INT NOT NULL AFTER social_media_text";
|
162 |
-
$results = $wpdb->query( $sql );
|
163 |
-
$update_sql = "UPDATE ".$table_name." SET pagination=0";
|
164 |
-
$results = $wpdb->query( $update_sql );
|
165 |
-
}
|
166 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'pagination_text'") != "pagination_text")
|
167 |
-
{
|
168 |
-
$sql = "ALTER TABLE ".$table_name." ADD pagination_text TEXT NOT NULL AFTER pagination";
|
169 |
-
$results = $wpdb->query( $sql );
|
170 |
-
$update_sql = "UPDATE ".$table_name." SET pagination_text='Next'";
|
171 |
-
$results = $wpdb->query( $update_sql );
|
172 |
-
}
|
173 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'timer_limit'") != "timer_limit")
|
174 |
-
{
|
175 |
-
$sql = "ALTER TABLE ".$table_name." ADD timer_limit INT NOT NULL AFTER pagination_text";
|
176 |
-
$results = $wpdb->query( $sql );
|
177 |
-
$update_sql = "UPDATE ".$table_name." SET timer_limit=0";
|
178 |
-
$results = $wpdb->query( $update_sql );
|
179 |
-
}
|
180 |
-
|
181 |
-
//Update 2.1.1
|
182 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'quiz_stye'") != "quiz_stye")
|
183 |
-
{
|
184 |
-
$sql = "ALTER TABLE ".$table_name." ADD quiz_stye TEXT NOT NULL AFTER timer_limit";
|
185 |
-
$results = $wpdb->query( $sql );
|
186 |
-
$mlw_style_default = "
|
187 |
-
div.mlw_qmn_quiz input[type=radio],
|
188 |
-
div.mlw_qmn_quiz input[type=submit],
|
189 |
-
div.mlw_qmn_quiz label {
|
190 |
-
cursor: pointer;
|
191 |
-
}
|
192 |
-
div.mlw_qmn_quiz input:not([type=submit]):focus,
|
193 |
-
div.mlw_qmn_quiz textarea:focus {
|
194 |
-
background: #eaeaea;
|
195 |
-
}
|
196 |
-
div.mlw_qmn_quiz {
|
197 |
-
text-align: left;
|
198 |
-
}
|
199 |
-
div.quiz_section {
|
200 |
-
|
201 |
-
}
|
202 |
-
div.mlw_qmn_timer {
|
203 |
-
position:fixed;
|
204 |
-
top:200px;
|
205 |
-
right:0px;
|
206 |
-
width:130px;
|
207 |
-
color:#00CCFF;
|
208 |
-
border-radius: 15px;
|
209 |
-
background:#000000;
|
210 |
-
text-align: center;
|
211 |
-
padding: 15px 15px 15px 15px
|
212 |
-
}
|
213 |
-
div.mlw_qmn_quiz input[type=submit],
|
214 |
-
a.mlw_qmn_quiz_link
|
215 |
-
{
|
216 |
-
border-radius: 4px;
|
217 |
-
position: relative;
|
218 |
-
background-image: linear-gradient(#fff,#dedede);
|
219 |
-
background-color: #eee;
|
220 |
-
border: #ccc solid 1px;
|
221 |
-
color: #333;
|
222 |
-
text-shadow: 0 1px 0 rgba(255,255,255,.5);
|
223 |
-
box-sizing: border-box;
|
224 |
-
display: inline-block;
|
225 |
-
padding: 5px 5px 5px 5px;
|
226 |
-
margin: auto;
|
227 |
-
}";
|
228 |
-
$update_sql = "UPDATE ".$table_name." SET quiz_stye='".$mlw_style_default."'";
|
229 |
-
$results = $wpdb->query( $update_sql );
|
230 |
-
}
|
231 |
-
|
232 |
-
//Update 2.2.1
|
233 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_numbering'") != "question_numbering")
|
234 |
-
{
|
235 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_numbering INT NOT NULL AFTER quiz_stye";
|
236 |
-
$results = $wpdb->query( $sql );
|
237 |
-
$update_sql = "UPDATE ".$table_name." SET question_numbering='0'";
|
238 |
-
$results = $wpdb->query( $update_sql );
|
239 |
-
}
|
240 |
-
|
241 |
-
//Update 2.8.1
|
242 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'quiz_settings'") != "quiz_settings")
|
243 |
-
{
|
244 |
-
$sql = "ALTER TABLE ".$table_name." ADD quiz_settings TEXT NOT NULL AFTER question_numbering";
|
245 |
-
$results = $wpdb->query( $sql );
|
246 |
-
$update_sql = "UPDATE ".$table_name." SET quiz_settings=''";
|
247 |
-
$results = $wpdb->query( $update_sql );
|
248 |
-
}
|
249 |
-
|
250 |
-
//Update 3.0.1
|
251 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'theme_selected'") != "theme_selected")
|
252 |
-
{
|
253 |
-
$sql = "ALTER TABLE ".$table_name." ADD theme_selected TEXT NOT NULL AFTER quiz_settings";
|
254 |
-
$results = $wpdb->query( $sql );
|
255 |
-
$update_sql = "UPDATE ".$table_name." SET theme_selected='default'";
|
256 |
-
$results = $wpdb->query( $update_sql );
|
257 |
-
}
|
258 |
-
|
259 |
-
//Update 3.3.1
|
260 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'last_activity'") != "last_activity")
|
261 |
-
{
|
262 |
-
$sql = "ALTER TABLE ".$table_name." ADD last_activity DATETIME NOT NULL AFTER theme_selected";
|
263 |
-
$results = $wpdb->query( $sql );
|
264 |
-
$update_sql = "UPDATE ".$table_name." SET last_activity='".date("Y-m-d H:i:s")."'";
|
265 |
-
$results = $wpdb->query( $update_sql );
|
266 |
-
}
|
267 |
-
|
268 |
-
//Update 3.5.1
|
269 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'require_log_in'") != "require_log_in")
|
270 |
-
{
|
271 |
-
$sql = "ALTER TABLE ".$table_name." ADD require_log_in INT NOT NULL AFTER last_activity";
|
272 |
-
$results = $wpdb->query( $sql );
|
273 |
-
$update_sql = "UPDATE ".$table_name." SET require_log_in='0'";
|
274 |
-
$results = $wpdb->query( $update_sql );
|
275 |
-
}
|
276 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'require_log_in_text'") != "require_log_in_text")
|
277 |
-
{
|
278 |
-
$sql = "ALTER TABLE ".$table_name." ADD require_log_in_text TEXT NOT NULL AFTER require_log_in";
|
279 |
-
$results = $wpdb->query( $sql );
|
280 |
-
$update_sql = "UPDATE ".$table_name." SET require_log_in_text='Enter Text Here'";
|
281 |
-
$results = $wpdb->query( $update_sql );
|
282 |
-
}
|
283 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries'") != "limit_total_entries")
|
284 |
-
{
|
285 |
-
$sql = "ALTER TABLE ".$table_name." ADD limit_total_entries INT NOT NULL AFTER require_log_in_text";
|
286 |
-
$results = $wpdb->query( $sql );
|
287 |
-
$update_sql = "UPDATE ".$table_name." SET limit_total_entries='0'";
|
288 |
-
$results = $wpdb->query( $update_sql );
|
289 |
-
}
|
290 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries_text'") != "limit_total_entries_text")
|
291 |
-
{
|
292 |
-
$sql = "ALTER TABLE ".$table_name." ADD limit_total_entries_text TEXT NOT NULL AFTER limit_total_entries";
|
293 |
-
$results = $wpdb->query( $sql );
|
294 |
-
$update_sql = "UPDATE ".$table_name." SET limit_total_entries_text='Enter Text Here'";
|
295 |
-
$results = $wpdb->query( $update_sql );
|
296 |
-
}
|
297 |
-
|
298 |
-
//Update 3.7.1
|
299 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe'") != "scheduled_timeframe")
|
300 |
-
{
|
301 |
-
$sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe TEXT NOT NULL AFTER limit_total_entries_text";
|
302 |
-
$results = $wpdb->query( $sql );
|
303 |
-
$update_sql = "UPDATE ".$table_name." SET scheduled_timeframe=''";
|
304 |
-
$results = $wpdb->query( $update_sql );
|
305 |
-
}
|
306 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe_text'") != "scheduled_timeframe_text")
|
307 |
-
{
|
308 |
-
$sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe_text TEXT NOT NULL AFTER scheduled_timeframe";
|
309 |
-
$results = $wpdb->query( $sql );
|
310 |
-
$update_sql = "UPDATE ".$table_name." SET scheduled_timeframe_text='Enter Text Here'";
|
311 |
-
$results = $wpdb->query( $update_sql );
|
312 |
-
}
|
313 |
-
|
314 |
-
//Update 4.3.0
|
315 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'disable_answer_onselect'") != "disable_answer_onselect")
|
316 |
-
{
|
317 |
-
$sql = "ALTER TABLE ".$table_name." ADD disable_answer_onselect INT NOT NULL AFTER scheduled_timeframe_text";
|
318 |
-
$results = $wpdb->query( $sql );
|
319 |
-
$update_sql = "UPDATE ".$table_name." SET disable_answer_onselect=0";
|
320 |
-
$results = $wpdb->query( $update_sql );
|
321 |
-
}
|
322 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'ajax_show_correct'") != "ajax_show_correct")
|
323 |
-
{
|
324 |
-
$sql = "ALTER TABLE ".$table_name." ADD ajax_show_correct INT NOT NULL AFTER disable_answer_onselect";
|
325 |
-
$results = $wpdb->query( $sql );
|
326 |
-
$update_sql = "UPDATE ".$table_name." SET ajax_show_correct=0";
|
327 |
-
$results = $wpdb->query( $update_sql );
|
328 |
-
}
|
329 |
-
|
330 |
-
global $wpdb;
|
331 |
-
$table_name = $wpdb->prefix . "mlw_questions";
|
332 |
-
//Update 0.5
|
333 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'comments'") != "comments")
|
334 |
-
{
|
335 |
-
$sql = "ALTER TABLE ".$table_name." ADD comments INT NOT NULL AFTER correct_answer";
|
336 |
-
$results = $wpdb->query( $sql );
|
337 |
-
$sql = "ALTER TABLE ".$table_name." ADD hints TEXT NOT NULL AFTER comments";
|
338 |
-
$results = $wpdb->query( $sql );
|
339 |
-
$update_sql = "UPDATE ".$table_name." SET comments=1, hints=''";
|
340 |
-
$results = $wpdb->query( $update_sql );
|
341 |
-
}
|
342 |
-
//Update 0.8
|
343 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_order'") != "question_order")
|
344 |
-
{
|
345 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_order INT NOT NULL AFTER hints";
|
346 |
-
$results = $wpdb->query( $sql );
|
347 |
-
$update_sql = "UPDATE ".$table_name." SET question_order=0";
|
348 |
-
$results = $wpdb->query( $update_sql );
|
349 |
-
}
|
350 |
-
|
351 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_type'") != "question_type")
|
352 |
-
{
|
353 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_type INT NOT NULL AFTER question_order";
|
354 |
-
$results = $wpdb->query( $sql );
|
355 |
-
$update_sql = "UPDATE ".$table_name." SET question_type=0";
|
356 |
-
$results = $wpdb->query( $update_sql );
|
357 |
-
}
|
358 |
-
|
359 |
-
//Update 1.1.1
|
360 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_answer_info'") != "question_answer_info")
|
361 |
-
{
|
362 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_answer_info TEXT NOT NULL AFTER correct_answer";
|
363 |
-
$results = $wpdb->query( $sql );
|
364 |
-
$update_sql = "UPDATE ".$table_name." SET question_answer_info=''";
|
365 |
-
$results = $wpdb->query( $update_sql );
|
366 |
-
}
|
367 |
-
|
368 |
-
//Update 2.5.1
|
369 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'answer_array'") != "answer_array")
|
370 |
-
{
|
371 |
-
$sql = "ALTER TABLE ".$table_name." ADD answer_array TEXT NOT NULL AFTER question_name";
|
372 |
-
$results = $wpdb->query( $sql );
|
373 |
-
$update_sql = "UPDATE ".$table_name." SET answer_array=''";
|
374 |
-
$results = $wpdb->query( $update_sql );
|
375 |
-
}
|
376 |
-
|
377 |
-
//Update 3.1.1
|
378 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_settings'") != "question_settings")
|
379 |
-
{
|
380 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_settings TEXT NOT NULL AFTER question_type";
|
381 |
-
$results = $wpdb->query( $sql );
|
382 |
-
$update_sql = "UPDATE ".$table_name." SET question_settings=''";
|
383 |
-
$results = $wpdb->query( $update_sql );
|
384 |
-
}
|
385 |
-
|
386 |
-
//Update 4.0.0
|
387 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'category'") != "category")
|
388 |
-
{
|
389 |
-
$sql = "ALTER TABLE ".$table_name." ADD category TEXT NOT NULL AFTER question_settings";
|
390 |
-
$results = $wpdb->query( $sql );
|
391 |
-
$update_sql = "UPDATE ".$table_name." SET category=''";
|
392 |
-
$results = $wpdb->query( $update_sql );
|
393 |
-
}
|
394 |
-
|
395 |
-
//Update 4.0.0
|
396 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_type_new'") != "question_type_new")
|
397 |
-
{
|
398 |
-
$sql = "ALTER TABLE ".$table_name." ADD question_type_new TEXT NOT NULL AFTER question_type";
|
399 |
-
$results = $wpdb->query( $sql );
|
400 |
-
$update_sql = "UPDATE ".$table_name." SET question_type_new=question_type";
|
401 |
-
$results = $wpdb->query( $update_sql );
|
402 |
-
}
|
403 |
-
|
404 |
-
//Update 2.6.1
|
405 |
-
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" );
|
406 |
-
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_questions CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
|
407 |
-
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_quizzes CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
|
408 |
-
$results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_results CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
|
409 |
-
|
410 |
-
|
411 |
-
global $wpdb;
|
412 |
-
$table_name = $wpdb->prefix . "mlw_results";
|
413 |
-
//Update 2.6.4
|
414 |
-
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'user'") != "user")
|
415 |
-
{
|
416 |
-
$sql = "ALTER TABLE ".$table_name." ADD user INT NOT NULL AFTER phone";
|
417 |
-
$results = $wpdb->query( $sql );
|
418 |
-
$update_sql = "UPDATE ".$table_name." SET user=0";
|
419 |
-
$results = $wpdb->query( $update_sql );
|
420 |
-
}
|
421 |
-
update_option('mlw_quiz_master_version' , $data);
|
422 |
-
if(!isset($_GET['activate-multi']))
|
423 |
-
{
|
424 |
-
wp_safe_redirect( admin_url( 'index.php?page=mlw_qmn_about' ) );
|
425 |
-
exit;
|
426 |
-
}
|
427 |
-
}
|
428 |
-
if ( ! get_option('mlw_advert_shows'))
|
429 |
-
{
|
430 |
-
add_option('mlw_advert_shows' , 'true');
|
431 |
-
}
|
432 |
-
}
|
433 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: mylocalwebstop, fpcorso, elrath
|
3 |
Donate link: http://mylocalwebstop.com/downloads/donation-service-payment/
|
4 |
Tags: quiz, survey, test, score, exam, questionnaire, email, answer, question, certificate, points, results
|
5 |
-
Requires at least: 4.
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 4.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -104,6 +104,16 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
|
|
104 |
|
105 |
== Changelog ==
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
= 4.7.0 (April 4, 2016) =
|
108 |
* Closed Bug: Slash Added Before Quotation Mark When Editing Quiz/Survey Name - Issue #401
|
109 |
* Closed User Request: Add CSS Class To Container When Timer Runs Out - Issue #400
|
@@ -120,17 +130,9 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
|
|
120 |
* Closed User Request: Add Date Taken Variable - Issue #310
|
121 |
* Closed User Request: Copy Questions Between Quizzes - Issue #166
|
122 |
|
123 |
-
= 4.6.7 (January 22, 2016) =
|
124 |
-
* Fixes bug causing multiple response to be on a single line for some users
|
125 |
-
* Fixes bug causing the incorrect/correct CSS class from being not added on results page correctly
|
126 |
-
* Fixes bug causing unexpected output error when activating plugin
|
127 |
-
* Changes comment section to default to off in newer quizzes
|
128 |
-
* Adds link to online academy to help page
|
129 |
-
* Cleans up installation function code
|
130 |
-
|
131 |
([Read Full Changelog](https://github.com/fpcorso/quiz_master_next/blob/master/CHANGELOG.md))
|
132 |
|
133 |
== Upgrade Notice ==
|
134 |
|
135 |
-
= 4.7.
|
136 |
-
Upgrade to
|
2 |
Contributors: mylocalwebstop, fpcorso, elrath
|
3 |
Donate link: http://mylocalwebstop.com/downloads/donation-service-payment/
|
4 |
Tags: quiz, survey, test, score, exam, questionnaire, email, answer, question, certificate, points, results
|
5 |
+
Requires at least: 4.1
|
6 |
+
Tested up to: 4.5.2
|
7 |
+
Stable tag: 4.7.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
104 |
|
105 |
== Changelog ==
|
106 |
|
107 |
+
= 4.7.1 (May 10, 2016) =
|
108 |
+
* Closed Enhancement: Create new audit trail class - Issue #425
|
109 |
+
* Closed Enhancement: Raise minimum WordPress version to 4.1 - Issue #423
|
110 |
+
* Closed Enhancement: WordPress Compatibility with 4.5.2 - Issue #422
|
111 |
+
* Closed Enhancement: Move installation process into new QSM_Install class - Issue #416
|
112 |
+
* Closed Enhancement: Update links for plugin on Plugins page - Issue #415
|
113 |
+
* Closed Bug: Activating plugin on fresh install causes unexpected output warning - Issue #414
|
114 |
+
* Closed User Request: Shortcode parameter to override amount of questions - Issue #345
|
115 |
+
* Closed Enhancement: Limit per user - upgrade to include non-logged in users - Issue #301
|
116 |
+
|
117 |
= 4.7.0 (April 4, 2016) =
|
118 |
* Closed Bug: Slash Added Before Quotation Mark When Editing Quiz/Survey Name - Issue #401
|
119 |
* Closed User Request: Add CSS Class To Container When Timer Runs Out - Issue #400
|
130 |
* Closed User Request: Add Date Taken Variable - Issue #310
|
131 |
* Closed User Request: Copy Questions Between Quizzes - Issue #166
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
([Read Full Changelog](https://github.com/fpcorso/quiz_master_next/blob/master/CHANGELOG.md))
|
134 |
|
135 |
== Upgrade Notice ==
|
136 |
|
137 |
+
= 4.7.1 =
|
138 |
+
Upgrade to make minor changes and improve limit per user feature
|