| 1 |
<?php |
| 2 |
|
| 3 |
// no direct access! |
| 4 |
defined('ABSPATH') or die("No direct access"); |
| 5 |
|
| 6 |
/* |
| 7 |
Plugin Name: GSpeech |
| 8 |
Plugin URI: https://gspeech.io |
| 9 |
Description: GSpeech is a universal text to speech solution. See <a href="https://gspeech.io/demos">GSpeech Demo</a>. Please <a href="https://gspeech.io/contact-us">Contact Us</a> if you have any questions. |
| 10 |
Author: GSpeech Inc. |
| 11 |
Author URI: https://gspeech.io |
| 12 |
Version: 3.1.7 |
| 13 |
*/ |
| 14 |
|
| 15 |
global $wpdb; |
| 16 |
|
| 17 |
$session_started = session_status() === PHP_SESSION_NONE ? false : true; |
| 18 |
|
| 19 |
if (!$session_started) { |
| 20 |
session_start(); |
| 21 |
} |
| 22 |
|
| 23 |
// 3.0.0 fix |
| 24 |
$gsp_page = isset($_GET['page']) ? $_GET['page'] : ''; |
| 25 |
|
| 26 |
if($gsp_page == 'wpgs-options') { |
| 27 |
|
| 28 |
$gsp_token_inner = bin2hex(random_bytes(32)); |
| 29 |
$g_holder = isset($_GET['holder']) ? $_GET['holder'] : ''; |
| 30 |
|
| 31 |
if($g_holder != 'gs_ajax') { |
| 32 |
$_SESSION["gsp_token_val"] = $gsp_token_inner; |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
$gsp_player_title = 'Click to listen highlighted text!'; |
| 37 |
$plugin_folder_name = 'gspeech'; |
| 38 |
$plugin_version = '3.1.7'; |
| 39 |
|
| 40 |
$wpgs_options = get_option('wpgs_settings'); |
| 41 |
|
| 42 |
if(!$wpgs_options) |
| 43 |
$wpgs_options = array(); |
| 44 |
|
| 45 |
$wpgs_load_sh = 0; |
| 46 |
$sh_ = 0; |
| 47 |
|
| 48 |
$new_db_version = 59; |
| 49 |
define('PLG_VERSION', $plugin_version); |
| 50 |
define('NEW_DB_VER', $new_db_version); |
| 51 |
|
| 52 |
$default_bcp1 = '#ffffff'; |
| 53 |
$default_cp1 = '#111111'; |
| 54 |
$default_bca1 = '#545454'; |
| 55 |
$default_ca1 = '#ffffff'; |
| 56 |
$default_spop1 = 90; |
| 57 |
$default_spop1_ = 0.9; |
| 58 |
$default_spoa1 = 100; |
| 59 |
$default_spoa1_ = 1; |
| 60 |
$default_animation_time_1 = 400; |
| 61 |
$default_speaker_type_1 = 16; |
| 62 |
$default_speaker_size_1 = 1; |
| 63 |
$default_tooltip_1 = 'black'; |
| 64 |
|
| 65 |
$default_bcp2 = '#ffffff'; |
| 66 |
$default_cp2 = '#3284c7'; |
| 67 |
$default_bca2 = '#3284c7'; |
| 68 |
$default_ca2 = '#ffffff'; |
| 69 |
$default_spop2 = 80; |
| 70 |
$default_spop2_ = 0.8; |
| 71 |
$default_spoa2 = 100; |
| 72 |
$default_spoa2_ = 1; |
| 73 |
$default_animation_time_2 = 300; |
| 74 |
$default_speaker_type_2 = 32; |
| 75 |
$default_speaker_size_2 = 1; |
| 76 |
$default_tooltip_2 = 'dark-midnight-blue'; |
| 77 |
|
| 78 |
$default_bcp3 = '#ffffff'; |
| 79 |
$default_cp3 = '#fc0000'; |
| 80 |
$default_bca3 = '#ff3333'; |
| 81 |
$default_ca3 = '#ffffff'; |
| 82 |
$default_spop3 = 90; |
| 83 |
$default_spop3_ = 0.9; |
| 84 |
$default_spoa3 = 100; |
| 85 |
$default_spoa3_ = 1; |
| 86 |
$default_animation_time_3 = 400; |
| 87 |
$default_speaker_type_3 = 33; |
| 88 |
$default_speaker_size_3 = 1; |
| 89 |
$default_tooltip_3 = 'sienna'; |
| 90 |
|
| 91 |
$default_bcp4 = '#ffffff'; |
| 92 |
$default_cp4 = '#0d7300'; |
| 93 |
$default_bca4 = '#0f8901'; |
| 94 |
$default_ca4 = '#ffffff'; |
| 95 |
$default_spop4 = 90; |
| 96 |
$default_spop4_ = 0.9; |
| 97 |
$default_spoa4 = 100; |
| 98 |
$default_spoa4_ = 1; |
| 99 |
$default_animation_time_4 = 400; |
| 100 |
$default_speaker_type_4 = 35; |
| 101 |
$default_speaker_size_4 = 1; |
| 102 |
$default_tooltip_4 = 'apple-green'; |
| 103 |
|
| 104 |
$default_bcp5 = '#ffffff'; |
| 105 |
$default_cp5 = '#ea7d00'; |
| 106 |
$default_bca5 = '#ea7d00'; |
| 107 |
$default_ca5 = '#ffffff'; |
| 108 |
$default_spop5 = 70; |
| 109 |
$default_spop5_ = 0.7; |
| 110 |
$default_spoa5 = 100; |
| 111 |
$default_spoa5_ = 1; |
| 112 |
$default_animation_time_5 = 400; |
| 113 |
$default_speaker_type_5 = 20; |
| 114 |
$default_speaker_size_5 = 1; |
| 115 |
$default_tooltip_5 = 'carrot-orange'; |
| 116 |
|
| 117 |
/****************************** |
| 118 |
* includes |
| 119 |
******************************/ |
| 120 |
|
| 121 |
include('includes/data-processing.php'); |
| 122 |
|
| 123 |
// get gspeech data |
| 124 |
$sql_g = "SELECT * FROM ".$wpdb->prefix."gspeech_data"; |
| 125 |
$row_g = $wpdb->get_row($sql_g); |
| 126 |
$lazy_load = intval($row_g->lazy_load); |
| 127 |
$gsp_widget_id = $row_g->widget_id; |
| 128 |
$gsp_crypto = $row_g->crypto; |
| 129 |
$gsp_reload_session = intval($row_g->reload_session); |
| 130 |
$version_index_1 = intval($row_g->version_index); |
| 131 |
$gsp_user_email = $row_g->email; |
| 132 |
$gsp_user_email = $row_g->email; |
| 133 |
$wpgs_load_sh = intval($row_g->sh_w_loaded); |
| 134 |
$sh_ = intval($row_g->sh_); |
| 135 |
|
| 136 |
$use_old_plugin = isset($wpgs_options['use_old_plugin']) ? $wpgs_options['use_old_plugin'] : 0; |
| 137 |
|
| 138 |
$gsp_widget_id = $use_old_plugin == 1 ? '' : $gsp_widget_id; |
| 139 |
|
| 140 |
$s_enc = ""; |
| 141 |
$h_enc = ""; |
| 142 |
$hh_enc = ""; |
| 143 |
|
| 144 |
if($gsp_reload_session == 1) |
| 145 |
$_SESSION['gsp_index_s'] = ''; |
| 146 |
|
| 147 |
if($gsp_crypto != "" && function_exists('sodium_crypto_sign_detached')) { |
| 148 |
|
| 149 |
if(!isset($_SESSION['gsp_index_s']) || $_SESSION['gsp_index_s'] == '') { |
| 150 |
|
| 151 |
$gsp_crypto_pk = hex2bin($gsp_crypto); |
| 152 |
|
| 153 |
$magic_str = "Simon you are great!"; |
| 154 |
|
| 155 |
$h_enc = bin2hex(random_bytes(32)); |
| 156 |
|
| 157 |
$s_enc = sodium_crypto_box_seal($magic_str, $gsp_crypto_pk); |
| 158 |
$s_enc = bin2hex($s_enc); |
| 159 |
|
| 160 |
$hh_enc = sodium_crypto_box_seal($h_enc, $gsp_crypto_pk); |
| 161 |
$hh_enc = bin2hex($hh_enc); |
| 162 |
|
| 163 |
$_SESSION['gsp_index_s'] = $s_enc; |
| 164 |
$_SESSION['gsp_index_h'] = $h_enc; |
| 165 |
$_SESSION['gsp_index_hh'] = $hh_enc; |
| 166 |
|
| 167 |
} |
| 168 |
else { |
| 169 |
$s_enc = $_SESSION['gsp_index_s']; |
| 170 |
$h_enc = $_SESSION['gsp_index_h']; |
| 171 |
$hh_enc = $_SESSION['gsp_index_hh']; |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
if(isset($_GET['act']) && $_GET['act'] == 'gs_submit_data') { |
| 176 |
|
| 177 |
if(isset($_GET['holder']) && $_GET['holder'] == 'gs_ajax') |
| 178 |
include('includes/admin/gs_ajax.php'); |
| 179 |
|
| 180 |
exit(); |
| 181 |
} |
| 182 |
include('includes/scripts.php'); |
| 183 |
include('includes/display-functions.php'); |
| 184 |
include('includes/admin-page.php'); |
| 185 |
|
| 186 |
// 3.1.4 fix |
| 187 |
if (!$session_started) { |
| 188 |
session_write_close(); |
| 189 |
} |
| 190 |
|
| 191 |
function wpgs_on_uninstall() { |
| 192 |
|
| 193 |
include('includes/install/uninstall.sql.php'); // uninstall |
| 194 |
} |
| 195 |
|
| 196 |
function wpgs_on_install() { |
| 197 |
|
| 198 |
// include('includes/install/install.sql.php'); // install |
| 199 |
} |
| 200 |
|
| 201 |
register_uninstall_hook(__FILE__, 'wpgs_on_uninstall'); |
| 202 |
register_activation_hook(__FILE__, 'wpgs_on_install'); |
| 203 |
|