Google Doc Embedder - Version 2.6.4

Version Description

Tidied up files that were no longer being used by the plugin, and simplified by removing profile editing. The extra legacy code caused a false-positive security alert and caused the plugin to be removed from the repository temporarily.

Download this release

Release Info

Developer danlester
Plugin Icon wp plugin Google Doc Embedder
Version 2.6.4
Comparing to
See all releases

Code changes from version 2.6.3 to 2.6.4

functions-admin.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  if ( ! defined( 'ABSPATH' ) ) { exit; }
4
 
 
 
 
5
  /* PROFILES ****/
6
 
7
  /**
@@ -21,12 +24,10 @@ function gde_form_to_profile( $pid, $data ) {
21
  $profile['tb_fulluser'] = "no";
22
  $profile['tb_print'] = "no";
23
  $profile['vw_flags'] = "";
24
- $profile['link_force'] = "no";
25
- $profile['link_mask'] = "no";
26
  $profile['link_block'] = "no";
27
 
28
- // enforce trailing slash on base_url
29
- $data['base_url'] = trailingslashit( $data['base_url'] );
30
 
31
  // sanitize width/height
32
  $data['default_width'] = gde_sanitize_dims( $data['default_width'] );
@@ -37,11 +38,24 @@ function gde_form_to_profile( $pid, $data ) {
37
  if ( ! $data['default_height'] ) {
38
  $data['default_height'] = $profile['default_height'];
39
  }
 
 
 
 
 
40
 
41
  foreach ( $data as $k => $v ) {
42
- if ( array_key_exists( $k, $profile ) ) {
43
- // all fields where name == profile key
44
- $profile[$k] = stripslashes( $v );
 
 
 
 
 
 
 
 
45
  } elseif ( strstr( $k, 'gdet_' ) && ( strstr( $v, 'gdet_' ) ) ) {
46
  // toolbar checkboxes
47
  if ( $k == 'gdet_h' ) {
@@ -57,10 +71,6 @@ function gde_form_to_profile( $pid, $data ) {
57
  $profile['tb_print'] = "yes";
58
  } elseif ( strstr( $k, 'gdev_' ) && ( strstr( $v, 'gdev_' ) ) ) {
59
  $profile['vw_flags'] .= str_replace( "gdev_", "", $v );
60
- } elseif ( $k == "force" ) {
61
- $profile['link_force'] = "yes";
62
- } elseif ( $k == "mask" ) {
63
- $profile['link_mask'] = "yes";
64
  } elseif ( $k == "block" && gde_is_blockable( $profile ) ) {
65
  $profile['link_block'] = "yes";
66
  }
@@ -75,28 +85,6 @@ function gde_form_to_profile( $pid, $data ) {
75
  }
76
  }
77
 
78
- /**
79
- * Make new profile (from existing)
80
- *
81
- * @since 2.5.0.1
82
- * @return bool Whether or not action successful
83
- */
84
- function gde_profile_to_profile( $sourceid, $name, $desc = '' ) {
85
- global $wpdb;
86
- $table = $wpdb->prefix . 'gde_profiles';
87
-
88
- if ( $sourcedata = $wpdb->get_row( $wpdb->prepare( "SELECT profile_data FROM $table WHERE profile_id = %d", $sourceid ), ARRAY_A ) ) {
89
- $newprofile = array( $name, $desc, $sourcedata['profile_data'] );
90
- if ( gde_write_profile( $newprofile ) > 0 ) {
91
- return true;
92
- } else {
93
- return false;
94
- }
95
- } else {
96
- return false;
97
- }
98
- }
99
-
100
  /**
101
  * Create/update profile
102
  *
@@ -104,29 +92,13 @@ function gde_profile_to_profile( $sourceid, $name, $desc = '' ) {
104
  * @return int 0 = fail, 1 = created, 2 = updated, 3 = nothing to do
105
  * @note data array expected: [0] name, [1] desc, [2] serialized data
106
  */
107
- function gde_write_profile( $data, $id = null, $overwrite = false ) {
108
  global $wpdb;
109
  $table = $wpdb->prefix . 'gde_profiles';
110
 
111
  if ( empty( $id ) ) {
112
- // get profile name
113
- $pname = strtolower( $data[0] );
114
-
115
- // new (non-default) profile
116
- if ( ! $wpdb->insert(
117
- $table,
118
- array(
119
- 'profile_name' => $pname,
120
- 'profile_desc' => $data[1],
121
- 'profile_data' => $data[2]
122
- )
123
- ) ) {
124
- gde_dx_log("Failed to create profile '$pname'");
125
- return 0;
126
- } else {
127
- gde_dx_log("New profile '$pname' created");
128
- return 1;
129
- }
130
  } else {
131
  // new (default) or updated profile
132
  if ( is_null( $wpdb->get_row( "SELECT * FROM $table WHERE profile_id = $id" ) ) ) {
@@ -201,62 +173,6 @@ function gde_write_profile( $data, $id = null, $overwrite = false ) {
201
  }
202
  }
203
 
204
- /**
205
- * Delete profile
206
- *
207
- * @since 2.5.0.1
208
- * @return bool Whether or not action successful
209
- */
210
- function gde_delete_profile( $id ) {
211
- global $wpdb;
212
- $table = $wpdb->prefix . 'gde_profiles';
213
-
214
- if ( $wpdb->query( $wpdb->prepare( "DELETE FROM $table WHERE profile_id = %d", $id ) ) > 0 ) {
215
- return true;
216
- } else {
217
- return false;
218
- }
219
- }
220
-
221
- /**
222
- * Check for duplicate profile name
223
- *
224
- * @since 2.5.0.2
225
- * @return int Profile id of name or -1 if no match
226
- */
227
- function gde_profile_name_exists( $name ) {
228
- global $wpdb;
229
- $table = $wpdb->prefix . 'gde_profiles';
230
-
231
- if ( $id = $wpdb->get_row( $wpdb->prepare( "SELECT profile_id FROM $table WHERE profile_name = %s", $name ), ARRAY_A ) ) {
232
- return (int) $id['profile_id'];
233
- } else {
234
- return -1;
235
- }
236
- }
237
-
238
- /**
239
- * Make existing profile data default (overwrite current default)
240
- *
241
- * @since 2.5.0.1
242
- * @return bool Whether or not action successful
243
- */
244
- function gde_overwrite_profile( $sourceid ) {
245
- global $wpdb;
246
- $table = $wpdb->prefix . 'gde_profiles';
247
-
248
- if ( $data = $wpdb->get_row( $wpdb->prepare( "SELECT profile_data FROM $table WHERE profile_id = %d", $sourceid ), ARRAY_A ) ) {
249
- if ( $wpdb->update ( $table, $data, array( 'profile_id' => 1 ), array( '%s' ) ) ) {
250
- return true;
251
- } else {
252
- return false;
253
- }
254
- } else {
255
- return false;
256
- }
257
- }
258
-
259
-
260
  /* SETTINGS ****/
261
 
262
  /**
@@ -268,7 +184,6 @@ function gde_overwrite_profile( $sourceid ) {
268
  function gde_get_locale() {
269
  $locale = get_locale();
270
 
271
- require_once( GDE_PLUGIN_DIR . 'libs/lib-langs.php' );
272
  return gde_mapped_langs( $locale );
273
  }
274
 
@@ -290,26 +205,6 @@ function gde_options() {
290
  add_action('in_admin_footer', 'gde_admin_footer');
291
  }
292
 
293
- /*
294
- function gde_site_option_page() {
295
- global $gde_global_page;
296
-
297
- $gde_global_page = add_submenu_page( 'settings.php', 'GDE '.__('Settings', 'google-document-embedder'), 'GDE '.__('Settings', 'google-document-embedder'), 'manage_network_options', basename(__FILE__), 'gde_site_options' );
298
-
299
- // enable custom styles and settings jQuery
300
- //add_action( 'admin_print_styles', 'gde_admin_custom_css' );
301
- //add_action( 'admin_enqueue_scripts', 'gde_admin_custom_js' );
302
- }
303
-
304
- function gde_site_options() {
305
- //if ( function_exists('current_user_can') && !current_user_can('manage_options') ) wp_die('You don\'t have access to this page.');
306
- //if (! user_can_access_admin_page()) wp_die( __('You do not have sufficient permissions to access this page', 'google-document-embedder') );
307
-
308
- require( GDE_PLUGIN_DIR . 'site-options.php' );
309
- add_action( 'in_admin_footer', 'gde_admin_footer' );
310
- }
311
- */
312
-
313
  /**
314
  * Get Default Base URL
315
  *
@@ -339,39 +234,6 @@ function gde_show_tab( $name ) {
339
  }
340
  }
341
 
342
- /**
343
- * Reset global (multisite) options
344
- *
345
- * @since 2.5.0.1
346
- * @return void
347
- */
348
- /*
349
- function gde_global_reset() {
350
- global $gdeglobals;
351
-
352
- // by default, global settings are empty
353
- if ($gdeglobals) {
354
- delete_site_option('gde_globals');
355
- }
356
- }
357
- */
358
-
359
- /**
360
- * Delete autoexpire secure docs
361
- *
362
- * @since 2.5.0.1
363
- * @note Runs via wp-cron according to schedule defined in lib-setup
364
- * @return void
365
- */
366
- /*
367
- function gde_sec_cleanup() {
368
- global $wpdb;
369
-
370
- $table = $wpdb->prefix . 'gde_secure';
371
- $wpdb->query( "DELETE FROM $table WHERE autoexpire = 'Y'" );
372
- gde_dx_log("Cleanup ran");
373
- }
374
- */
375
 
376
  /**
377
  * Include custom css for settings pages
@@ -416,11 +278,11 @@ function gde_actlinks( $links ) {
416
  }
417
 
418
  function gde_admin_print_scripts( $arg ) {
419
- global $pagenow;
420
  if (is_admin() && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
421
  $js = GDE_PLUGIN_URL . 'js/gde-quicktags.js';
422
  wp_enqueue_script( 'gde_qts', $js, array('quicktags') );
423
- }
424
  }
425
 
426
  function gde_admin_custom_js( $hook ) {
2
 
3
  if ( ! defined( 'ABSPATH' ) ) { exit; }
4
 
5
+ require_once( GDE_PLUGIN_DIR . 'libs/lib-langs.php' );
6
+
7
+
8
  /* PROFILES ****/
9
 
10
  /**
24
  $profile['tb_fulluser'] = "no";
25
  $profile['tb_print'] = "no";
26
  $profile['vw_flags'] = "";
 
 
27
  $profile['link_block'] = "no";
28
 
29
+ // enforce trailing slash on base_url, also sanitizing it
30
+ $profile['base_url'] = trailingslashit( $data['base_url'] );
31
 
32
  // sanitize width/height
33
  $data['default_width'] = gde_sanitize_dims( $data['default_width'] );
38
  if ( ! $data['default_height'] ) {
39
  $data['default_height'] = $profile['default_height'];
40
  }
41
+
42
+ $profile['default_width'] = $data['default_width'];
43
+ $profile['default_height'] = $data['default_height'];
44
+
45
+ $all_langs = gde_supported_langs();
46
 
47
  foreach ( $data as $k => $v ) {
48
+ if ($k == 'language' && isset($all_langs[$v]) ) {
49
+ $profile[$k] = $v;
50
+ }
51
+ elseif ($k == 'link_pos' && in_array($v, array("above", "below"))) {
52
+ $profile[$k] = $v;
53
+ }
54
+ elseif ($k == 'link_show' && in_array($v, array("all", "users", "none"))) {
55
+ $profile[$k] = $v;
56
+ }
57
+ elseif ($k == 'link_text' && preg_match("|^[A-Za-z0-9 \-_()\%,\.:]+$|", $v)) {
58
+ $profile[$k] = stripslashes($v);
59
  } elseif ( strstr( $k, 'gdet_' ) && ( strstr( $v, 'gdet_' ) ) ) {
60
  // toolbar checkboxes
61
  if ( $k == 'gdet_h' ) {
71
  $profile['tb_print'] = "yes";
72
  } elseif ( strstr( $k, 'gdev_' ) && ( strstr( $v, 'gdev_' ) ) ) {
73
  $profile['vw_flags'] .= str_replace( "gdev_", "", $v );
 
 
 
 
74
  } elseif ( $k == "block" && gde_is_blockable( $profile ) ) {
75
  $profile['link_block'] = "yes";
76
  }
85
  }
86
  }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /**
89
  * Create/update profile
90
  *
92
  * @return int 0 = fail, 1 = created, 2 = updated, 3 = nothing to do
93
  * @note data array expected: [0] name, [1] desc, [2] serialized data
94
  */
95
+ function gde_write_profile( $data, $id, $overwrite = false ) {
96
  global $wpdb;
97
  $table = $wpdb->prefix . 'gde_profiles';
98
 
99
  if ( empty( $id ) ) {
100
+ // No longer create new profiles
101
+ return 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  } else {
103
  // new (default) or updated profile
104
  if ( is_null( $wpdb->get_row( "SELECT * FROM $table WHERE profile_id = $id" ) ) ) {
173
  }
174
  }
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  /* SETTINGS ****/
177
 
178
  /**
184
  function gde_get_locale() {
185
  $locale = get_locale();
186
 
 
187
  return gde_mapped_langs( $locale );
188
  }
189
 
205
  add_action('in_admin_footer', 'gde_admin_footer');
206
  }
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  /**
209
  * Get Default Base URL
210
  *
234
  }
235
  }
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
  /**
239
  * Include custom css for settings pages
278
  }
279
 
280
  function gde_admin_print_scripts( $arg ) {
281
+ /*global $pagenow;
282
  if (is_admin() && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
283
  $js = GDE_PLUGIN_URL . 'js/gde-quicktags.js';
284
  wp_enqueue_script( 'gde_qts', $js, array('quicktags') );
285
+ }*/
286
  }
287
 
288
  function gde_admin_custom_js( $hook ) {
functions.php CHANGED
@@ -276,62 +276,6 @@ function gde_sanitize_dims( $dim ) {
276
  }
277
  }
278
 
279
- /**
280
- * Shorten ("mask") the URL to the embedded file
281
- *
282
- * @since 2.5.0.1
283
- * @return string Short url response from API call, or false on error
284
- */
285
- function gde_get_short_url( $u ) {
286
- return $u; //bypass this function - breaks in current viewer
287
-
288
- $u = urlencode( $u );
289
- $service[] = "http://tinyurl.com/api-create.php?url=" . $u;
290
- $service[] = "http://is.gd/create.php?format=simple&url=" . $u;
291
-
292
- foreach ( $service as $url ) {
293
- $passed = false;
294
- $response = wp_remote_get( $url );
295
- if ( is_wp_error( $response ) || empty ( $response['body'] ) ) {
296
- continue;
297
- } else {
298
- // check for rate limit exceeded or other error response
299
- if ( ! gde_valid_link( $response['body'] ) ) {
300
- continue;
301
- } else {
302
- $passed = true;
303
- break;
304
- }
305
- }
306
- }
307
-
308
- if ( $passed ) {
309
- return $response['body'];
310
- } else {
311
- // can't shorten - return original URL
312
- gde_dx_log("Shorten URL failed: " . urldecode( $u ));
313
- return urldecode( $u );
314
- }
315
- }
316
-
317
- /**
318
- * Request secure URL to document
319
- *
320
- * @since 2.5.0.1
321
- * @return string Secure URL, or false on error
322
- */
323
- function gde_get_secure_url( $u ) {
324
- return $u; //bypass this function - breaks in current viewer
325
-
326
- require_once( GDE_PLUGIN_DIR . 'libs/lib-secure.php' );
327
-
328
- if ( ! $url = gde_make_secure_url( $u ) ) {
329
- return false;
330
- } else {
331
- return $url;
332
- }
333
- }
334
-
335
  /**
336
  * Check if settings allow a file to be privatized (downloads blocked)
337
  *
@@ -339,13 +283,7 @@ function gde_get_secure_url( $u ) {
339
  * @return bool Whether or not the file can be blocked from download
340
  */
341
  function gde_is_blockable( $profile ) {
342
- if ( $profile['viewer'] == "standard" || $profile['link_show'] !== "none" ) {
343
- return false;
344
- } elseif ( ! strstr( $profile['tb_flags'], "n" ) && $profile['tb_fullscr'] == "default" ) {
345
- return false;
346
- } else {
347
- return true;
348
- }
349
  }
350
 
351
  /**
@@ -365,7 +303,7 @@ function gde_ga_event( $file ) {
365
  $action = "'" . strtoupper( $fnp[1] ) . "'";
366
  $label = "this.href";
367
  } else {
368
- $category = "'" . addslashes( $gdeoptions['ga_category'] ) . "'";
369
  $action = "'" . __('Download', 'google-document-embedder') . "'";
370
  if ( $gdeoptions['ga_label'] == "url" ) {
371
  $label = "this.href";
@@ -408,84 +346,7 @@ function gde_get_plugin_data() {
408
  * @return bool Whether or not log write was successful
409
  */
410
  function gde_dx_log( $text ) {
411
- global $gdeoptions, $wpdb;
412
-
413
- if ( GDE_DX_LOGGING > 0 || ( isset( $gdeoptions['error_log'] ) && $gdeoptions['error_log'] == "yes" ) ) {
414
- // filter to trap any "unexpected output" to log
415
- add_action( 'activated_plugin', 'gde_save_error' );
416
-
417
- $table = $wpdb->base_prefix . 'gde_dx_log';
418
-
419
- // create/update table if necessary, then write to log
420
- if ( gde_dx_log_create() ) {
421
- // write to log
422
- $blogid = get_current_blog_id();
423
- $text = date( "d-m-Y, H:i:s" ) . " - $text";
424
-
425
- if ( ! $wpdb->insert(
426
- $table,
427
- array(
428
- 'blogid' => $blogid,
429
- 'data' => $text
430
- ),
431
- array(
432
- '%d', '%s'
433
- )
434
- ) ) {
435
- // couldn't write to db
436
- return false;
437
- } else {
438
- return true;
439
- }
440
- } else {
441
- // can't create db table
442
- return false;
443
- }
444
- } else {
445
- // logging disabled
446
- return false;
447
- }
448
- }
449
-
450
- /**
451
- * Create/update database table to store dx log
452
- *
453
- * @since 2.5.2.1
454
- * @return bool Whether or not table creation/update was successful
455
- */
456
- function gde_dx_log_create() {
457
- global $wpdb, $gde_db_ver;
458
-
459
- $table = $wpdb->base_prefix . 'gde_dx_log';
460
- $db_ver_installed = get_site_option( 'gde_db_version', 0 );
461
-
462
- $sql = "CREATE TABLE " . $table . " (
463
- id mediumint(9) UNSIGNED NOT NULL AUTO_INCREMENT,
464
- blogid smallint(5) UNSIGNED NOT NULL,
465
- data longtext NOT NULL,
466
- UNIQUE KEY (id)
467
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ";
468
-
469
- if ( version_compare( $gde_db_ver, $db_ver_installed, ">" ) ) {
470
- // upgrade table if needed
471
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
472
- dbDelta( $sql );
473
- } elseif ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) == $table ) {
474
- // table's OK
475
- return true;
476
- } else {
477
- // table doesn't exist, try to create
478
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
479
- dbDelta( $sql );
480
-
481
- if ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) == $table ) {
482
- // table's OK
483
- return true;
484
- } else {
485
- // can't create
486
- return false;
487
- }
488
- }
489
  }
490
 
491
  /**
@@ -515,46 +376,5 @@ function gde_show_error( $status ) {
515
  return $code;
516
  }
517
 
518
- /**
519
- * Check health of database tables
520
- *
521
- * @since 2.5.0.3
522
- * @return mixed
523
- * @note Verbose text used in debug information
524
- */
525
- function gde_debug_tables( $table = array('gde_profiles', 'gde_secure'), $verbose = false ) {
526
- global $wpdb;
527
-
528
- if ( is_array( $table ) ) {
529
- $ok = true;
530
- foreach ( $table as $t ) {
531
- $t = $wpdb->prefix . $t;
532
- if ( $wpdb->get_var( "SHOW TABLES LIKE '$t'" ) == $t ) {
533
- // table good
534
- } else {
535
- $ok = false;
536
- gde_dx_log($t . " table missing");
537
- break;
538
- }
539
- }
540
- } else {
541
- $ok = true;
542
- $table = $wpdb->prefix . $table;
543
- if ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) == $table ) {
544
- $s = "OK ";
545
- $c = $wpdb->get_var( "SELECT COUNT(*) FROM $table WHERE 1=1" );
546
- $s = $s . "($c items)";
547
- } else {
548
- $s = "NOT OK ($table missing)";
549
- $ok = false;
550
- }
551
- }
552
-
553
- if ( ! $verbose ) {
554
- return $ok;
555
- } else {
556
- return $s;
557
- }
558
- }
559
 
560
- ?>
276
  }
277
  }
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  /**
280
  * Check if settings allow a file to be privatized (downloads blocked)
281
  *
283
  * @return bool Whether or not the file can be blocked from download
284
  */
285
  function gde_is_blockable( $profile ) {
286
+ return false;
 
 
 
 
 
 
287
  }
288
 
289
  /**
303
  $action = "'" . strtoupper( $fnp[1] ) . "'";
304
  $label = "this.href";
305
  } else {
306
+ $category = "'" . esc_attr( $gdeoptions['ga_category'] ) . "'";
307
  $action = "'" . __('Download', 'google-document-embedder') . "'";
308
  if ( $gdeoptions['ga_label'] == "url" ) {
309
  $label = "this.href";
346
  * @return bool Whether or not log write was successful
347
  */
348
  function gde_dx_log( $text ) {
349
+ return false; // Removed logging
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
  }
351
 
352
  /**
376
  return $code;
377
  }
378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
 
380
+ ?>
gviewer.php CHANGED
@@ -8,7 +8,7 @@ Author: Kevin Davis, Dan Lester
8
  Author URI: https://wordpress.org/plugins/google-document-embedder/
9
  Text Domain: google-document-embedder
10
  Domain Path: /languages/
11
- Version: 2.6.3
12
  License: GPLv2
13
  */
14
 
@@ -38,9 +38,12 @@ License: GPLv2
38
  */
39
 
40
  // boring init junk
41
- $gde_ver = "2.6.3";
42
  $gde_db_ver = "1.2"; // update also in gde_activate()
43
 
 
 
 
44
  require_once( plugin_dir_path( __FILE__ ) . 'functions.php' );
45
  global $wp_version;
46
 
@@ -49,17 +52,11 @@ $gdeoptions = get_option( 'gde_options' );
49
  $gdetypes = gde_supported_types();
50
 
51
  // check for db health
52
- $healthy = gde_debug_tables();
53
 
54
  // add admin functions only if needed
55
  if ( is_admin() ) { require_once( GDE_PLUGIN_DIR . 'functions-admin.php' ); }
56
 
57
- // get global settings - not implemented in this release
58
- /*
59
- if ( is_multisite() ) {
60
- $gdeglobals = get_site_option( 'gde_globals' );
61
- }
62
- */
63
 
64
  // activate plugin, allow clear dx log on deactivate
65
  register_activation_hook( __FILE__, 'gde_activate' );
@@ -70,33 +67,14 @@ add_action( 'plugins_loaded', 'gde_load' );
70
  add_shortcode( 'gview', 'gde_do_shortcode' );
71
 
72
  function gde_do_shortcode( $atts ) {
73
- global $healthy, $gdeoptions; //$gdeglobals
74
-
75
- // check profile table health
76
- if ( ! $healthy ) {
77
- delete_option('gde_db_version');
78
- return gde_show_error( __('Unable to load profile settings', 'google-document-embedder') );
79
- }
80
-
81
- // handle global setting overrides - not active in this release
82
- /*
83
- if ($gdeglobals['enforce_viewer'] == "std") {
84
- $gdeoptions['disable_proxy'] = "yes";
85
- }
86
- if ($gdeglobals['enforce_lang']) {
87
- $gdeoptions['default_lang'] = $gdeglobals['enforce_lang'];
88
- }
89
- */
90
-
91
  extract( shortcode_atts( array (
92
  'file' => '',
93
  'profile' => 1, // default profile is always ID 1
94
  'save' => '',
95
  'width' => '',
96
- 'height' => '',
97
- 'cache' => ''
98
- //'title' => '', // not yet implemented
99
- //'page' => '', // support broken in Google Viewer
100
  ), $atts ) );
101
 
102
  // get requested profile data (or default if doesn't exist)
@@ -133,21 +111,15 @@ function gde_do_shortcode( $atts ) {
133
  $save = $profile['link_show'];
134
  }
135
  }
 
136
  if ( empty( $width ) ) {
137
  $width = $profile['default_width'];
138
  }
139
  if ( empty( $height ) ) {
140
  $height = $profile['default_height'];
141
  }
142
- if ( $cache !== "0" ) {
143
- if ( empty( $cache ) ) {
144
- $cache = $profile['cache'];
145
- }
146
- }
147
- //if ( $profile['language'] !== "en_US" ) {
148
- $lang = $profile['language'];
149
- //}
150
-
151
  // tweak the dimensions if necessary
152
  $width = gde_sanitize_dims( $width );
153
  $height = gde_sanitize_dims( $height );
@@ -203,89 +175,40 @@ function gde_do_shortcode( $atts ) {
203
  }
204
  }
205
 
206
- // generate links (embed, download)
207
- $links = array( $file, $file );
208
- if ( $profile['link_block'] == "yes" && gde_is_blockable( $profile ) ) {
209
- if ( $secure = gde_get_secure_url( $file ) ) {
210
- $links[0] = $secure;
211
- } else {
212
- $links[0] = '';
213
- }
214
- $links[1] = '';
215
- } elseif ( $profile['link_show'] !== "none" ) {
216
- if ( $profile['link_force'] == "yes" && $profile['link_mask'] == "no" ) {
217
- $links[1] = GDE_PLUGIN_URL . "load.php?d=" . urlencode( $links[1] );
218
- } elseif ( $profile['link_force'] == "no" && $profile['link_mask'] == "yes" ) {
219
- $short = gde_get_short_url( $links[0] );
220
- $links[0] = $short;
221
- $links[1] = $short;
222
- } elseif ( $profile['link_force'] == "yes" && $profile['link_mask'] == "yes" ) {
223
- $short = gde_get_short_url( GDE_PLUGIN_URL . "load.php?d=" . urlencode( $links[0] ) );
224
- $links[0] = $short;
225
- $links[1] = $short;
226
- }
227
- }
228
-
229
- // obfuscate filename if cache disabled (globally or via shortcode)
230
- // note that this is ignored if the document is secure to prevent each hit from generating a new db row
231
- if ( ! empty( $links[1] ) && ( $cache == "off" || $cache == "0" ) ) {
232
- $links[0] .= "?" . time();
233
- }
234
-
235
  // check for failed secure doc
236
- if ( empty( $links[0] ) && empty( $links[1] ) ) {
237
- $code = gde_show_error( __('Unable to secure document', 'google-document-embedder') );
238
  } else {
239
 
240
  // which viewer?
241
- //if ( $profile['viewer'] == "enhanced" ) {
242
- // $lnk = GDE_PLUGIN_URL . "view.php?url=" . urlencode( $links[0] ) . "&hl=" . $lang . "&gpid=" . $pid;
243
- // make protocol-agnostic
244
- // $lnk = preg_replace( '/^https?:/i', '', $lnk );
245
- //} else {
246
- $lnk = "//docs.google.com/viewer?url=" . urlencode( $links[0] ) . "&hl=" . $lang;
247
- //}
248
-
249
- // what mode?
250
- //if ( $profile['tb_mobile'] == "always" ) {
251
- // $lnk .= "&mobile=true";
252
- //} else {
253
- $lnk .= "&embedded=true";
254
- //}
255
-
256
  // build viewer
257
  if ( $viewer == false ) {
258
  // exceeds max filesize
259
  $vwr = '';
260
  } else {
261
- $vwr = '<iframe src="%U%" class="gde-frame" style="width:%W%; height:%H%; border: none;"%ATTRS%></iframe>';
262
  $vwr = str_replace("%U%", $lnk, $vwr);
263
- $vwr = str_replace("%W%", $width, $vwr);
264
- $vwr = str_replace("%H%", $height, $vwr);
265
-
266
- // frame attributes
267
- $vattr[] = ' scrolling="no"'; // iphone scrolling bug
268
- //if ( ! empty( $page ) && is_numeric( $page ) ) { // selected starting page
269
- // $page = (int) $page - 1;
270
- // $vattr[] = ' onload="javascript:this.contentWindow.location.hash=\':0.page.' . $page . '\';"';
271
- //}
272
- $vwr = str_replace( "%ATTRS%", implode( '', $vattr ), $vwr );
273
  }
274
 
275
  // show download link?
276
  $allow_save = false;
277
- if ( ! empty( $links[1] ) ) { // link empty = secure document; ignore any other save attribute
278
- if ( $save == "all" || $save == "1" ) {
279
- $allow_save = true;
280
- } elseif ( $save == "users" && is_user_logged_in() ) {
281
- $allow_save = true;
282
- }
283
  }
284
-
285
  if ( $allow_save ) {
286
  // build download link
287
  $linkcode = '<p class="gde-text"><a href="%LINK%" class="gde-link"%ATTRS%>%TXT%</a></p>';
288
- $linkcode = str_replace( "%LINK%", $links[1], $linkcode );
289
 
290
  // fix type
291
  $ftype = strtoupper( $fnp[1] );
@@ -294,9 +217,6 @@ function gde_do_shortcode( $atts ) {
294
  }
295
 
296
  // link attributes
297
- if ( $profile['link_mask'] == "yes" ) {
298
- $attr[] = ' rel="nofollow"';
299
- }
300
  $attr[] = gde_ga_event( $file ); // GA integration
301
  $linkcode = str_replace("%ATTRS%", implode( '', $attr ), $linkcode);
302
 
@@ -335,9 +255,7 @@ if ( is_admin() ) {
335
 
336
  // editor integration
337
  if ( ! isset( $gdeoptions['ed_disable'] ) || $gdeoptions['ed_disable'] == "no" ) {
338
- // add quicktag
339
- add_action( 'admin_print_scripts', 'gde_admin_print_scripts' );
340
-
341
  // add tinymce button
342
  add_action( 'admin_init','gde_mce_addbuttons' );
343
 
@@ -352,11 +270,7 @@ if ( is_admin() ) {
352
 
353
  // add local settings page
354
  add_action( 'admin_menu', 'gde_option_page' );
355
-
356
- //if ( is_multisite() ) {
357
- // add global settings page
358
- //add_action( 'network_admin_menu', 'gde_site_option_page' ); // not present in this release
359
- //}
360
  }
361
 
362
  /**
8
  Author URI: https://wordpress.org/plugins/google-document-embedder/
9
  Text Domain: google-document-embedder
10
  Domain Path: /languages/
11
+ Version: 2.6.4
12
  License: GPLv2
13
  */
14
 
38
  */
39
 
40
  // boring init junk
41
+ $gde_ver = "2.6.4";
42
  $gde_db_ver = "1.2"; // update also in gde_activate()
43
 
44
+ if ( ! defined( 'ABSPATH' ) ) { exit; }
45
+
46
+
47
  require_once( plugin_dir_path( __FILE__ ) . 'functions.php' );
48
  global $wp_version;
49
 
52
  $gdetypes = gde_supported_types();
53
 
54
  // check for db health
55
+ $healthy = true;
56
 
57
  // add admin functions only if needed
58
  if ( is_admin() ) { require_once( GDE_PLUGIN_DIR . 'functions-admin.php' ); }
59
 
 
 
 
 
 
 
60
 
61
  // activate plugin, allow clear dx log on deactivate
62
  register_activation_hook( __FILE__, 'gde_activate' );
67
  add_shortcode( 'gview', 'gde_do_shortcode' );
68
 
69
  function gde_do_shortcode( $atts ) {
70
+ global $gdeoptions;
71
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  extract( shortcode_atts( array (
73
  'file' => '',
74
  'profile' => 1, // default profile is always ID 1
75
  'save' => '',
76
  'width' => '',
77
+ 'height' => ''
 
 
 
78
  ), $atts ) );
79
 
80
  // get requested profile data (or default if doesn't exist)
111
  $save = $profile['link_show'];
112
  }
113
  }
114
+
115
  if ( empty( $width ) ) {
116
  $width = $profile['default_width'];
117
  }
118
  if ( empty( $height ) ) {
119
  $height = $profile['default_height'];
120
  }
121
+ $lang = $profile['language'];
122
+
 
 
 
 
 
 
 
123
  // tweak the dimensions if necessary
124
  $width = gde_sanitize_dims( $width );
125
  $height = gde_sanitize_dims( $height );
175
  }
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  // check for failed secure doc
179
+ if ( empty( $file ) ) {
180
+ $code = gde_show_error( __('File name is empty', 'google-document-embedder') );
181
  } else {
182
 
183
  // which viewer?
184
+
185
+ $lnk = "//docs.google.com/viewer?url=" . urlencode( $file ) . "&hl=" . urlencode($lang);
186
+
187
+ $lnk .= "&embedded=true";
188
+
 
 
 
 
 
 
 
 
 
 
189
  // build viewer
190
  if ( $viewer == false ) {
191
  // exceeds max filesize
192
  $vwr = '';
193
  } else {
194
+ $vwr = '<iframe src="%U%" class="gde-frame" style="width:%W%; height:%H%; border: none;" scrolling="no"></iframe>';
195
  $vwr = str_replace("%U%", $lnk, $vwr);
196
+ $vwr = str_replace("%W%", esc_attr($width), $vwr);
197
+ $vwr = str_replace("%H%", esc_attr($height), $vwr);
 
 
 
 
 
 
 
 
198
  }
199
 
200
  // show download link?
201
  $allow_save = false;
202
+ if ( $save == "all" || $save == "1" ) {
203
+ $allow_save = true;
204
+ } elseif ( $save == "users" && is_user_logged_in() ) {
205
+ $allow_save = true;
 
 
206
  }
207
+
208
  if ( $allow_save ) {
209
  // build download link
210
  $linkcode = '<p class="gde-text"><a href="%LINK%" class="gde-link"%ATTRS%>%TXT%</a></p>';
211
+ $linkcode = str_replace( "%LINK%", $file, $linkcode );
212
 
213
  // fix type
214
  $ftype = strtoupper( $fnp[1] );
217
  }
218
 
219
  // link attributes
 
 
 
220
  $attr[] = gde_ga_event( $file ); // GA integration
221
  $linkcode = str_replace("%ATTRS%", implode( '', $attr ), $linkcode);
222
 
255
 
256
  // editor integration
257
  if ( ! isset( $gdeoptions['ed_disable'] ) || $gdeoptions['ed_disable'] == "no" ) {
258
+
 
 
259
  // add tinymce button
260
  add_action( 'admin_init','gde_mce_addbuttons' );
261
 
270
 
271
  // add local settings page
272
  add_action( 'admin_menu', 'gde_option_page' );
273
+
 
 
 
 
274
  }
275
 
276
  /**
js/dialog.js DELETED
@@ -1,170 +0,0 @@
1
- //tinyMCEPopup.requireLangPack();
2
-
3
- var GDEInsertDialog = {
4
- init : function() {
5
- var f = document.forms[0];
6
- var shortcode;
7
-
8
- jQuery('#url').blur(function(){
9
- update_sc();
10
- check_uri();
11
- update_insert();
12
- });
13
-
14
- jQuery('#profile').change(function(){
15
- update_sc();
16
- });
17
-
18
- //jQuery('.use_defaults').change(function(){
19
- // use_defaults();
20
- //});
21
-
22
- jQuery('#height').blur(function(){
23
- update_sc();
24
- });
25
-
26
- jQuery('#width').blur(function(){
27
- update_sc();
28
- });
29
-
30
- //jQuery('#page').blur(function(){
31
- // update_sc();
32
- //});
33
-
34
- jQuery('.save').click(function(){
35
- update_sc();
36
- });
37
-
38
- jQuery('.disable_cache').click(function(){
39
- update_sc();
40
- });
41
-
42
- function check_uri() {
43
- if ( jQuery('#url').val() !='' ) {
44
- jQuery.getJSON('../libs/lib-exts.php', function(data) {
45
- var types = [];
46
- jQuery.each(data, function(key, val) {
47
- types.push(key);
48
- });
49
-
50
- var alltypes = types.join("|");
51
- var typeCheck = new RegExp("\.(" + alltypes + ")$", "i");
52
- var matches = typeCheck.exec(jQuery('#url').val());
53
- if (matches == null) {
54
- // no matches, unsupported file type
55
- jQuery('#uri-note-file').show();
56
- jQuery('#uri-note-base').hide();
57
- } else {
58
- var path_regex = /^http/i;
59
-
60
- if( !(path_regex.test( jQuery('#url').val() )) ) {
61
- // file base url appended
62
- jQuery('#uri-note-file').hide();
63
- jQuery('#uri-note-base').show();
64
- } else {
65
- jQuery('#uri-note-file').hide();
66
- jQuery('#uri-note-base').hide();
67
- }
68
- }
69
- });
70
- } else {
71
- jQuery('#uri-note-file').hide();
72
- jQuery('#uri-note-base').hide();
73
- }
74
- }
75
-
76
- /*function use_defaults() {
77
- if ( jQuery('.use_defaults').is(':checked') ) {
78
- jQuery('.ovrride').hide();
79
- } else {
80
- jQuery('.ovrride').show();
81
- }
82
- update_sc();
83
- }*/
84
-
85
- function update_insert() {
86
- if ( jQuery('#shortcode').val() !='' ) {
87
- jQuery('#insert').removeAttr('disabled');
88
- jQuery('#insert').removeAttr('class');
89
- } else {
90
- jQuery('#insert').attr('disabled','disabled');
91
- jQuery('#insert').attr('class','disabled');
92
- }
93
- }
94
-
95
- function update_sc() {
96
- shortcode = 'gview';
97
-
98
- if ( jQuery('#url').val() !='' ) {
99
- check_uri();
100
- shortcode = shortcode + ' file="'+jQuery('#url').val()+'"';
101
- } else {
102
- jQuery('#uri-note').html('');
103
- jQuery('#shortcode').val('');
104
- update_insert();
105
- return;
106
- }
107
-
108
- if (( jQuery('#profile').val() != "1" )) {
109
- shortcode = shortcode + ' profile="'+jQuery('#profile').val()+'"';
110
- }
111
-
112
- if ( ! jQuery('.use_defaults').is(':checked') ) {
113
-
114
- var height = jQuery('#height').val();
115
- var width = jQuery('#width').val();
116
-
117
- if ( height != 0 && height != null ) {
118
- height = sanitize(height);
119
- jQuery('#height').val(height);
120
- shortcode = shortcode + ' height="'+height+'"';
121
- }
122
-
123
- if ( width != 0 && width != null ) {
124
- width = sanitize(width);
125
- jQuery('#width').val(width);
126
- shortcode = shortcode + ' width="'+width+'"';
127
- }
128
-
129
- //if (( jQuery('#page').val() != "1" ) & ( jQuery('#page').val() ) !='') {
130
- // shortcode = shortcode + ' page="'+jQuery('#page').val()+'"';
131
- //}
132
-
133
- if ( jQuery("input[name='save']:checked").val() == '1') {
134
- shortcode = shortcode + ' save="1"';
135
- } else if ( jQuery("input[name='save']:checked").val() == '0') {
136
- shortcode = shortcode + ' save="0"';
137
- }
138
-
139
- if ( jQuery('.disable_cache').is(':checked') ) {
140
- shortcode = shortcode + ' cache="0"';
141
- }
142
-
143
- }
144
-
145
- var newsc = shortcode.replace(/ /g,' ');
146
-
147
- jQuery('#shortcode').val('['+newsc+']');
148
- update_insert();
149
- }
150
-
151
- function sanitize( dim ) {
152
- if (dim.indexOf("%") == -1) {
153
- dim = dim.replace(/[^0-9]/g, '');
154
- dim += "px";
155
- } else {
156
- dim = dim.replace(/[^0-9]/g, '');
157
- dim += "%";
158
- }
159
-
160
- return dim;
161
- }
162
- },
163
- insert : function() {
164
- // insert the contents from the input into the document
165
- tinyMCEPopup.editor.execCommand('mceInsertContent', false, jQuery('#shortcode').val());
166
- tinyMCEPopup.close();
167
- }
168
- };
169
-
170
- tinyMCEPopup.onInit.add(GDEInsertDialog.init, GDEInsertDialog);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/editor_plugin.js CHANGED
@@ -6,7 +6,7 @@
6
 
7
  ed.addCommand('gde_cmd', function() {
8
  ed.windowManager.open( {
9
- file : url + '/libs/lib-eddialog.php',
10
  width : 475 + parseInt(ed.getLang('gde.delta_width',0)),
11
  height : 475 + parseInt(ed.getLang('gde.delta_height',0)), // 500 with page option
12
  inline : 1}, {
6
 
7
  ed.addCommand('gde_cmd', function() {
8
  ed.windowManager.open( {
9
+ file : url + '/libs/unsupported.html',
10
  width : 475 + parseInt(ed.getLang('gde.delta_width',0)),
11
  height : 475 + parseInt(ed.getLang('gde.delta_height',0)), // 500 with page option
12
  inline : 1}, {
js/gde-quicktags.js DELETED
@@ -1,7 +0,0 @@
1
- edButtons[edButtons.length] =
2
- new edButton('ed_h1'
3
- ,'GDE' /* LANGGDE */
4
- ,'[gview file="'
5
- ,'"]'
6
- ,'1'
7
- );
 
 
 
 
 
 
 
languages/google-document-embedder-es_ES.po CHANGED
@@ -750,8 +750,8 @@ msgid "Version"
750
  msgstr "Versión"
751
 
752
  #: libs/lib-bootstrap.php:15
753
- msgid "Could not find wp-load.php"
754
- msgstr "No se ha podido encontrar wp-load.php"
755
 
756
  #: libs/tab-support.php:26
757
  msgid "Please review the documentation before submitting a request for support:"
750
  msgstr "Versión"
751
 
752
  #: libs/lib-bootstrap.php:15
753
+ msgid "Could not find wp-hide-load.php"
754
+ msgstr "No se ha podido encontrar wp-hide-load.php"
755
 
756
  #: libs/tab-support.php:26
757
  msgid "Please review the documentation before submitting a request for support:"
languages/google-document-embedder-tr_TR.po CHANGED
@@ -293,8 +293,8 @@ msgid "Open in new window"
293
  msgstr "Yeni pencerede aç"
294
 
295
  #: libs/lib-bootstrap.php:15
296
- msgid "Could not find wp-load.php"
297
- msgstr "Olamaz! wp-load.php dosyasını bulamadık!"
298
 
299
  #: libs/lib-eddialog.php:8
300
  msgid "Access denied."
293
  msgstr "Yeni pencerede aç"
294
 
295
  #: libs/lib-bootstrap.php:15
296
+ msgid "Could not find wp-hide-load.php"
297
+ msgstr "Olamaz! wp-hide-load.php dosyasını bulamadık!"
298
 
299
  #: libs/lib-eddialog.php:8
300
  msgid "Access denied."
libs/lib-bootstrap.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- // define custom path to wp-load.php (usually not necessary)
4
- $path = '';
5
-
6
- // bootstrap for getting ABSPATH constant to wp-load.php outside the admin screen
7
- if ( ! defined( 'WP_LOAD_PATH' ) ) {
8
- $classic_root = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) . '/';
9
- if ( file_exists( $classic_root . 'wp-load.php' ) ) {
10
- define( 'WP_LOAD_PATH', $classic_root );
11
- } else {
12
- if ( file_exists( $path . 'wp-load.php' ) ) {
13
- define( 'WP_LOAD_PATH', $path );
14
-
15
- // standardize current working directory
16
- @chdir( WP_LOAD_PATH );
17
- } else {
18
- exit( 'Could not find wp-load.php' );
19
- }
20
- }
21
- }
22
-
23
- // load wp-load.php
24
- require_once( WP_LOAD_PATH . 'wp-load.php' );
25
-
26
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/lib-eddialog.php DELETED
@@ -1,164 +0,0 @@
1
- <?php
2
-
3
- // make it work with localization (ie cyrillic languages)
4
- header('Content-type: text/html; charset=UTF-8');
5
-
6
- // access wp functions externally
7
- require_once( dirname( __FILE__ ) . '/lib-bootstrap.php');
8
-
9
- // no access if parent plugin is disabled
10
- if ( ! function_exists( 'gde_do_shortcode' ) ) {
11
- wp_die( __('Access denied.', 'google-document-embedder') );
12
- }
13
-
14
- // get profiles
15
- $profiles = gde_get_profiles();
16
-
17
- ?>
18
- <!DOCTYPE html>
19
- <html xmlns="http://www.w3.org/1999/xhtml">
20
- <head>
21
- <title>Google Doc Embedder</title>
22
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
23
- <script language="javascript" type="text/javascript" src="<?php echo includes_url(); ?>js/tinymce/tiny_mce_popup.js"></script>
24
- <script language="javascript" type="text/javascript" src="<?php echo includes_url(); ?>js/jquery/jquery.js"></script>
25
- <script type="text/javascript" src="../js/dialog.js"></script>
26
-
27
- <style type="text/css">
28
- * {
29
- font-family: Arial, Helvetica, sans-serif !important;
30
- font-size: 12px;
31
- }
32
- td, input, textarea, select {
33
- font-size: 12px !important;
34
- }
35
- .note {
36
- font-size: 11px;
37
- color: #333;
38
- }
39
- .mceActionPanel {
40
- margin-top:20px;
41
- }
42
- .disabled {
43
- color: #666 !important;
44
- }
45
- .disabled:hover {
46
- border: 1px solid #BBB !important;
47
- }
48
- </style>
49
-
50
- </head>
51
- <body>
52
-
53
- <form onsubmit="GDEInsertDialog.insert();return false;" action="#" id="gdedialog">
54
-
55
- <p><strong><?php _e('Insert Google Doc Embedder Shortcode', 'google-document-embedder'); ?></strong></p>
56
-
57
- <fieldset>
58
- <legend class="gray dwl_gray"><?php _e('Required', 'google-document-embedder'); ?></legend>
59
- <table width="100%" border="0" cellspacing="0" cellpadding="5">
60
- <tr>
61
- <td align="right" class="gray dwl_gray" style="width:40%;">
62
- <strong><?php _e('URL or Filename', 'google-document-embedder'); ?></strong><br />
63
- <span class="note"><?php _e('Full URL or filename to append to profile Base URL', 'google-document-embedder'); ?></span>
64
- </td>
65
- <td valign="top">
66
- <input name="url" type="text" class="opt dwl" id="url" style="width:220px;" /><br/>
67
- <span id="uri-note-base" style="display:none;color:#2B6FB6;">
68
- <?php _e('Profile Base URL will be prefixed', 'google-document-embedder'); ?>
69
- </span>
70
- <span id="uri-note-file" style="display:none;color:red;">
71
- <?php _e('Unsupported file type', 'google-document-embedder'); ?>
72
- </span>
73
- </td>
74
- </tr>
75
- <tr>
76
- <td align="right" valign="top" class="gray dwl_gray">
77
- <strong><?php _e('Profile', 'google-document-embedder'); ?></strong>
78
- </td>
79
- <td valign="top">
80
- <select name="profile" id="profile">
81
- <?php
82
- foreach ( $profiles as $p ) {
83
- echo "\t\t\t\t<option value=\"".$p['profile_id']."\">".$p['profile_name']."</option>\n";
84
- }
85
- ?>
86
- </select>
87
- <br/>
88
- <span class="note"><?php _e('Select the GDE viewer profile to use', 'google-document-embedder'); ?></span>
89
- </td>
90
- </tr>
91
- </table>
92
- </fieldset>
93
-
94
- <br/>
95
- <fieldset>
96
- <legend class="gray dwl_gray"><?php _e('Optional (Override Profile Settings)', 'google-document-embedder'); ?></legend>
97
- <table width="100%" border="0" cellspacing="0" cellpadding="5">
98
- <!--tr class="switch">
99
- <td colspan="2" class="gray dwl_gray">
100
- <input name="use_defaults" type="checkbox" value="-1" class="use_defaults dwl opt" />
101
- <?php _e('Use selected profile settings', 'google-document-embedder'); ?>
102
- </td>
103
- </tr-->
104
- <tr class="ovrride">
105
- <td align="right" valign="top" class="gray dwl_gray" style="width:40%">
106
- <strong><?php _e('Height', 'google-document-embedder'); ?></strong>
107
- </td>
108
- <td valign="top">
109
- <input name="height" type="text" class="opt dwl" id="height" size="6" />
110
- &nbsp;&nbsp;&nbsp;
111
- <strong><?php _e('Width', 'google-document-embedder'); ?></strong> <input name="width" type="text" class="opt dwl" id="width" size="6" /><br />
112
- <span class="note"><?php _e('Format: 40% or 300px', 'google-document-embedder'); ?></span>
113
- </td>
114
- </tr>
115
- <!--tr class="ovrride">
116
- <td align="right" class="gray dwl_gray">
117
- <strong><?php _e('Start Page #', 'google-document-embedder'); ?></strong>
118
- </td>
119
- <td valign="top">
120
- <input name="page" type="text" class="opt dwl" id="page" size="6" value="1" />
121
- </td>
122
- </tr-->
123
- <tr class="ovrride">
124
- <td align="right" class="gray dwl_gray">
125
- <strong><?php _e('Show Download Link', 'google-document-embedder'); ?></strong>
126
- </td>
127
- <td valign="top" class="gray dwl_gray">
128
- <input name="save" type="radio" class="opt dwl save" value="1" /> <?php _e('Yes', 'google-document-embedder'); ?>
129
- <input name="save" type="radio" class="opt dwl save" value="0" /> <?php _e('No', 'google-document-embedder'); ?>
130
- </td>
131
- </tr>
132
- <tr class="ovrride">
133
- <td colspan="2" class="gray dwl_gray">
134
- <input name="disable_cache" type="checkbox" value="-1" class="disable_cache dwl opt" />
135
- <?php _e('Disable caching (this document is frequently overwritten)', 'google-document-embedder'); ?>
136
- </td>
137
- </tr>
138
- </span>
139
- </table>
140
- </fieldset>
141
-
142
- <table width="100%" border="0" cellspacing="0" cellpadding="5">
143
- <tr>
144
- <td colspan="2">
145
- <br />
146
- <strong><?php _e('Shortcode Preview', 'google-document-embedder'); ?></strong><br/>
147
- <textarea name="shortcode" style="width:100%" id="shortcode" readonly="readonly"></textarea>
148
- </td>
149
- </tr>
150
- </table>
151
-
152
- <div class="mceActionPanel">
153
- <div style="float: left">
154
- <input type="button" id="insert" name="insert" value="<?php _e('Insert', 'google-document-embedder'); ?>" onclick="GDEInsertDialog.insert();" style="color:#222;" class="disabled" disabled="disabled" />
155
- </div>
156
-
157
- <div style="float: right">
158
- <input type="button" id="cancel" name="cancel" value="<?php _e('Cancel', 'google-document-embedder'); ?>" onclick="tinyMCEPopup.close();" />
159
- </div>
160
- </div>
161
- </form>
162
-
163
- </body>
164
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/lib-exts.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  /**
4
  * List supported file types of the viewer
5
  *
@@ -40,4 +43,4 @@ if ( ! isset( $no_output ) ) {
40
  echo $json;
41
  }
42
 
43
- ?>
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) { exit; }
4
+
5
+
6
  /**
7
  * List supported file types of the viewer
8
  *
43
  echo $json;
44
  }
45
 
46
+ ?>
libs/lib-formsubmit.php DELETED
@@ -1,114 +0,0 @@
1
- <?php
2
-
3
- // don't use this form - direct to WP public forums
4
- exit;
5
-
6
- // access wp functions externally
7
- require_once('lib-bootstrap.php');
8
- include_once(ABSPATH . 'wp-includes/pluggable.php'); // required for wp_mail
9
-
10
- if ( ! function_exists('gde_activate') ) {
11
- // no access if parent plugin is disabled
12
- wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
13
- } elseif ( empty( $_POST ) || ! isset( $_POST['email'] ) || empty( $_POST['email'] ) ) {
14
- // fail submit if email not completed
15
- echo "fail";
16
- exit;
17
- } else {
18
-
19
- function gde_change_phpmailer( $phpmailer ) {
20
- // gather settings and profiles
21
- $datasrc = GDE_PLUGIN_URL . 'libs/lib-service.php?json=all';
22
- $response = wp_remote_get( $datasrc );
23
- if ( !is_wp_error( $response ) && strlen( strip_tags( $response['body'] ) ) > 0 ) {
24
- $contents = $response['body'];
25
- $file = "gde-export.txt";
26
- } else {
27
- $contents = "Error attaching export data.";
28
- $file = "export-error.txt";
29
- }
30
- $phpmailer->AddStringAttachment( $contents, $file, 'base64', 'text/plain' );
31
-
32
- // gather dx log
33
- unset( $file );
34
- $blogid = get_current_blog_id();
35
- $datasrc = GDE_PLUGIN_URL . 'libs/lib-service.php?viewlog=all&blogid=' . $blogid;
36
- $response = wp_remote_get( $datasrc );
37
- if ( is_wp_error( $response ) ) {
38
- $contents = "[InternetShortcut]\nURL=" . $datasrc ."\n";
39
- $file = "remote-dx-log.url";
40
- } else if ( strlen( $response['body'] ) > 0 ){
41
- $contents = $response['body'];
42
- $file = "dx-log.txt";
43
- }
44
- if ( isset( $file ) ) {
45
- $phpmailer->AddStringAttachment( $contents, $file, 'base64', 'text/plain' );
46
- }
47
- }
48
-
49
- function gde_change_mail( $mail ) {
50
- return $_POST['email'];
51
- }
52
-
53
- function gde_change_sender( $sendername ) {
54
- if ($_POST['name']) {
55
- return $_POST['name'];
56
- } else {
57
- return "GDE User";
58
- }
59
- }
60
-
61
- add_filter( 'wp_mail_from', 'gde_change_mail', 1 );
62
- add_filter( 'wp_mail_from_name', 'gde_change_sender', 1 );
63
-
64
- /*
65
- * Note to self: wp_mail doesn't deliver to Google Apps (at least in this config).
66
- * It does deliver to regular Gmail, if necessary. Why? Hours wasted.
67
- * Instead, deliver to POP account and let GA pick it up. Boo.
68
- */
69
- $to = "wpp@dev.davismetro.com";
70
-
71
- $subject = "GDE Support Request [#" . uniqid() . "]";
72
-
73
- $headers = "";
74
- if ($_POST['cc'] == "yes") {
75
- $headers .= "CC: " . $_POST['email'] . "\n";
76
- }
77
- $headers .= "Reply-To: <" . $_POST['email'] . ">\n";
78
-
79
- $message = "A request was sent from the GDE Support Form.\n\n";
80
- if ( $_POST['msg'] ) {
81
- $message .= stripslashes( $_POST['msg'] ) . "\n\n";
82
- } else {
83
- $message .= "No message was included.\n\n";
84
- }
85
-
86
- if ( $_POST['sc'] ) {
87
- $message .= "Shortcode: " . stripslashes( $_POST['sc'] ) . "\n\n";
88
- } else {
89
- $message .= "No shortcode was included.\n\n";
90
- }
91
-
92
- if ( $_POST['url'] ) {
93
- $message .= "URL: " . stripslashes( $_POST['url'] ) . "\n\n";
94
- } else {
95
- $message .= "No URL was included.\n\n";
96
- }
97
-
98
- if ( $_POST['senddb'] ) {
99
- $message .= $_POST['senddb'];
100
-
101
- // add debug attachment
102
- add_filter( 'phpmailer_init', 'gde_change_phpmailer' );
103
- } else {
104
- $message .= "No debug info was included.";
105
- }
106
-
107
- if (wp_mail( $to, $subject, $message, $headers )) {
108
- echo "success";
109
- } else {
110
- echo "fail";
111
- }
112
- }
113
-
114
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/lib-langs.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  /**
4
  * List supported languages of the viewer (not the plugin)
5
  *
@@ -122,4 +125,4 @@ function gde_mapped_langs( $locale = '' ) {
122
  }
123
  }
124
 
125
- ?>
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) { exit; }
4
+
5
+
6
  /**
7
  * List supported languages of the viewer (not the plugin)
8
  *
125
  }
126
  }
127
 
128
+ ?>
libs/lib-mobilecheck.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- /*
3
- * Mobile detection adapted from:
4
- * http://detectmobilebrowsers.com/
5
- * This regex ver: 9 September 2013
6
- */
7
-
8
- function gde_is_mobile_browser() {
9
- $useragent = $_SERVER['HTTP_USER_AGENT'];
10
-
11
- if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',
12
- substr( $useragent, 0, 4 ) ) ) {
13
- return true;
14
- } else {
15
- return false;
16
- }
17
- }
18
-
19
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/lib-profile.php CHANGED
@@ -4,33 +4,23 @@
4
  * Outputs profile form (called from multiple places)
5
  */
6
 
 
 
 
7
  function gde_profile_form( $id = 1 ) {
8
- global $healthy;
9
-
10
- // get requested profile
11
- if ( ! $healthy ) {
12
- echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'google-document-embedder') ) . "</p>\n";
13
- } else {
14
- $p = gde_get_profiles( $id );
15
-
16
- // minimize FOUC
17
- if ( $p['viewer'] == "standard" ) {
18
- $hideenh = " hide";
19
- } else {
20
- $hideenh = '';
21
- }
22
-
23
- // setup title & nonce
24
- if ( $id == 1 ) {
25
- $title = __('Default Settings', 'google-document-embedder');
26
- $desc = __('These settings define the default viewer profile, which is used when no other profile is specified.', 'google-document-embedder');
27
- $naction = "update-default-opts";
28
- $nname = "_general_default";
29
- } else {
30
- $title = __('Edit Profile', 'google-document-embedder');
31
- $naction = "update-profile-opts";
32
- $nname = "_profile_edit";
33
- }
34
  ?>
35
 
36
  <div id="profile-form">
@@ -41,128 +31,7 @@ function gde_profile_form( $id = 1 ) {
41
 
42
  <?php gde_help_link( GDE_STDOPT_URL, 'right' ); ?>
43
  <h3><?php echo $title; ?></h3>
44
-
45
- <?php if ( isset( $desc ) ) { echo htmlentities($desc); } ?>
46
 
47
- <table class="form-table">
48
- <tbody>
49
- <tr valign="top">
50
- <th scope="row"><?php _e('Viewer Mode', 'google-document-embedder'); ?></th>
51
- <td>
52
- <select name="viewer" id="viewer">
53
- <?php
54
- gde_profile_option( $p['viewer'], 'standard', __('Standard Viewer', 'google-document-embedder'), __('Embed the basic viewer only', 'google-document-embedder') );
55
- //gde_profile_option( $p['viewer'], 'enhanced', __('Enhanced Viewer', 'google-document-embedder'), __('Enable extended viewer options', 'google-document-embedder') );
56
- ?>
57
- </select><br/>
58
- <span class="gde-fnote" id="viewer-h"></span>
59
-
60
- <p><b>To find out why Enhanced Mode is no longer available, see the notice on our
61
- <a href="https://wordpress.org/plugins/google-document-embedder/" target="_blank">plugin homepage</a>.
62
- </b></p>
63
- </td>
64
- </tr>
65
- </tbody>
66
- </table>
67
- <!--
68
- <fieldset class="gde-inner<?php echo $hideenh; ?>" id="gde-enh-fs">
69
- <legend><?php _e('Enhanced Viewer Settings', 'google-document-embedder'); ?></legend>
70
- <table class="form-table">
71
- <tbody>
72
- <tr valign="top">
73
- <th scope="row"><?php _e('Toolbar', 'google-document-embedder'); ?></th>
74
- <td>
75
- <?php gde_help_link( GDE_ENHOPT_URL, 'right' ); ?>
76
- <?php
77
- gde_profile_checkbox( $p['tb_flags'], 'gdet_h', __('Remove Toolbar', 'google-document-embedder') );
78
- ?>
79
- </td>
80
- </tr>
81
- <tr valign="top" id="mobiletb">
82
- <th scope="row"><?php _e('Use Mobile Toolbar', 'google-document-embedder'); ?></th>
83
- <td>
84
- <select name="tb_mobile" id="tb_mobile">
85
- <?php
86
- gde_profile_option( $p['tb_mobile'], 'default', __('Mobile Devices Only (Default)', 'google-document-embedder'), __('Use mobile toolbar when mobile device detected', 'google-document-embedder') );
87
- gde_profile_option( $p['tb_mobile'], 'always', __('Always', 'google-document-embedder'), __('Use mobile toolbar for all visitors', 'google-document-embedder') );
88
- gde_profile_option( $p['tb_mobile'], 'never', __('Never', 'google-document-embedder'), __('Never use mobile toolbar', 'google-document-embedder') );
89
- ?>
90
- </select><br/>
91
- <span class="gde-fnote" id="mobile-h"></span>
92
- </td>
93
- </tr>
94
- <tr valign="top" id="toolbuttons">
95
- <th scope="row"><?php _e('Toolbar Items', 'google-document-embedder'); ?></th>
96
- <td>
97
- <?php
98
- gde_profile_checkbox( $p['tb_flags'], 'gdet_p', __('Page Numbers', 'google-document-embedder') );
99
- gde_profile_checkbox( $p['tb_flags'], 'gdet_r', __('Previous/Next Page', 'google-document-embedder') );
100
- gde_profile_checkbox( $p['tb_flags'], 'gdet_z', __('Zoom In/Out', 'google-document-embedder') );
101
- gde_profile_checkbox( $p['tb_flags'], 'gdet_n', __('Full Screen/New Window', 'google-document-embedder'), 'allowNewWin' );
102
- ?>
103
- <br/>
104
- <span class="gde-fnote"><?php _e('Uncheck items to remove from toolbar. Buttons will vary based on file type and device used.', 'google-document-embedder'); ?></span>
105
- </td>
106
- </tr>
107
- <tr valign="top" id="fullscreen">
108
- <th scope="row"><?php _e('Full Screen Behavior', 'google-document-embedder'); ?></th>
109
- <td>
110
- <select name="tb_fullscr" id="tb_fullscr">
111
- <?php
112
- gde_profile_option( $p['tb_fullscr'], 'default', __('Google-Hosted Page (Default)', 'google-document-embedder') );
113
- //gde_profile_option( $p['tb_fullscr'], 'branded', __('Custom-Branded Page', 'google-document-embedder') );
114
- gde_profile_option( $p['tb_fullscr'], 'viewer', __('Full Screen Viewer', 'google-document-embedder') );
115
- ?>
116
- </select><br/>
117
-
118
- <?php
119
- gde_profile_checkbox( $p['tb_fullwin'], 'fs_win', __('Open in New Window', 'google-document-embedder') );
120
- gde_profile_checkbox( $p['tb_fulluser'], 'fs_user', __('Allow Logged-in Users Only', 'google-document-embedder'), 'blockAnon' );
121
- //gde_profile_checkbox( $p['tb_print'], 'fs_print', __('Allow Printing', 'google-document-embedder'), 'allowPrint' );
122
- ?>
123
- </td>
124
- </tr>
125
- <tr valign="top" id="bgcolor">
126
- <th scope="row"><?php _e('Page Area Background Color', 'google-document-embedder'); ?></th>
127
- <td>
128
- <?php
129
- gde_profile_text( $p['vw_bgcolor'], 'vw_bgcolor', 'gde-color-field', 10 );
130
- gde_profile_checkbox( $p['vw_flags'], 'gdev_t', __('None (Transparent)', 'google-document-embedder') );
131
- ?>
132
- </td>
133
- </tr>
134
- <tr valign="top" id="pbcolor">
135
- <th scope="row"><?php _e('Page Border Color', 'google-document-embedder'); ?></th>
136
- <td>
137
- <?php
138
- gde_profile_text( $p['vw_pbcolor'], 'vw_pbcolor', 'gde-color-field', 10 );
139
- gde_profile_checkbox( $p['vw_flags'], 'gdev_b', __('No Border', 'google-document-embedder') );
140
- ?>
141
- </td>
142
- </tr>
143
- <tr valign="top" id="cssfile">
144
- <th scope="row"><?php _e('Custom CSS File', 'google-document-embedder'); ?></th>
145
- <td>
146
- <?php
147
- @gde_profile_text( $p['vw_css'], 'vw_css', '', '65' );
148
- ?>
149
- <br/>
150
- <span class="gde-fnote"><?php _e('URL of custom CSS file (may override some of the above options)', 'google-document-embedder'); ?></span>
151
- </td>
152
- </tr>
153
- <tr valign="top" id="docsec">
154
- <th scope="row"><?php _e('Security', 'google-document-embedder'); ?></th>
155
- <td>
156
- <?php
157
- gde_profile_checkbox( $p['vw_flags'], 'gdev_x', __('Hide ability to select/copy/paste text', 'google-document-embedder'), 'hideselect', 1 );
158
- gde_profile_checkbox( $p['link_block'], 'block', __('Block all download requests for file', 'google-document-embedder'), 'linkblock', 1 );
159
- ?>
160
- </td>
161
- </tr>
162
- </tbody>
163
- </table>
164
- </fieldset>
165
- -->
166
  <table class="form-table">
167
  <tbody>
168
  <tr valign="top">
@@ -240,15 +109,6 @@ function gde_profile_form( $id = 1 ) {
240
  </select>
241
  </td>
242
  </tr>
243
- <tr valign="top" id="linkbehavior">
244
- <th scope="row"><?php _e('Link Behavior', 'google-document-embedder'); ?></th>
245
- <td>
246
- <?php
247
- gde_profile_checkbox( $p['link_force'], 'force', __('Force download (bypass browser plugins)', 'google-document-embedder'), 'linkforce', 1 );
248
- //gde_profile_checkbox( $p['link_mask'], 'mask', __('Shorten URL', 'google-document-embedder'), 'linkmask', 1 );
249
- ?>
250
- </td>
251
- </tr>
252
  </tbody>
253
  </table>
254
 
@@ -261,6 +121,5 @@ function gde_profile_form( $id = 1 ) {
261
  </div>
262
 
263
  <?php
264
- }
265
  }
266
- ?>
4
  * Outputs profile form (called from multiple places)
5
  */
6
 
7
+ if ( ! defined( 'ABSPATH' ) ) { exit; }
8
+
9
+
10
  function gde_profile_form( $id = 1 ) {
11
+ $p = gde_get_profiles( $id );
12
+
13
+ // minimize FOUC
14
+ if ( $p['viewer'] == "standard" ) {
15
+ $hideenh = " hide";
16
+ } else {
17
+ $hideenh = '';
18
+ }
19
+
20
+ // setup title & nonce
21
+ $title = __('Default Settings', 'google-document-embedder');
22
+ $naction = "update-default-opts";
23
+ $nname = "_general_default";
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  ?>
25
 
26
  <div id="profile-form">
31
 
32
  <?php gde_help_link( GDE_STDOPT_URL, 'right' ); ?>
33
  <h3><?php echo $title; ?></h3>
 
 
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  <table class="form-table">
36
  <tbody>
37
  <tr valign="top">
109
  </select>
110
  </td>
111
  </tr>
 
 
 
 
 
 
 
 
 
112
  </tbody>
113
  </table>
114
 
121
  </div>
122
 
123
  <?php
 
124
  }
125
+ ?>
libs/lib-secure.php DELETED
@@ -1,78 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Generates and stores "secure" URLs for private documents.
5
- */
6
-
7
- if ( ! function_exists('gde_activate') ) {
8
- // no access if parent plugin is disabled or when accessed directly
9
- wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
10
- }
11
-
12
- /**
13
- * Generate and store secure document link
14
- *
15
- * @since 2.5.0.3
16
- * @return string Secure document link or false on failure
17
- */
18
- function gde_make_secure_url( $url ) {
19
- global $wpdb;
20
-
21
- $table = $wpdb->prefix . 'gde_secure';
22
- $data = $wpdb->get_results( "SELECT * FROM $table WHERE url = '$url'", ARRAY_A );
23
-
24
- if ( ! empty( $data ) ) {
25
- // a secure url to this doc already exists
26
- $data = $data[0];
27
- return $data['murl'];
28
- } else {
29
- // make a new entry
30
- $newcode = gde_secure_code();
31
- $url_to_mask = GDE_PLUGIN_URL . "load.php?s=" . $newcode;
32
- $masked_url = gde_get_short_url( $url_to_mask );
33
-
34
- if ( ! $wpdb->insert(
35
- $table,
36
- array(
37
- 'code' => $newcode,
38
- 'url' => $url,
39
- 'murl' => $masked_url
40
- ),
41
- array(
42
- '%s', '%s', '%s'
43
- )
44
- ) ) {
45
- gde_dx_log("Unable to record secure URL in database");
46
- return false;
47
- } else {
48
- return $masked_url;
49
- }
50
- }
51
- }
52
-
53
- /**
54
- * Generate random document code
55
- *
56
- * @since 2.5.0.1
57
- * @return string Random string used for secure doc link in database
58
- */
59
- function gde_secure_code( $length = 10 ) {
60
- $alpha = 'aeioubdghjmnpqrstvyz';
61
- $alpha .= strtoupper( $alpha );
62
- $numer = '1234567890';
63
-
64
- $code = '';
65
- $alt = time() % 2;
66
- for ( $i = 0; $i < $length; $i++ ) {
67
- if ( $alt == 1 ) {
68
- $code .= $alpha[(rand() % strlen( $alpha ))];
69
- $alt = 0;
70
- } else {
71
- $code .= $numer[(rand() % strlen( $numer ))];
72
- $alt = 1;
73
- }
74
- }
75
- return $code;
76
- }
77
-
78
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/lib-service.php DELETED
@@ -1,95 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * Web service for import/export handling
5
- */
6
-
7
- // access wp functions externally
8
- require_once('lib-bootstrap.php');
9
-
10
- // no access if parent plugin is disabled
11
- if ( ! function_exists('gde_activate') ) {
12
- wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
13
- }
14
-
15
- if ( isset( $_REQUEST['json'] ) ) {
16
- switch ( $_REQUEST['json'] ) {
17
- case "profiles":
18
- if ( isset( $_REQUEST['id'] ) ) {
19
- $profiles = gde_get_profiles( $_REQUEST['id'] );
20
- $suffix = "-" . $_REQUEST['id'];
21
- } else {
22
- $profiles = gde_get_profiles();
23
- $suffix = '';
24
- }
25
-
26
- if ( is_array( $profiles ) ) {
27
- if ( isset( $_REQUEST['save'] ) && $_REQUEST['save'] == "1" ) {
28
- $file = 'gde-profiles' . $suffix;
29
- gde_output_json( json_encode( $profiles ), true, $file );
30
- } else {
31
- gde_output_json( json_encode( $profiles ) );
32
- }
33
- } else {
34
- echo "0";
35
- exit;
36
- }
37
- case "settings":
38
- if ( isset( $_REQUEST['save'] ) && $_REQUEST['save'] == "1" ) {
39
- $file = 'gde-settings';
40
- gde_output_json( json_encode( $gdeoptions ), true, $file );
41
- } else {
42
- gde_output_json( json_encode( $gdeoptions ) );
43
- }
44
- case "all":
45
- $data['profiles'] = gde_get_profiles();
46
- $data['settings'] = $gdeoptions;
47
-
48
- if ( isset( $_REQUEST['save'] ) && $_REQUEST['save'] == "1" ) {
49
- unset( $data['settings']['api_key'] );
50
- $file = 'gde-export';
51
- gde_output_json( json_encode( $data ), true, $file );
52
- } else {
53
- gde_output_json( json_encode( $data ) );
54
- }
55
- default:
56
- wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
57
- }
58
- } elseif ( isset( $_REQUEST['viewlog'] ) ) {
59
- // request to view dx log
60
- global $wpdb;
61
-
62
- $blogid = get_current_blog_id();
63
-
64
- $table = $wpdb->base_prefix . 'gde_dx_log';
65
- $check = $wpdb->query("SHOW TABLES LIKE '" . $table . "'");
66
- //if ( mysql_num_rows( $check ) > 0 ) {
67
- if ( $check ) {
68
- $data = $wpdb->get_col( "SELECT * FROM $table WHERE blogid = '$blogid' ORDER BY id ASC", 2 );
69
- header('Content-type: text/plain');
70
- if ( is_array( $data ) ) {
71
- foreach ( $data as $v ) {
72
- echo $v . "\n";
73
- }
74
- }
75
- }
76
- } else {
77
- wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
78
- }
79
-
80
- /**
81
- * Output/download requested JSON data
82
- *
83
- * @since 2.5.0.2
84
- * @return void
85
- */
86
- function gde_output_json( $json, $save = false, $file = '' ) {
87
- if ( $save && ! empty( $file ) ) {
88
- header('Content-disposition: attachment; filename=' . $file . '.json' );
89
- }
90
- header('Content-type: application/json');
91
- echo $json;
92
- exit;
93
- }
94
-
95
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/lib-setup.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  if ( ! function_exists('gde_activate') ) {
4
  // no access if parent plugin is disabled or when accessed directly
5
  wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
@@ -375,4 +377,4 @@ function gde_db_tables( $gde_db_ver ) {
375
  }
376
  }
377
 
378
- ?>
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) { exit; }
4
+
5
  if ( ! function_exists('gde_activate') ) {
6
  // no access if parent plugin is disabled or when accessed directly
7
  wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
377
  }
378
  }
379
 
380
+ ?>
libs/tab-profiles.php CHANGED
@@ -6,131 +6,10 @@
6
 
7
  if ( ! defined( 'ABSPATH' ) ) { exit; }
8
 
9
- global $healthy;
10
-
11
  if ( isset( $_POST['action'] ) && $_POST['action'] == "edit" ) {
12
  // profile edit request
13
 
14
  require_once( GDE_PLUGIN_DIR . "libs/lib-profile.php" );
15
  gde_profile_form( $_POST['profile'] );
16
- } else {
17
-
18
- // check profile table health
19
- if ( ! $healthy ) {
20
- echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'google-document-embedder') ) . "</p>\n";
21
- } else {
22
- $profiles = gde_get_profiles();
23
-
24
- ?>
25
-
26
- <div id="col-container">
27
- <div id="col-right">
28
- <br>
29
- <div class="col-wrap">
30
- <table class="wp-list-table widefat fixed tags" cellspacing="0">
31
- <thead>
32
- <tr>
33
- <th id="proid" class="manage-column column-proid" scope="col">
34
- <span><?php _e('ID', 'google-document-embedder'); ?></span>
35
- </th>
36
- <th id="proname" class="manage-column column-name" scope="col">
37
- <span><?php _e('Name', 'google-document-embedder'); ?></span>
38
- </th>
39
- <th id="description" class="manage-column column-description" scope="col">
40
- <span><?php _e('Description', 'google-document-embedder'); ?></span>
41
- </th>
42
- </tr>
43
- </thead>
44
- <tfoot>
45
- <tr>
46
- <th class="manage-column column-proid" scope="col">
47
- <span><?php _e('ID', 'google-document-embedder'); ?></span>
48
- </th>
49
- <th class="manage-column column-name" scope="col">
50
- <span><?php _e('Name', 'google-document-embedder'); ?></span>
51
- </th>
52
- <th class="manage-column column-description" scope="col">
53
- <span><?php _e('Description', 'google-document-embedder'); ?></span>
54
- </th>
55
- </tr>
56
- </tfoot>
57
- <tbody id="the-list" class="list:tag">
58
- <?php
59
- foreach ( $profiles as $p ) {
60
- if ( ! isset( $alt ) ) {
61
- $alt = 1;
62
- $cls = ' class="alternate"';
63
- } else {
64
- unset( $alt );
65
- $cls = '';
66
- }
67
- ?>
68
- <tr id="profile-<?php echo esc_attr($p['profile_id']); ?>"<?php echo $cls; ?>>
69
- <td class="proid column-proid">
70
- <strong>
71
- <a href=""><?php echo esc_html($p['profile_id']); ?></a>
72
- </strong><br>
73
- <div class="row-actions" style="padding-bottom: 5px;">
74
- <?php
75
- echo gde_row_actions( $p['profile_id'] );
76
- ?>
77
- </div>
78
- </td>
79
- <td class="name column-name">
80
- <?php echo esc_html($p['profile_name']); ?>
81
- </td>
82
- <td class="description column-description">
83
- <?php _e(esc_html($p['profile_desc']), 'google-document-embedder'); ?>
84
- </td>
85
- </tr>
86
- <?php
87
- }
88
- ?>
89
- </tbody>
90
- </table>
91
-
92
- <?php $tmp = __('Reset Profiles', 'google-document-embedder'); // not implemented yet ?>
93
-
94
- </div>
95
- </div>
96
- <div id="col-left">
97
- <div class="col-wrap">
98
- <div class="form-wrap">
99
- <?php gde_help_link( GDE_PROOPT_URL, 'right' ); ?>
100
- <h3 class="gde-fix-h3"><?php _e('Add New Profile', 'google-document-embedder'); ?></h3>
101
- <form action="" method="post">
102
- <?php wp_nonce_field('create-new-profile', '_profiles_new'); ?>
103
- <div class="form-field">
104
- <label for="profile-name"><?php _e('Name', 'google-document-embedder'); ?></label>
105
- <input id="profile-name" type="text" style="width:45%;" value="" name="profile-name">
106
- <p><?php _e('The name (or ID number) is used to select the profile via the shortcode. It is all lowercase and contains only letters, numbers, and hyphens.', 'google-document-embedder'); ?></p>
107
- </div>
108
- <div class="form-field">
109
- <label for="parent"><?php _e('Parent', 'google-document-embedder'); ?></label>
110
- <select id="parent" class="postform" name="parent">
111
- <?php
112
- foreach ($profiles as $p) {
113
- gde_profile_option( '', $p['profile_id'], $p['profile_name'] );
114
  }
115
- ?>
116
- </select>
117
- <p><?php _e('Select which profile to use as a starting point.', 'google-document-embedder'); ?></p>
118
- </div>
119
- <div class="form-field">
120
- <label for="profile-description"><?php _e('Description', 'google-document-embedder'); ?></label>
121
- <textarea id="profile-description" cols="25" rows="3" name="description"></textarea>
122
- <p><?php _e("Describe the profile's purpose, for your own reference (optional).", 'google-document-embedder'); ?></p>
123
- </div>
124
- <p class="submit">
125
- <input id="profile-submit" class="button" type="submit" value="<?php _e('Add New Profile', 'google-document-embedder'); ?>" name="submit">
126
- </p>
127
- </form>
128
- </div>
129
- </div>
130
- </div>
131
- </div>
132
 
133
- <?php
134
- }
135
- }
136
- ?>
6
 
7
  if ( ! defined( 'ABSPATH' ) ) { exit; }
8
 
 
 
9
  if ( isset( $_POST['action'] ) && $_POST['action'] == "edit" ) {
10
  // profile edit request
11
 
12
  require_once( GDE_PLUGIN_DIR . "libs/lib-profile.php" );
13
  gde_profile_form( $_POST['profile'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
 
 
 
 
libs/tab-support.php DELETED
@@ -1,173 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * Support tab content
5
- */
6
-
7
- // bypass for now - directed to support forums
8
- exit;
9
-
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- exit;
12
- }
13
-
14
- global $pdata, $gde_ver, $wp_version, $gdeoptions, $current_user;
15
-
16
- get_currentuserinfo();
17
- if ( isset( $current_user->user_identity ) ) {
18
- $name = $current_user->user_identity;
19
- } else {
20
- $name = '';
21
- }
22
- if ( isset( $current_user->user_email ) ) {
23
- $email = $current_user->user_email;
24
- } else {
25
- $email = '';
26
- }
27
- ?>
28
-
29
- <div class="gde-support-warn">
30
- <p><strong><?php _e('Most support questions have already been answered. Please review these pages before asking for support:', 'google-document-embedder'); ?></strong></p>
31
- <ul style="list-style-type:square; padding-left:25px;line-height:1em;">
32
- <li><a href="<?php echo $pdata['PluginURI']; ?>/notes/">Google Doc Embedder <?php _e('Help', 'google-document-embedder'); ?></a></li>
33
- <li><a href="<?php echo GDE_WP_URL; ?>faq/"><?php _e('Plugin FAQ', 'google-document-embedder'); ?></a></li>
34
- </ul>
35
- </div>
36
- <br clear="both" />
37
-
38
- <form action="<?php echo GDE_PLUGIN_URL;?>libs/lib-formsubmit.php" id="debugForm">
39
-
40
- <h3><?php _e('Support Request', 'google-document-embedder'); ?></h3>
41
- <p><?php _e("Requests sent from this form are handled by an actual human, so please don't send test messages or other spam.", 'google-document-embedder'); ?></p>
42
-
43
- <table class="form-table">
44
- <tr valign="top">
45
- <th scope="row"><label for="sender_name" id="name_label"><?php _e('Your Name', 'google-document-embedder'); ?></label></th>
46
- <td><input size="25" name="name" id="sender_name" value="<?php echo $name; ?>" type="text"></td>
47
- </tr>
48
- <tr valign="top">
49
- <th scope="row"><label for="sender" id="sender_label"><?php _e('Your E-mail', 'google-document-embedder'); ?>*</label></th>
50
- <td>
51
- <input size="25" name="email" id="sender" value="<?php echo $email; ?>" type="text">
52
- <div id="err_email" class="err" style="color:red;font-weight:bold;display:none;"><?php _e('A valid email address is required.', 'google-document-embedder'); ?></div>
53
- </td>
54
- </tr>
55
- <tr valign="top">
56
- <th scope="row"><label for="sc" id="sc_label"><?php _e('Shortcode', 'google-document-embedder'); ?></label></th>
57
- <td>
58
- <input size="50" name="shortcode" id="sc" value="" type="text" placeholder="[gview file=&quot;...&quot;]"><br/>
59
- <em><?php _e("If you're having a problem getting a specific document to work, paste the shortcode you're trying to use here.", 'google-document-embedder'); ?></em>
60
- </td>
61
- </tr>
62
- <tr valign="top">
63
- <th scope="row"><label for="url" id="url_label"><?php _e('URL', 'google-document-embedder'); ?></label></th>
64
- <td>
65
- <input size="50" name="url" id="url" value="" type="text" placeholder="http://..."><br/>
66
- <em><?php _e("Paste the full web address of a page where I should be able to see the problem occurring.", 'google-document-embedder'); ?></em>
67
- </td>
68
- </tr>
69
- <tr valign="top">
70
- <th scope="row"><label for="msg" id="msg_label"><?php _e('Message', 'google-document-embedder'); ?>*</label></th>
71
- <td>
72
- <textarea name="message" id="msg" style="width:75%;min-height:50px;"></textarea>
73
- </td>
74
- </tr>
75
- <tr valign="top">
76
- <th scope="row"><?php _e('Message Options', 'google-document-embedder'); ?></th>
77
- <td>
78
- <input type="checkbox" name="senddb" id="senddb" checked="checked"> <label for="senddb" id="senddb_label"><?php _e('Send debug information', 'google-document-embedder'); ?></label>
79
- <span id="dbinfo-show">(<a href="javascript:void(0);" id="ta_toggleon"><?php _e('View', 'google-document-embedder'); ?></a>)<br/></span>
80
- <span id="dbinfo-hide" style="display: none;">(<a href="javascript:void(0);" id="ta_toggleoff"><?php _e('Hide', 'google-document-embedder'); ?></a>)<br/></span>
81
- <input type="checkbox" name="cc" id="cc"> <label for="cc" id="cc_label"><?php _e('Send me a copy', 'google-document-embedder'); ?></label>
82
- </td>
83
- </tr>
84
- <tr>
85
- <td colspan="2">
86
- <div id="debugblock" style="display:none;">
87
- <p><strong><?php _e('Debug Information', 'google-document-embedder'); ?>:</strong><br/>
88
- <?php _e('Note: Profile and settings export and diagnostic log (if present) will be attached.', 'google-document-embedder'); ?></p>
89
- <textarea name="debug" id="debugtxt" style="width:100%;min-height:200px;font-family:monospace;" readonly="readonly">
90
- <?php
91
-
92
- echo "=== GDE Debug Information ===\n\n";
93
-
94
- echo "GDE Version: $gde_ver / GDE DB: " . get_site_option( 'gde_db_version', 0 ) . "\n";
95
- echo "Profiles: " . gde_debug_tables( 'gde_profiles', true ) . "\n";
96
- echo "Secure Docs: " . gde_debug_tables( 'gde_secure', true );
97
-
98
- echo "\n\n--- Env ---\n";
99
- echo "WordPress Version: $wp_version [".get_locale()."]\n";
100
- echo "Multisite: ";
101
- if ( is_multisite() ) {
102
- echo "Yes ";
103
- if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
104
- echo "(network activated)\n";
105
- } else {
106
- echo "(not network activated)\n";
107
- }
108
- } else {
109
- echo "No\n";
110
- }
111
- echo "PHP Version: ".phpversion()."\n";
112
- echo "Plugin URL: ".GDE_PLUGIN_URL."\n";
113
- echo "Server Env: ".$_SERVER['SERVER_SOFTWARE']."\n";
114
- echo "Browser Env: ".$_SERVER['HTTP_USER_AGENT']."\n\n";
115
-
116
- echo "cURL: ";
117
- if (function_exists('curl_version')) {
118
- $curl = curl_version(); echo $curl['version']."\n";
119
- } else { echo "No\n"; }
120
-
121
- echo "allow_url_fopen: ";
122
- if (ini_get('allow_url_fopen') !== "1") {
123
- echo "No\n";
124
- } else { echo "Yes\n"; }
125
-
126
- echo "GD: ";
127
- if (extension_loaded('gd')) {
128
- $gd = gd_info(); echo $gd['GD Version']." ";
129
- if ($gd['PNG Support']) {
130
- echo "(PNG Supported)";
131
- } else { echo "(PNG Unsupported)"; }
132
- echo "\n";
133
- } else { echo "No\n"; }
134
-
135
- echo "Rich Editing: ";
136
- if (get_user_option('rich_editing')) {
137
- echo "Yes\n";
138
- } else { echo "No\n"; }
139
-
140
- if (version_compare($wp_version, "3.4", ">") ) {
141
- echo "\n-- Active Theme --\n";
142
- $theme = wp_get_theme();
143
- echo $theme->Name . " " . $theme->Version;
144
- }
145
-
146
- echo "\n\n--- Other Active Plugins ---\n";
147
- $plugins = get_plugins();
148
- foreach ( $plugins as $k => $v ) {
149
- $str = $v['Name'] . " " . $v['Version'];
150
- if ( ! is_plugin_active( $k ) || $v['Name'] == $pdata['Name'] ) {
151
- continue;
152
- }
153
- echo $str . "\n";
154
- }
155
-
156
- echo "</textarea>";
157
- ?>
158
- <br/><br/>
159
- </div>
160
-
161
- <div id="debugwarn" style="display:none;color:red;font-weight:bold;">
162
- <p><?php _e("I'm less likely to be able to help you if you do not include debug information.", 'google-document-embedder'); ?></p>
163
- </div>
164
- <input id="debugsend" class="button-primary" type="submit" value="<?php _e('Send Request', 'google-document-embedder'); ?>" name="submit">
165
- <span id="formstatus" style="padding-left:20px;display:none;">
166
- <img src="<?php echo GDE_PLUGIN_URL;?>img/in-proc.gif" alt="">
167
- </span>
168
- <span id="doneconfirm" style="display: none;"> <?php _e('Request Sent', 'google-document-embedder'); ?></span>
169
- <span id="failconfirm" style="display: none;"> <?php _e('Delivery failed. You can manually send this information to wpp@tnw.org for help.', 'google-document-embedder'); ?></span>
170
- </td>
171
- </tr>
172
- </table>
173
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/unsupported.html ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Unsupported</title>
6
+ </head>
7
+ <body>
8
+ <h2>Google Doc Viewer</h2>
9
+
10
+ <p><b>This plugin is due to be retired.</b> Changes to WordPress and Google's free doc viewer mean that this plugin should be switched for an alternative.</p>
11
+
12
+ <p>Existing gview shortcodes should still work for now.</p>
13
+
14
+ <p>Please see the <a href="https://wordpress.org/plugins/google-document-embedder/" target="_blank">plugin homepage</a> and support forums for suggestions.</p>
15
+
16
+ </body>
17
+ </html>
load.php DELETED
@@ -1,106 +0,0 @@
1
- <?php
2
-
3
- // access wp functions externally
4
- require_once('libs/lib-bootstrap.php');
5
-
6
- // no access if parent plugin is disabled
7
- if ( ! function_exists('gde_activate') ) {
8
- wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
9
- }
10
-
11
- if ( isset( $_GET['d'] ) ) {
12
- // non-secured docs (replaces old pdf.php)
13
- $allowed = true;
14
- $data['url'] = urldecode( $_GET['d'] );
15
- } else {
16
- // secured docs
17
- $allowed = false;
18
-
19
- global $wpdb;
20
- $table = $wpdb->prefix . 'gde_secure';
21
-
22
- if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
23
- $ua = $_SERVER['HTTP_USER_AGENT'];
24
- } else {
25
- $ua = '';
26
- }
27
-
28
- $allowed_ua = array (
29
- 'via docs.google.com/viewer',
30
- 'WordPress',
31
- //'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0'
32
- );
33
-
34
- foreach ( $allowed_ua as $str ) {
35
- if ( strstr( $ua, $str ) !== false ) {
36
- $allowed = true;
37
- break;
38
- } else {
39
- //gde_dx_log("Disallowed secure doc to UA: $ua"); //test
40
- }
41
- }
42
-
43
- if ( ! $allowed || ! isset( $_GET['s'] ) ) {
44
- // file blocked or not defined
45
- wp_die( __('Direct access to this file is not permitted.', 'google-document-embedder') );
46
- } else {
47
- $code = $_GET['s'];
48
- }
49
-
50
- $data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table WHERE code = %s", $code ), ARRAY_A );
51
- $data = $data[0];
52
- }
53
-
54
- // don't cache this, whatever the response
55
- header("Cache-Control: no-store, no-cache, must-revalidate");
56
- header("Cache-Control: post-check=0, pre-check=0", false);
57
- header("Pragma: no-cache");
58
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
59
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
60
-
61
- // attempt to fix filenames with spaces (hatred and loathing)
62
- $url = $data['url'];
63
- if ( strstr( $url, " " ) !== false ) {
64
- $url = str_replace(" ", "%20", $url);
65
- }
66
-
67
- if ( ! empty( $data ) ) {
68
- $contents = wp_remote_fopen( $url );
69
- } else {
70
- // code doesn't exist
71
- wp_die( __('The requested file was not found.', 'google-document-embedder') );
72
- }
73
-
74
- if ( ! $contents || empty( $contents ) ) {
75
- // got nothing of merit
76
- wp_die( __('Unable to open the requested file. ', 'google-document-embedder') );
77
- } else {
78
- global $gdetypes;
79
-
80
- // filename (without query string, in case of non-cached doc)
81
- $fn = strtok( basename( $data['url'] ), '?' );
82
- // get ext
83
- $ext = end( explode( ".", $fn ) );
84
-
85
- if ( isset( $ext ) ) {
86
- $ext = strtolower( $ext );
87
-
88
- // get mime type
89
- if ( array_key_exists( $ext, $gdetypes ) ) {
90
- $type = $gdetypes[$ext];
91
- } else {
92
- wp_die( __('The document file type is not supported.', 'google-document-embedder') );
93
- }
94
- } else {
95
- // file has no extension
96
- wp_die( __('The document file type is not supported.', 'google-document-embedder') );
97
- }
98
-
99
- // output document
100
- header('Content-type: '.$type.'; charset=utf-8');
101
- header('Content-Disposition: attachment; filename="'.$fn.'"');
102
-
103
- echo $contents;
104
- }
105
-
106
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
options.php CHANGED
@@ -1,7 +1,12 @@
1
  <?php
2
 
 
 
 
 
 
 
3
  global $gdeoptions;
4
- $import = false;
5
 
6
  // which form are we submitting (uses nonce for security and identification)
7
  if ( isset( $_POST['_general_default'] ) ) {
@@ -16,66 +21,7 @@ if ( isset( $_POST['_general_default'] ) ) {
16
  } else {
17
  gde_show_msg( __('Unable to update profile.', 'google-document-embedder'), true );
18
  }
19
- } elseif ( isset( $_POST['_profiles_new'] ) ) {
20
-
21
- check_admin_referer('update-profile-opts', '_profile_edit');
22
 
23
- // new profile creation
24
- global $wpdb;
25
- $tabid = "protab";
26
-
27
- if ( ! empty( $_POST['profile-name'] ) ) {
28
- $name = preg_replace( "/[^A-Za-z0-9 -]/", '', trim( $_POST['profile-name'] ) );
29
- $name = strtolower( str_replace( " ", "-", $name ) );
30
-
31
- if ( ! preg_match( '/[\pL]/u', $name ) ) {
32
- // profile name doesn't contain any letter - possible ID conflict
33
- gde_show_msg( __('Profile name must contain at least one letter.', 'google-document-embedder'), true );
34
- } elseif ( gde_profile_name_exists( $name ) !== -1 ) {
35
- // profile name is duplicate
36
- gde_show_msg( __('Profile name already exists. Please choose another name.', 'google-document-embedder'), true );
37
- } elseif ( gde_profile_to_profile( $_POST['parent'], $name, stripslashes( $_POST['description'] ) ) ) {
38
- // intercept and redirect to edit profile page
39
- $lastid = gde_profile_name_exists( $name );
40
- $_POST['action'] = "edit";
41
- $_POST['profile'] = $lastid;
42
- $noload = "gentab";
43
- gde_show_msg( __('New profile <strong>created</strong>.', 'google-document-embedder') );
44
- } else {
45
- gde_show_msg( __('Unable to create profile.', 'google-document-embedder'), true );
46
- }
47
- } else {
48
- gde_show_msg( __('Unable to create profile.', 'google-document-embedder'), true );
49
- }
50
- } elseif ( isset( $_POST['_profile_edit'] ) ) {
51
- // profile edit
52
- $tabid = "protab";
53
-
54
- if ( gde_form_to_profile( $_POST['profile_id'], $_POST ) ) {
55
- // update successful
56
- gde_show_msg( __('Profile <strong>updated</strong>.', 'google-document-embedder') );
57
- } else {
58
- gde_show_msg( __('Unable to update profile.', 'google-document-embedder'), true );
59
- }
60
- } elseif ( isset( $_POST['action'] ) && isset( $_POST['profile'] ) ) {
61
- // profile row action
62
-
63
- if ( $_POST['action'] == "delete" ) {
64
- $tabid = "protab";
65
- if ( gde_delete_profile( $_POST['profile'] ) ) {
66
- gde_show_msg( __('Profile <strong>deleted</strong>.', 'google-document-embedder') );
67
- } else {
68
- gde_show_msg( __('Unable to delete profile.', 'google-document-embedder'), true );
69
- }
70
- } elseif ( $_POST['action'] == "default" ) {
71
- $tabid = "gentab";
72
- if ( gde_overwrite_profile( $_POST['profile'] ) ) {
73
- gde_show_msg( __('Default profile <strong>updated</strong>.', 'google-document-embedder') );
74
- }
75
- } elseif ( $_POST['action'] == "edit" ) {
76
- $tabid = "protab";
77
- $noload = "gentab";
78
- }
79
  } elseif ( isset( $_POST['_advanced'] ) ) {
80
 
81
  check_admin_referer('update-adv-opts', '_advanced');
@@ -114,10 +60,20 @@ if ( isset( $_POST['_general_default'] ) ) {
114
  $gdeoptions[$k] = "no";
115
  }
116
  }
117
- } elseif ( array_key_exists( $k, $gdeoptions ) ) {
118
- // all fields where name == settings key
119
- $gdeoptions[$k] = stripslashes( $v );
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
 
123
  if ( update_option( 'gde_options', $gdeoptions ) ) {
@@ -129,109 +85,33 @@ if ( isset( $_POST['_general_default'] ) ) {
129
  }
130
  }
131
 
132
- // maintain tab on form submission
133
- if ( isset( $tabid ) && ! isset( $noload ) ) {
134
- ?>
135
-
136
- <script type="text/javascript">
137
- jQuery(document).ready(function() {
138
- jQuery('#<?php echo $tabid; ?>').click();
139
- });
140
- </script>
141
-
142
- <?php
143
- }
144
-
145
- if ( ! $import ) {
146
  ?>
147
 
148
  <div class="wrap">
149
  <div class="icon32" id="icon-options-general"></div>
150
  <h2>Google Doc Embedder <?php _e('Settings', 'google-document-embedder'); ?></h2>
151
-
152
- <div id="gdeadmintabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
153
- <ul class="nav-tab-wrapper ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
154
- <?php
155
- if ( ! isset( $noload ) ) {
156
- ?>
157
- <li id="gentab" class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
158
- <a href="#general" class="nav-tab">
159
- <span><?php _e('General', 'google-document-embedder'); ?></span>
160
- </a>
161
- </li>
162
- <li id="protab" class="ui-state-default ui-corner-top">
163
- <a href="#profiles" class="nav-tab">
164
- <span><?php _e('Profiles', 'google-document-embedder'); ?></span>
165
- </a>
166
- </li>
167
- <?php
168
- } else {
169
- ?>
170
- <li id="gentab-reload" class="ui-state-default ui-corner-top">
171
- <a href="#general" class="nav-tab">
172
- <span><?php _e('General', 'google-document-embedder'); ?></span>
173
- </a>
174
- </li>
175
- <li id="protab" class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
176
- <a href="#profiles" class="nav-tab">
177
- <span><?php _e('Profiles', 'google-document-embedder'); ?></span>
178
- </a>
179
- </li>
180
- <?php
181
- }
182
- ?>
183
- <li id="advtab" class="ui-state-default ui-corner-top">
184
- <a href="#advanced" class="nav-tab">
185
- <span><?php _e('Advanced', 'google-document-embedder'); ?></span>
186
- </a>
187
- </li>
188
- <!--li id="suptab" class="ui-state-default ui-corner-top">
189
- <a href="#support" class="nav-tab">
190
- <span><?php _e('Support', 'google-document-embedder'); ?></span>
191
- </a>
192
- </li-->
193
- </ul>
194
- </div>
195
-
196
  <div id="gde-tabcontent">
197
- <?php
198
- if ( ! isset( $noload ) ) {
199
- ?>
200
  <div id="gencontent" class="gde-tab gde-tab-active">
201
  <?php gde_show_tab('general'); ?>
202
  </div>
203
-
204
- <div id="procontent" class="gde-tab">
205
- <?php gde_show_tab('profiles'); ?>
206
- </div>
207
-
208
- <?php
209
- } else {
210
- // don't load gentab content if this is a profile edit (avoid js conflicts)
211
- ?>
212
- <div id="gencontent" class="gde-tab"></div>
213
-
214
- <div id="procontent" class="gde-tab gde-tab-active">
215
- <?php gde_show_tab('profiles'); ?>
216
- </div>
217
- <?php
218
- }
219
- ?>
220
-
221
- <div id="advcontent" class="gde-tab">
222
  <?php gde_show_tab('advanced'); ?>
223
  </div>
224
 
225
- <div id="supcontent" class="gde-tab">
226
- <?php //gde_show_tab('support'); ?>
227
- </div>
228
  </div>
229
 
230
  </div>
231
 
232
  <?php
233
- }
234
-
235
  function gde_opts_checkbox( $field, $label, $wrap = '', $br = '', $disabled = false ) {
236
  global $gdeoptions;
237
 
@@ -351,25 +231,4 @@ function gde_row_cb( $pid ) {
351
  }
352
  }
353
 
354
- function gde_row_actions( $pid ) {
355
- $actions = array(
356
- // action name => arr ( label, class )
357
- "edit" => array( __('Edit', 'google-document-embedder'), 'edit' ),
358
- "delete" => array( __('Delete', 'google-document-embedder'), 'delete' ),
359
- "default" => array( __('Make Default', 'google-document-embedder'), 'default' )
360
- );
361
-
362
- // protect default profile
363
- if ( $pid == 1 ) {
364
- unset( $actions['delete'], $actions['default'] );
365
- }
366
-
367
- foreach ($actions as $k => $v) {
368
- $act[] = '<span class="'.esc_attr($v[1]).'" id="'.esc_attr($k).'-'.esc_attr($pid).'"><a href="options-general.php?page=gde-settings">'.htmlentities($v[0]).'</a></span>';
369
- }
370
- $acts = implode( " | ", $act );
371
-
372
- return $acts;
373
- }
374
-
375
  ?>
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) { exit; }
4
+
5
+ if (!current_user_can('manage_options')) {
6
+ wp_die('Not authorized');
7
+ }
8
+
9
  global $gdeoptions;
 
10
 
11
  // which form are we submitting (uses nonce for security and identification)
12
  if ( isset( $_POST['_general_default'] ) ) {
21
  } else {
22
  gde_show_msg( __('Unable to update profile.', 'google-document-embedder'), true );
23
  }
 
 
 
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  } elseif ( isset( $_POST['_advanced'] ) ) {
26
 
27
  check_admin_referer('update-adv-opts', '_advanced');
60
  $gdeoptions[$k] = "no";
61
  }
62
  }
 
 
 
63
  }
64
+ elseif ( $k == "file_maxsize") {
65
+ $gdeoptions[$k] = intval($v);
66
+ }
67
+ elseif ( $k == "ga_enable" && in_array($v, array("yes", "compat", "no"))) {
68
+ $gdeoptions[$k] = $v;
69
+ }
70
+ elseif ( $k == "ga_label" && in_array($v, array("file", "url"))) {
71
+ $gdeoptions[$k] = $v;
72
+ }
73
+ elseif ( $k == "ga_category" && preg_match("|^[A-Za-z0-9 ()\-_\%]+$|", $v)) {
74
+ $gdeoptions[$k] = $v;
75
+ }
76
+
77
  }
78
 
79
  if ( update_option( 'gde_options', $gdeoptions ) ) {
85
  }
86
  }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  ?>
89
 
90
  <div class="wrap">
91
  <div class="icon32" id="icon-options-general"></div>
92
  <h2>Google Doc Embedder <?php _e('Settings', 'google-document-embedder'); ?></h2>
93
+
94
+ <p><b>This plugin is due to be retired.</b> Changes to WordPress and Google's free doc viewer mean that this plugin should be switched for an alternative.</p>
95
+
96
+ <p>Existing gview shortcodes should still work for now.</p>
97
+
98
+ <p>Please see the <a href="https://wordpress.org/plugins/google-document-embedder/" target="_blank">plugin homepage</a> and support forums for suggestions.</p>
99
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  <div id="gde-tabcontent">
101
+
 
 
102
  <div id="gencontent" class="gde-tab gde-tab-active">
103
  <?php gde_show_tab('general'); ?>
104
  </div>
105
+
106
+ <div id="advcontent" class="gde-tab gde-tab-active">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  <?php gde_show_tab('advanced'); ?>
108
  </div>
109
 
 
 
 
110
  </div>
111
 
112
  </div>
113
 
114
  <?php
 
 
115
  function gde_opts_checkbox( $field, $label, $wrap = '', $br = '', $disabled = false ) {
116
  global $gdeoptions;
117
 
231
  }
232
  }
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  ?>
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Google Doc Embedder ===
2
- Contributors: danlester, k3davis
3
  Tags: doc, docx, pdf, ppt, pptx, xls, office, powerpoint, google, document, embed
4
  Author URI: https://wordpress.org/plugins/google-document-embedder/
5
  Requires at least: 3.5
6
- Tested up to: 4.8
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
 
@@ -63,6 +63,8 @@ Translations:
63
  * Turkish (tr\_TR) by [LettoBlog](http://profiles.wordpress.org/lettoblog "LettoBlog"), thanks!
64
  * Ukrainian (uk) by J&#243;zek, thanks!
65
 
 
 
66
  == Installation ==
67
 
68
  1. Upload the entire `google-document-embedder` folder to the `/wp-content/plugins/` directory.
@@ -143,9 +145,9 @@ If you are able to store your files in Google Drive, you may want to try the [Go
143
 
144
  == Changelog ==
145
 
146
- = 2.6.3 =
147
 
148
- Removed a PHP file that was no longer being used by the plugin - this caused a false-positive security alert and caused
149
  the plugin to be removed from the repository temporarily.
150
 
151
  = 2.6.2 =
1
  === Google Doc Embedder ===
2
+ Contributors: danlester
3
  Tags: doc, docx, pdf, ppt, pptx, xls, office, powerpoint, google, document, embed
4
  Author URI: https://wordpress.org/plugins/google-document-embedder/
5
  Requires at least: 3.5
6
+ Tested up to: 4.9
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
 
63
  * Turkish (tr\_TR) by [LettoBlog](http://profiles.wordpress.org/lettoblog "LettoBlog"), thanks!
64
  * Ukrainian (uk) by J&#243;zek, thanks!
65
 
66
+ **Many thanks to the original author of the plugin, Kevin Davis.**
67
+
68
  == Installation ==
69
 
70
  1. Upload the entire `google-document-embedder` folder to the `/wp-content/plugins/` directory.
145
 
146
  == Changelog ==
147
 
148
+ = 2.6.4 =
149
 
150
+ Tidied up files that were no longer being used by the plugin, and simplified by removing profile editing. The extra legacy code caused a false-positive security alert and caused
151
  the plugin to be removed from the repository temporarily.
152
 
153
  = 2.6.2 =