BackWPup – WordPress Backup Plugin - Version 1.7.4

Version Description

  • jobs not longer work ever... max. time is 5 min.
  • hopfuly fix for dropbox upload
  • fix dropbox auth deletion
  • fixed bug in Sugarsync qouta
Download this release

Release Info

Developer danielhuesken
Plugin Icon 128x128 BackWPup – WordPress Backup Plugin
Version 1.7.4
Comparing to
See all releases

Code changes from version 1.7.3 to 1.7.4

app/backwpup_dojob.php CHANGED
@@ -29,7 +29,7 @@ class backwpup_dojob {
29
  @ini_get('safe_mode','Off'); //disable safe mode
30
  @ini_set('ignore_user_abort','Off'); //Set PHP ini setting
31
  ignore_user_abort(true); //user can't abort script (close windows or so.)
32
- @set_time_limit(0); //set script run time limit to wen its done
33
  $this->jobid=$jobid; //set job id
34
  $this->cfg=get_option('backwpup'); //load config
35
  $jobs=get_option('backwpup_jobs'); //load jobdata
@@ -71,7 +71,7 @@ class backwpup_dojob {
71
  set_error_handler(array($this,'joberrorhandler'),E_ALL & ~E_NOTICE);
72
  //find out if job already running and abort if
73
  if ($jobs[$this->jobid]['starttime']>0 and !empty($jobs[$this->jobid]['logfile'])) {
74
- if ($jobs[$this->jobid]['starttime']+600<current_time('timestamp')) { //Abort old jo if work longer as 10 min. because websever has 300 sec timeout
75
  trigger_error(__('Working Job will closed!!! And a new started!!!','backwpup'),E_USER_WARNING);
76
  //old logfile end
77
  $fd=fopen($jobs[$this->jobid]['logfile'],'a');
@@ -495,7 +495,7 @@ class backwpup_dojob {
495
  foreach($tables as $table) {
496
  trigger_error(__('Dump Database table: ','backwpup').' '.$table,E_USER_NOTICE);
497
  $this->need_free_memory(($status[$table]['Data_length']+$status[$table]['Index_length'])*1.3); //get more memory if needed
498
- fwrite($file, $this->dump_db_table($table,$status[$table],$file));
499
  }
500
  //for better import with mysql client
501
  fwrite($file, "\n");
@@ -1329,7 +1329,7 @@ class backwpup_dojob {
1329
  if (!empty($user->nickname)) {
1330
  trigger_error(__('Authed to SugarSync with Nick ','backwpup').$user->nickname,E_USER_NOTICE);
1331
  }
1332
- $sugarsyncfreespase=$user->quota->limit-$user->quota->usage;
1333
  if (filesize($this->backupdir.$this->backupfile)>$sugarsyncfreespase) {
1334
  trigger_error(__('No free space left on SugarSync!!!','backwpup'),E_USER_ERROR);
1335
  return;
29
  @ini_get('safe_mode','Off'); //disable safe mode
30
  @ini_set('ignore_user_abort','Off'); //Set PHP ini setting
31
  ignore_user_abort(true); //user can't abort script (close windows or so.)
32
+ @set_time_limit(300); //set script run time limit to wen its done
33
  $this->jobid=$jobid; //set job id
34
  $this->cfg=get_option('backwpup'); //load config
35
  $jobs=get_option('backwpup_jobs'); //load jobdata
71
  set_error_handler(array($this,'joberrorhandler'),E_ALL & ~E_NOTICE);
72
  //find out if job already running and abort if
73
  if ($jobs[$this->jobid]['starttime']>0 and !empty($jobs[$this->jobid]['logfile'])) {
74
+ if ($jobs[$this->jobid]['starttime']+301<current_time('timestamp')) { //Abort old jo if work longer as 10 min. because websever has 300 sec timeout
75
  trigger_error(__('Working Job will closed!!! And a new started!!!','backwpup'),E_USER_WARNING);
76
  //old logfile end
77
  $fd=fopen($jobs[$this->jobid]['logfile'],'a');
495
  foreach($tables as $table) {
496
  trigger_error(__('Dump Database table: ','backwpup').' '.$table,E_USER_NOTICE);
497
  $this->need_free_memory(($status[$table]['Data_length']+$status[$table]['Index_length'])*1.3); //get more memory if needed
498
+ $this->dump_db_table($table,$status[$table],$file);
499
  }
500
  //for better import with mysql client
501
  fwrite($file, "\n");
1329
  if (!empty($user->nickname)) {
1330
  trigger_error(__('Authed to SugarSync with Nick ','backwpup').$user->nickname,E_USER_NOTICE);
1331
  }
1332
+ $sugarsyncfreespase=(float)$user->quota->limit-(float)$user->quota->usage;
1333
  if (filesize($this->backupdir.$this->backupfile)>$sugarsyncfreespase) {
1334
  trigger_error(__('No free space left on SugarSync!!!','backwpup'),E_USER_ERROR);
1335
  return;
app/compatibility/class-wp-list-table.php DELETED
@@ -1,987 +0,0 @@
1
- <?php
2
- /**
3
- * Base class for displaying a list of items in an ajaxified HTML table.
4
- *
5
- * @package WordPress
6
- * @subpackage List_Table
7
- * @since 3.1.0
8
- */
9
-
10
- /**
11
- * Base class for displaying a list of items in an ajaxified HTML table.
12
- *
13
- * @package WordPress
14
- * @subpackage List_Table
15
- * @since 3.1.0
16
- * @access private
17
- */
18
- class WP_List_Table {
19
-
20
- /**
21
- * The current list of items
22
- *
23
- * @since 3.1.0
24
- * @var array
25
- * @access protected
26
- */
27
- var $items;
28
-
29
- /**
30
- * Various information about the current table
31
- *
32
- * @since 3.1.0
33
- * @var array
34
- * @access private
35
- */
36
- var $_args;
37
-
38
- /**
39
- * Various information needed for displaying the pagination
40
- *
41
- * @since 3.1.0
42
- * @var array
43
- * @access private
44
- */
45
- var $_pagination_args = array();
46
-
47
- /**
48
- * The current screen
49
- *
50
- * @since 3.1.0
51
- * @var object
52
- * @access protected
53
- */
54
- var $screen;
55
-
56
- /**
57
- * Cached bulk actions
58
- *
59
- * @since 3.1.0
60
- * @var array
61
- * @access private
62
- */
63
- var $_actions;
64
-
65
- /**
66
- * Cached pagination output
67
- *
68
- * @since 3.1.0
69
- * @var string
70
- * @access private
71
- */
72
- var $_pagination;
73
-
74
- /**
75
- * Constructor. The child class should call this constructor from it's own constructor
76
- *
77
- * @param array $args An associative array with information about the current table
78
- * @access protected
79
- */
80
- function WP_List_Table( $args = array() ) {
81
- $args = wp_parse_args( $args, array(
82
- 'plural' => '',
83
- 'singular' => '',
84
- 'ajax' => false
85
- ) );
86
-
87
- $screen = get_current_screen();
88
-
89
- add_filter( "manage_{$screen->id}_columns", array( &$this, 'get_columns' ), 0 );
90
-
91
- if ( !$args['plural'] )
92
- $args['plural'] = $screen->base;
93
-
94
- $this->_args = $args;
95
-
96
- if ( $args['ajax'] ) {
97
- // wp_enqueue_script( 'list-table' );
98
- add_action( 'admin_footer', array( &$this, '_js_vars' ) );
99
- }
100
- }
101
-
102
- /**
103
- * Checks the current user's permissions
104
- * @uses wp_die()
105
- *
106
- * @since 3.1.0
107
- * @access public
108
- * @abstract
109
- */
110
- function ajax_user_can() {
111
- die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
112
- }
113
-
114
- /**
115
- * Prepares the list of items for displaying.
116
- * @uses WP_List_Table::set_pagination_args()
117
- *
118
- * @since 3.1.0
119
- * @access public
120
- * @abstract
121
- */
122
- function prepare_items() {
123
- die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
124
- }
125
-
126
- /**
127
- * An internal method that sets all the necessary pagination arguments
128
- *
129
- * @param array $args An associative array with information about the pagination
130
- * @access protected
131
- */
132
- function set_pagination_args( $args ) {
133
- $args = wp_parse_args( $args, array(
134
- 'total_items' => 0,
135
- 'total_pages' => 0,
136
- 'per_page' => 0,
137
- ) );
138
-
139
- if ( !$args['total_pages'] && $args['per_page'] > 0 )
140
- $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
141
-
142
- $this->_pagination_args = $args;
143
- }
144
-
145
- /**
146
- * Access the pagination args
147
- *
148
- * @since 3.1.0
149
- * @access public
150
- *
151
- * @param string $key
152
- * @return array
153
- */
154
- function get_pagination_arg( $key ) {
155
- if ( 'page' == $key )
156
- return $this->get_pagenum();
157
-
158
- if ( isset( $this->_pagination_args[$key] ) )
159
- return $this->_pagination_args[$key];
160
- }
161
-
162
- /**
163
- * Whether the table has items to display or not
164
- *
165
- * @since 3.1.0
166
- * @access public
167
- *
168
- * @return bool
169
- */
170
- function has_items() {
171
- return !empty( $this->items );
172
- }
173
-
174
- /**
175
- * Message to be displayed when there are no items
176
- *
177
- * @since 3.1.0
178
- * @access public
179
- */
180
- function no_items() {
181
- _e( 'No items found.' );
182
- }
183
-
184
- /**
185
- * Display the search box.
186
- *
187
- * @since 3.1.0
188
- * @access public
189
- *
190
- * @param string $text The search button text
191
- * @param string $input_id The search input id
192
- */
193
- function search_box( $text, $input_id ) {
194
- if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
195
- return;
196
-
197
- $input_id = $input_id . '-search-input';
198
-
199
- if ( ! empty( $_REQUEST['orderby'] ) )
200
- echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
201
- if ( ! empty( $_REQUEST['order'] ) )
202
- echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
203
- ?>
204
- <p class="search-box">
205
- <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
206
- <input type="text" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
207
- <?php submit_button( $text, 'button', false, false, array('id' => 'search-submit') ); ?>
208
- </p>
209
- <?php
210
- }
211
-
212
- /**
213
- * Get an associative array ( id => link ) with the list
214
- * of views available on this table.
215
- *
216
- * @since 3.1.0
217
- * @access protected
218
- *
219
- * @return array
220
- */
221
- function get_views() {
222
- return array();
223
- }
224
-
225
- /**
226
- * Display the bulk actions dropdown.
227
- *
228
- * @since 3.1.0
229
- * @access public
230
- */
231
- function views() {
232
- $screen = get_current_screen();
233
-
234
- $views = $this->get_views();
235
- $views = apply_filters( 'views_' . $screen->id, $views );
236
-
237
- if ( empty( $views ) )
238
- return;
239
-
240
- echo "<ul class='subsubsub'>\n";
241
- foreach ( $views as $class => $view ) {
242
- $views[ $class ] = "\t<li class='$class'>$view";
243
- }
244
- echo implode( " |</li>\n", $views ) . "</li>\n";
245
- echo "</ul>";
246
- }
247
-
248
- /**
249
- * Get an associative array ( option_name => option_title ) with the list
250
- * of bulk actions available on this table.
251
- *
252
- * @since 3.1.0
253
- * @access protected
254
- *
255
- * @return array
256
- */
257
- function get_bulk_actions() {
258
- return array();
259
- }
260
-
261
- /**
262
- * Display the bulk actions dropdown.
263
- *
264
- * @since 3.1.0
265
- * @access public
266
- */
267
- function bulk_actions() {
268
- $screen = get_current_screen();
269
-
270
- if ( is_null( $this->_actions ) ) {
271
- $no_new_actions = $this->_actions = $this->get_bulk_actions();
272
- // This filter can currently only be used to remove actions.
273
- $this->_actions = apply_filters( 'bulk_actions-' . $screen->id, $this->_actions );
274
- $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
275
- $two = '';
276
- } else {
277
- $two = '2';
278
- }
279
-
280
- if ( empty( $this->_actions ) )
281
- return;
282
-
283
- echo "<select name='action$two'>\n";
284
- echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
285
- foreach ( $this->_actions as $name => $title )
286
- echo "\t<option value='$name'>$title</option>\n";
287
- echo "</select>\n";
288
-
289
- submit_button( __( 'Apply' ), 'button-secondary action', false, false, array( 'id' => "doaction$two" ) );
290
- echo "\n";
291
- }
292
-
293
- /**
294
- * Get the current action selected from the bulk actions dropdown.
295
- *
296
- * @since 3.1.0
297
- * @access public
298
- *
299
- * @return string|bool The action name or False if no action was selected
300
- */
301
- function current_action() {
302
- if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
303
- return $_REQUEST['action'];
304
-
305
- if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
306
- return $_REQUEST['action2'];
307
-
308
- return false;
309
- }
310
-
311
- /**
312
- * Generate row actions div
313
- *
314
- * @since 3.1.0
315
- * @access protected
316
- *
317
- * @param array $actions The list of actions
318
- * @param bool $always_visible Wether the actions should be always visible
319
- * @return string
320
- */
321
- function row_actions( $actions, $always_visible = false ) {
322
- $action_count = count( $actions );
323
- $i = 0;
324
-
325
- if ( !$action_count )
326
- return '';
327
-
328
- $out = '<div class="' . ( $always_visible ? 'row-actions-visible' : 'row-actions' ) . '">';
329
- foreach ( $actions as $action => $link ) {
330
- ++$i;
331
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
332
- $out .= "<span class='$action'>$link$sep</span>";
333
- }
334
- $out .= '</div>';
335
-
336
- return $out;
337
- }
338
-
339
- /**
340
- * Display a monthly dropdown for filtering items
341
- *
342
- * @since 3.1.0
343
- * @access protected
344
- */
345
- function months_dropdown( $post_type ) {
346
- global $wpdb, $wp_locale;
347
-
348
- $months = $wpdb->get_results( $wpdb->prepare( "
349
- SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
350
- FROM $wpdb->posts
351
- WHERE post_type = %s
352
- ORDER BY post_date DESC
353
- ", $post_type ) );
354
-
355
- $month_count = count( $months );
356
-
357
- if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
358
- return;
359
-
360
- $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
361
- ?>
362
- <select name='m'>
363
- <option<?php selected( $m, 0 ); ?> value='0'><?php _e( 'Show all dates' ); ?></option>
364
- <?php
365
- foreach ( $months as $arc_row ) {
366
- if ( 0 == $arc_row->year )
367
- continue;
368
-
369
- $month = zeroise( $arc_row->month, 2 );
370
- $year = $arc_row->year;
371
-
372
- printf( "<option %s value='%s'>%s</option>\n",
373
- selected( $m, $year . $month, false ),
374
- esc_attr( $arc_row->year . $month ),
375
- $wp_locale->get_month( $month ) . " $year"
376
- );
377
- }
378
- ?>
379
- </select>
380
- <?php
381
- }
382
-
383
- /**
384
- * Display a view switcher
385
- *
386
- * @since 3.1.0
387
- * @access protected
388
- */
389
- function view_switcher( $current_mode ) {
390
- $modes = array(
391
- 'list' => __( 'List View' ),
392
- 'excerpt' => __( 'Excerpt View' )
393
- );
394
-
395
- ?>
396
- <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
397
- <div class="view-switch">
398
- <?php
399
- foreach ( $modes as $mode => $title ) {
400
- $class = ( $current_mode == $mode ) ? 'class="current"' : '';
401
- echo "<a href='" . esc_url( add_query_arg( 'mode', $mode, $_SERVER['REQUEST_URI'] ) ) . "' $class><img id='view-switch-$mode' src='" . esc_url( includes_url( 'images/blank.gif' ) ) . "' width='20' height='20' title='$title' alt='$title' /></a>\n";
402
- }
403
- ?>
404
- </div>
405
- <?php
406
- }
407
-
408
- /**
409
- * Display a comment count bubble
410
- *
411
- * @since 3.1.0
412
- * @access protected
413
- *
414
- * @param int $post_id
415
- * @param int $pending_comments
416
- */
417
- function comments_bubble( $post_id, $pending_comments ) {
418
- $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
419
-
420
- if ( $pending_comments )
421
- echo '<strong>';
422
-
423
- echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . "</span></a>";
424
-
425
- if ( $pending_comments )
426
- echo '</strong>';
427
- }
428
-
429
- /**
430
- * Get the current page number
431
- *
432
- * @since 3.1.0
433
- * @access protected
434
- *
435
- * @return int
436
- */
437
- function get_pagenum() {
438
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
439
-
440
- if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
441
- $pagenum = $this->_pagination_args['total_pages'];
442
-
443
- return max( 1, $pagenum );
444
- }
445
-
446
- /**
447
- * Get number of items to display on a single page
448
- *
449
- * @since 3.1.0
450
- * @access protected
451
- *
452
- * @return int
453
- */
454
- function get_items_per_page( $option, $default = 20 ) {
455
- $per_page = (int) get_user_option( $option );
456
- if ( empty( $per_page ) || $per_page < 1 )
457
- $per_page = $default;
458
-
459
- return (int) apply_filters( $option, $per_page );
460
- }
461
-
462
- /**
463
- * Display the pagination.
464
- *
465
- * @since 3.1.0
466
- * @access protected
467
- */
468
- function pagination( $which ) {
469
- if ( empty( $this->_pagination_args ) )
470
- return;
471
-
472
- extract( $this->_pagination_args );
473
-
474
- $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
475
-
476
- $current = $this->get_pagenum();
477
-
478
- $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
479
-
480
- $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
481
-
482
- $page_links = array();
483
-
484
- $disable_first = $disable_last = '';
485
- if ( $current == 1 )
486
- $disable_first = ' disabled';
487
- if ( $current == $total_pages )
488
- $disable_last = ' disabled';
489
-
490
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
491
- 'first-page' . $disable_first,
492
- esc_attr__( 'Go to the first page' ),
493
- esc_url( remove_query_arg( 'paged', $current_url ) ),
494
- '&laquo;'
495
- );
496
-
497
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
498
- 'prev-page' . $disable_first,
499
- esc_attr__( 'Go to the previous page' ),
500
- esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
501
- '&lsaquo;'
502
- );
503
-
504
- if ( 'bottom' == $which )
505
- $html_current_page = $current;
506
- else
507
- $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='%s' value='%s' size='%d' />",
508
- esc_attr__( 'Current page' ),
509
- esc_attr( 'paged' ),
510
- $current,
511
- strlen( $total_pages )
512
- );
513
-
514
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
515
- $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
516
-
517
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
518
- 'next-page' . $disable_last,
519
- esc_attr__( 'Go to the next page' ),
520
- esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
521
- '&rsaquo;'
522
- );
523
-
524
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
525
- 'last-page' . $disable_last,
526
- esc_attr__( 'Go to the last page' ),
527
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
528
- '&raquo;'
529
- );
530
-
531
- $output .= "\n" . join( "\n", $page_links );
532
-
533
- $page_class = $total_pages < 2 ? ' one-page' : '';
534
-
535
- $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
536
-
537
- echo $this->_pagination;
538
- }
539
-
540
- /**
541
- * Get a list of columns. The format is:
542
- * 'internal-name' => 'Title'
543
- *
544
- * @since 3.1.0
545
- * @access protected
546
- * @abstract
547
- *
548
- * @return array
549
- */
550
- function get_columns() {
551
- die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
552
- }
553
-
554
- /**
555
- * Get a list of sortable columns. The format is:
556
- * 'internal-name' => 'orderby'
557
- * or
558
- * 'internal-name' => array( 'orderby', true )
559
- *
560
- * The second format will make the initial sorting order be descending
561
- *
562
- * @since 3.1.0
563
- * @access protected
564
- *
565
- * @return array
566
- */
567
- function get_sortable_columns() {
568
- return array();
569
- }
570
-
571
- /**
572
- * Get a list of all, hidden and sortable columns, with filter applied
573
- *
574
- * @since 3.1.0
575
- * @access protected
576
- *
577
- * @return array
578
- */
579
- function get_column_info() {
580
- if ( isset( $this->_column_headers ) )
581
- return $this->_column_headers;
582
-
583
- $screen = get_current_screen();
584
-
585
- $columns = get_column_headers( $screen );
586
- $hidden = get_hidden_columns( $screen );
587
-
588
- $_sortable = apply_filters( "manage_{$screen->id}_sortable_columns", $this->get_sortable_columns() );
589
-
590
- $sortable = array();
591
- foreach ( $_sortable as $id => $data ) {
592
- if ( empty( $data ) )
593
- continue;
594
-
595
- $data = (array) $data;
596
- if ( !isset( $data[1] ) )
597
- $data[1] = false;
598
-
599
- $sortable[$id] = $data;
600
- }
601
-
602
- $this->_column_headers = array( $columns, $hidden, $sortable );
603
-
604
- return $this->_column_headers;
605
- }
606
-
607
- /**
608
- * Return number of visible columns
609
- *
610
- * @since 3.1.0
611
- * @access public
612
- *
613
- * @return int
614
- */
615
- function get_column_count() {
616
- list ( $columns, $hidden ) = $this->get_column_info();
617
- $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
618
- return count( $columns ) - count( $hidden );
619
- }
620
-
621
- /**
622
- * Print column headers, accounting for hidden and sortable columns.
623
- *
624
- * @since 3.1.0
625
- * @access protected
626
- *
627
- * @param bool $with_id Whether to set the id attribute or not
628
- */
629
- function print_column_headers( $with_id = true ) {
630
- $screen = get_current_screen();
631
-
632
- list( $columns, $hidden, $sortable ) = $this->get_column_info();
633
-
634
- $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
635
- $current_url = remove_query_arg( 'paged', $current_url );
636
-
637
- if ( isset( $_GET['orderby'] ) )
638
- $current_orderby = $_GET['orderby'];
639
- else
640
- $current_orderby = '';
641
-
642
- if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] )
643
- $current_order = 'desc';
644
- else
645
- $current_order = 'asc';
646
-
647
- foreach ( $columns as $column_key => $column_display_name ) {
648
- $class = array( 'manage-column', "column-$column_key" );
649
-
650
- $style = '';
651
- if ( in_array( $column_key, $hidden ) )
652
- $style = 'display:none;';
653
-
654
- $style = ' style="' . $style . '"';
655
-
656
- if ( 'cb' == $column_key )
657
- $class[] = 'check-column';
658
- elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
659
- $class[] = 'num';
660
-
661
- if ( isset( $sortable[$column_key] ) ) {
662
- list( $orderby, $desc_first ) = $sortable[$column_key];
663
-
664
- if ( $current_orderby == $orderby ) {
665
- $order = 'asc' == $current_order ? 'desc' : 'asc';
666
- $class[] = 'sorted';
667
- $class[] = $current_order;
668
- } else {
669
- $order = $desc_first ? 'desc' : 'asc';
670
- $class[] = 'sortable';
671
- $class[] = $desc_first ? 'asc' : 'desc';
672
- }
673
-
674
- $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
675
- }
676
-
677
- $id = $with_id ? "id='$column_key'" : '';
678
-
679
- if ( !empty( $class ) )
680
- $class = "class='" . join( ' ', $class ) . "'";
681
-
682
- echo "<th scope='col' $id $class $style>$column_display_name</th>";
683
- }
684
- }
685
-
686
- /**
687
- * Display the table
688
- *
689
- * @since 3.1.0
690
- * @access public
691
- */
692
- function display() {
693
- extract( $this->_args );
694
-
695
- $this->display_tablenav( 'top' );
696
-
697
- ?>
698
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
699
- <thead>
700
- <tr>
701
- <?php $this->print_column_headers(); ?>
702
- </tr>
703
- </thead>
704
-
705
- <tfoot>
706
- <tr>
707
- <?php $this->print_column_headers( false ); ?>
708
- </tr>
709
- </tfoot>
710
-
711
- <tbody id="the-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
712
- <?php $this->display_rows_or_placeholder(); ?>
713
- </tbody>
714
- </table>
715
- <?php
716
- $this->display_tablenav( 'bottom' );
717
- }
718
-
719
- /**
720
- * Get a list of CSS classes for the <table> tag
721
- *
722
- * @since 3.1.0
723
- * @access protected
724
- *
725
- * @return array
726
- */
727
- function get_table_classes() {
728
- return array( 'widefat', 'fixed', $this->_args['plural'] );
729
- }
730
-
731
- /**
732
- * Generate the table navigation above or below the table
733
- *
734
- * @since 3.1.0
735
- * @access protected
736
- */
737
- function display_tablenav( $which ) {
738
- if ( 'top' == $which )
739
- wp_nonce_field( 'bulk-' . $this->_args['plural'] );
740
- ?>
741
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
742
-
743
- <div class="alignleft actions">
744
- <?php $this->bulk_actions( $which ); ?>
745
- </div>
746
- <?php
747
- $this->extra_tablenav( $which );
748
- $this->pagination( $which );
749
- ?>
750
-
751
- <br class="clear" />
752
- </div>
753
- <?php
754
- }
755
-
756
- /**
757
- * Extra controls to be displayed between bulk actions and pagination
758
- *
759
- * @since 3.1.0
760
- * @access protected
761
- */
762
- function extra_tablenav( $which ) {}
763
-
764
- /**
765
- * Generate the <tbody> part of the table
766
- *
767
- * @since 3.1.0
768
- * @access protected
769
- */
770
- function display_rows_or_placeholder() {
771
- if ( $this->has_items() ) {
772
- $this->display_rows();
773
- } else {
774
- list( $columns, $hidden ) = $this->get_column_info();
775
- echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
776
- $this->no_items();
777
- echo '</td></tr>';
778
- }
779
- }
780
-
781
- /**
782
- * Generate the table rows
783
- *
784
- * @since 3.1.0
785
- * @access protected
786
- */
787
- function display_rows() {
788
- foreach ( $this->items as $item )
789
- $this->single_row( $item );
790
- }
791
-
792
- /**
793
- * Generates content for a single row of the table
794
- *
795
- * @since 3.1.0
796
- * @access protected
797
- *
798
- * @param object $item The current item
799
- */
800
- function single_row( $item ) {
801
- static $row_class = '';
802
- $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
803
-
804
- echo '<tr' . $row_class . '>';
805
- echo $this->single_row_columns( $item );
806
- echo '</tr>';
807
- }
808
-
809
- /**
810
- * Generates the columns for a single row of the table
811
- *
812
- * @since 3.1.0
813
- * @access protected
814
- *
815
- * @param object $item The current item
816
- */
817
- function single_row_columns( $item ) {
818
- list( $columns, $hidden ) = $this->get_column_info();
819
-
820
- foreach ( $columns as $column_name => $column_display_name ) {
821
- $class = "class='$column_name column-$column_name'";
822
-
823
- $style = '';
824
- if ( in_array( $column_name, $hidden ) )
825
- $style = ' style="display:none;"';
826
-
827
- $attributes = "$class$style";
828
-
829
- if ( 'cb' == $column_name ) {
830
- echo '<th scope="row" class="check-column">';
831
- echo $this->column_cb( $item );
832
- echo '</th>';
833
- }
834
- elseif ( method_exists( $this, 'column_' . $column_name ) ) {
835
- echo "<td $attributes>";
836
- echo call_user_func( array( &$this, 'column_' . $column_name ), $item );
837
- echo "</td>";
838
- }
839
- else {
840
- echo "<td $attributes>";
841
- echo $this->column_default( $item, $column_name );
842
- echo "</td>";
843
- }
844
- }
845
- }
846
-
847
- /**
848
- * Handle an incoming ajax request (called from admin-ajax.php)
849
- *
850
- * @since 3.1.0
851
- * @access public
852
- */
853
- function ajax_response() {
854
- $this->prepare_items();
855
-
856
- extract( $this->_args );
857
- extract( $this->_pagination_args );
858
-
859
- ob_start();
860
- if ( ! empty( $_REQUEST['no_placeholder'] ) )
861
- $this->display_rows();
862
- else
863
- $this->display_rows_or_placeholder();
864
-
865
- $rows = ob_get_clean();
866
-
867
- $response = array( 'rows' => $rows );
868
-
869
- if ( isset( $total_items ) )
870
- $response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
871
-
872
- if ( isset( $total_pages ) ) {
873
- $response['total_pages'] = $total_pages;
874
- $response['total_pages_i18n'] = number_format_i18n( $total_pages );
875
- }
876
-
877
- die( json_encode( $response ) );
878
- }
879
-
880
- /**
881
- * Send required variables to JavaScript land
882
- *
883
- * @access private
884
- */
885
- function _js_vars() {
886
- $args = array(
887
- 'class' => get_class( $this ),
888
- 'screen' => get_current_screen()
889
- );
890
-
891
- printf( "<script type='text/javascript'>list_args = %s;</script>\n", json_encode( $args ) );
892
- }
893
- }
894
-
895
- /**
896
- * Get the current screen object
897
- *
898
- * @since 3.1.0
899
- *
900
- * @return object Current screen object
901
- */
902
- function get_current_screen() {
903
- global $current_screen;
904
-
905
- if ( !isset($current_screen) )
906
- return null;
907
-
908
- return $current_screen;
909
- }
910
- /**
911
- * Echos a submit button, with provided text and appropriate class
912
- *
913
- * @since 3.1.0
914
- *
915
- * @param string $text The text of the button (defaults to 'Save Changes')
916
- * @param string $type The type of button. One of: primary, secondary, delete
917
- * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute
918
- * is given in $other_attributes below, $name will be used as the button's id.
919
- * @param bool $wrap True if the output button should be wrapped in a paragraph tag,
920
- * false otherwise. Defaults to true
921
- * @param array|string $other_attributes Other attributes that should be output with the button,
922
- * mapping attributes to their values, such as array( 'tabindex' => '1' ).
923
- * These attributes will be ouput as attribute="value", such as tabindex="1".
924
- * Defaults to no other attributes. Other attributes can also be provided as a
925
- * string such as 'tabindex="1"', though the array format is typically cleaner.
926
- */
927
- function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
928
- echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
929
- }
930
- /**
931
- * Returns a submit button, with provided text and appropriate class
932
- *
933
- * @since 3.1.0
934
- *
935
- * @param string $text The text of the button (defaults to 'Save Changes')
936
- * @param string $type The type of button. One of: primary, secondary, delete
937
- * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute
938
- * is given in $other_attributes below, $name will be used as the button's id.
939
- * @param bool $wrap True if the output button should be wrapped in a paragraph tag,
940
- * false otherwise. Defaults to true
941
- * @param array|string $other_attributes Other attributes that should be output with the button,
942
- * mapping attributes to their values, such as array( 'tabindex' => '1' ).
943
- * These attributes will be ouput as attribute="value", such as tabindex="1".
944
- * Defaults to no other attributes. Other attributes can also be provided as a
945
- * string such as 'tabindex="1"', though the array format is typically cleaner.
946
- */
947
- function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
948
- switch ( $type ) :
949
- case 'primary' :
950
- case 'secondary' :
951
- $class = 'button-' . $type;
952
- break;
953
- case 'delete' :
954
- $class = 'button-secondary delete';
955
- break;
956
- default :
957
- $class = $type; // Custom cases can just pass in the classes they want to be used
958
- endswitch;
959
- $text = ( NULL == $text ) ? __( 'Save Changes' ) : $text;
960
-
961
- // Default the id attribute to $name unless an id was specifically provided in $other_attributes
962
- $id = $name;
963
- if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
964
- $id = $other_attributes['id'];
965
- unset( $other_attributes['id'] );
966
- }
967
-
968
- $attributes = '';
969
- if ( is_array( $other_attributes ) ) {
970
- foreach ( $other_attributes as $attribute => $value ) {
971
- $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
972
- }
973
- } else if ( !empty( $other_attributes ) ) { // Attributes provided as a string
974
- $attributes = $other_attributes;
975
- }
976
-
977
- $button = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class );
978
- $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
979
-
980
- if ( $wrap ) {
981
- $button = '<p class="submit">' . $button . '</p>';
982
- }
983
-
984
- return $button;
985
- }
986
-
987
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/libs/dropbox/dropbox.php CHANGED
@@ -1,4 +1,33 @@
1
  <?PHP
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  if (!class_exists('OAuthException'))
3
  require_once(dirname(__FILE__).'/oauth.php');
4
 
@@ -40,7 +69,7 @@ class Dropbox {
40
  if (!is_readable($file) or !is_file($file)){
41
  throw new DropboxException("Error: File \"$file\" is not readable or doesn't exist.");
42
  }
43
- if (!filesize($file)>314572800){
44
  throw new DropboxException("Error: File \"$file\" is to big max. 300 MB.");
45
  }
46
  $url = self::API_CONTENT_URL.self::API_VERSION_URL. 'files/' . $this->root . '/' . trim($path, '/');
@@ -59,7 +88,7 @@ class Dropbox {
59
 
60
  public function createAccount($firstName, $lastName, $email, $password){
61
  $url = self::API_URL.self::API_VERSION_URL.'account';
62
- return $this->request($url, array('first_name' => $firstName, 'last_name' => $lastName, 'email' => $email, 'password' => $password), 'GET', true);
63
  }
64
 
65
  public function fileopsDelete($path){
@@ -92,7 +121,7 @@ class Dropbox {
92
  return 'data:image/' . $format . ';base64,' . base64_encode( (isset($result['body'])) ? $result['body'] : (!is_array($result)) ? $result : '' );
93
  }
94
  }
95
-
96
  public function oAuthRequestToken() {
97
  $req_req = OAuthRequest::from_consumer_and_token($this->OAuthConsumer, NULL, "GET", self::API_URL.self::API_VERSION_URL.'oauth/request_token');
98
  $req_req->sign_request($this->OAuthSignatureMethod, $this->OAuthConsumer, NULL);
@@ -189,21 +218,27 @@ class Dropbox {
189
 
190
  /* Build cURL Request */
191
  $ch = curl_init();
192
- curl_setopt($ch, CURLOPT_URL, $dropoauthreq->to_url());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
194
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
195
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
196
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
197
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
198
  curl_setopt($ch, CURLOPT_AUTOREFERER , true);
199
-
200
- /* file upload */
201
- if (is_file($file)){
202
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
203
- curl_setopt($ch, CURLOPT_POST, true);
204
- curl_setopt($ch, CURLOPT_POSTFIELDS, array('file' => "@$file"));
205
- }
206
-
207
  $content = curl_exec($ch);
208
  $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
209
  $output = json_decode($content, true);
1
  <?PHP
2
+
3
+ /**
4
+ * Dropbox class
5
+ *
6
+ * This source file can be used to communicate with DropBox (http://dropbox.com)
7
+ *
8
+ * The class is documented in the file itself. If you find any bugs help me out and report them.
9
+ * If you report a bug, make sure you give me enough information (include your code).
10
+ *
11
+ *
12
+ *
13
+ * License
14
+ * Copyright (c), Daniel Huesken. All rights reserved.
15
+ *
16
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17
+ *
18
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20
+ * 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
21
+ *
22
+ * This software is provided by the author "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
23
+ *
24
+ * @author Daniel Huesken <daniel@huesken-net.de>
25
+ * @version 1.0.0
26
+ *
27
+ * @copyright Copyright (c), Daniel Huesken. All rights reserved.
28
+ * @license BSD License
29
+ */
30
+
31
  if (!class_exists('OAuthException'))
32
  require_once(dirname(__FILE__).'/oauth.php');
33
 
69
  if (!is_readable($file) or !is_file($file)){
70
  throw new DropboxException("Error: File \"$file\" is not readable or doesn't exist.");
71
  }
72
+ if (filesize($file)>314572800){
73
  throw new DropboxException("Error: File \"$file\" is to big max. 300 MB.");
74
  }
75
  $url = self::API_CONTENT_URL.self::API_VERSION_URL. 'files/' . $this->root . '/' . trim($path, '/');
88
 
89
  public function createAccount($firstName, $lastName, $email, $password){
90
  $url = self::API_URL.self::API_VERSION_URL.'account';
91
+ return $this->request($url, array('first_name' => $firstName, 'last_name' => $lastName, 'email' => $email, 'password' => $password), 'POST', true);
92
  }
93
 
94
  public function fileopsDelete($path){
121
  return 'data:image/' . $format . ';base64,' . base64_encode( (isset($result['body'])) ? $result['body'] : (!is_array($result)) ? $result : '' );
122
  }
123
  }
124
+
125
  public function oAuthRequestToken() {
126
  $req_req = OAuthRequest::from_consumer_and_token($this->OAuthConsumer, NULL, "GET", self::API_URL.self::API_VERSION_URL.'oauth/request_token');
127
  $req_req->sign_request($this->OAuthSignatureMethod, $this->OAuthConsumer, NULL);
218
 
219
  /* Build cURL Request */
220
  $ch = curl_init();
221
+ if ($method == 'POST') {
222
+ curl_setopt($ch, CURLOPT_POST, true);
223
+ if (is_file($file)) { /* file upload */
224
+ curl_setopt($ch, CURLOPT_POSTFIELDS, array('file' => "@$file"));
225
+ $headers[]='Content-Length: ' .filesize($file)+strlen(http_build_query(array('file' => "$file")));
226
+ } else {
227
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
228
+ $args = (is_array($args)) ? http_build_query($args) : $args;
229
+ $headers[]='Content-Length: ' .strlen($args);
230
+ }
231
+ $headers[]=$dropoauthreq->to_header($url);
232
+ curl_setopt($ch, CURLOPT_URL, $url);
233
+ } else {
234
+ curl_setopt($ch, CURLOPT_URL, $dropoauthreq->to_url());
235
+ }
236
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
237
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
238
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
239
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
240
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
241
  curl_setopt($ch, CURLOPT_AUTOREFERER , true);
 
 
 
 
 
 
 
 
242
  $content = curl_exec($ch);
243
  $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
244
  $output = json_decode($content, true);
app/libs/dropbox/oauth.php CHANGED
@@ -85,7 +85,23 @@ abstract class OAuthSignatureMethod {
85
  */
86
  public function check_signature($request, $consumer, $token, $signature) {
87
  $built = $this->build_signature($request, $consumer, $token);
88
- return $built == $signature;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
  }
91
 
@@ -243,7 +259,7 @@ class OAuthRequest {
243
  ? 'http'
244
  : 'https';
245
  $http_url = ($http_url) ? $http_url : $scheme .
246
- '://' . $_SERVER['HTTP_HOST'] .
247
  ':' .
248
  $_SERVER['SERVER_PORT'] .
249
  $_SERVER['REQUEST_URI'];
@@ -383,7 +399,7 @@ class OAuthRequest {
383
 
384
  $scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http';
385
  $port = (isset($parts['port'])) ? $parts['port'] : (($scheme == 'https') ? '443' : '80');
386
- $host = (isset($parts['host'])) ? $parts['host'] : '';
387
  $path = (isset($parts['path'])) ? $parts['path'] : '';
388
 
389
  if (($scheme == 'https' && $port != '443')
85
  */
86
  public function check_signature($request, $consumer, $token, $signature) {
87
  $built = $this->build_signature($request, $consumer, $token);
88
+
89
+ // Check for zero length, although unlikely here
90
+ if (strlen($built) == 0 || strlen($signature) == 0) {
91
+ return false;
92
+ }
93
+
94
+ if (strlen($built) != strlen($signature)) {
95
+ return false;
96
+ }
97
+
98
+ // Avoid a timing leak with a (hopefully) time insensitive compare
99
+ $result = 0;
100
+ for ($i = 0; $i < strlen($signature); $i++) {
101
+ $result |= ord($built{$i}) ^ ord($signature{$i});
102
+ }
103
+
104
+ return $result == 0;
105
  }
106
  }
107
 
259
  ? 'http'
260
  : 'https';
261
  $http_url = ($http_url) ? $http_url : $scheme .
262
+ '://' . $_SERVER['SERVER_NAME'] .
263
  ':' .
264
  $_SERVER['SERVER_PORT'] .
265
  $_SERVER['REQUEST_URI'];
399
 
400
  $scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http';
401
  $port = (isset($parts['port'])) ? $parts['port'] : (($scheme == 'https') ? '443' : '80');
402
+ $host = (isset($parts['host'])) ? strtolower($parts['host']) : '';
403
  $path = (isset($parts['path'])) ? $parts['path'] : '';
404
 
405
  if (($scheme == 'https' && $port != '443')
app/list-tables.php CHANGED
@@ -1,11 +1,6 @@
1
  <?PHP
2
- //backwarts copatibility lower than wp 3.1
3
- if (!class_exists('WP_List_Table')) {
4
- if (is_file(trailingslashit(ABSPATH).'wp-admin/includes/class-wp-list-table.php'))
5
- include_once( trailingslashit(ABSPATH).'wp-admin/includes/class-wp-list-table.php' );
6
- else
7
- include_once('compatibility/class-wp-list-table.php');
8
- }
9
 
10
  class BackWPup_Jobs_Table extends WP_List_Table {
11
  function BackWPup_Jobs_Table() {
1
  <?PHP
2
+ if (!class_exists('WP_List_Table'))
3
+ include_once( trailingslashit(ABSPATH).'wp-admin/includes/class-wp-list-table.php' );
 
 
 
 
 
4
 
5
  class BackWPup_Jobs_Table extends WP_List_Table {
6
  function BackWPup_Jobs_Table() {
app/options-edit-job.php CHANGED
@@ -430,7 +430,7 @@ $dests=explode(',',strtoupper(BACKWPUP_DESTS));
430
  <?PHP if (empty($jobvalue['dropetoken']) and empty($jobvalue['dropesecret'])) { ?>
431
  <span style="color:red;"><?php _e('Not authenticated!', 'backwpup'); ?></span> <input type="submit" name="dropboxauth" class="button-primary" accesskey="d" value="<?php _e('Authenticate!', 'backwpup'); ?>" /><br />
432
  <?PHP } else { ?>
433
- <span style="color:green;"><?php _e('Authenticated!', 'backwpup'); ?></span> <input type="submit" name="dropboxauth" class="button-primary" accesskey="d" value="<?php _e('Delete!', 'backwpup'); ?>" /><br />
434
  <?PHP } ?><br />
435
  <b><?PHP _e('Directory:','backwpup'); ?></b><br />
436
  <input name="dropedir" type="text" value="<?PHP echo $jobvalue['dropedir'];?>" class="user large-text" /><br />
430
  <?PHP if (empty($jobvalue['dropetoken']) and empty($jobvalue['dropesecret'])) { ?>
431
  <span style="color:red;"><?php _e('Not authenticated!', 'backwpup'); ?></span> <input type="submit" name="dropboxauth" class="button-primary" accesskey="d" value="<?php _e('Authenticate!', 'backwpup'); ?>" /><br />
432
  <?PHP } else { ?>
433
+ <span style="color:green;"><?php _e('Authenticated!', 'backwpup'); ?></span> <input type="submit" name="dropboxauthdel" class="button-primary" accesskey="d" value="<?php _e('Delete!', 'backwpup'); ?>" /><br />
434
  <?PHP } ?><br />
435
  <b><?PHP _e('Directory:','backwpup'); ?></b><br />
436
  <input name="dropedir" type="text" value="<?PHP echo $jobvalue['dropedir'];?>" class="user large-text" /><br />
app/options-save.php CHANGED
@@ -642,7 +642,7 @@ function backwpup_save_job() { //Save Job settings
642
  $response = $dropbox->oAuthAuthorize($response['oauth_token'], get_admin_url().'admin.php?page=BackWPup&subpage=edit&jobid='.$jobid.'&dropboxauth=AccessToken&_wpnonce='.wp_create_nonce('edit-job'));
643
  }
644
 
645
- if ($_POST['dropboxauth']==__('Delete!', 'backwpup')) {
646
  $jobs[$jobid]['dropetoken']='';
647
  $jobs[$jobid]['dropesecret']='';
648
  $backwpup_message.=__('Dropbox authentication deleted!','backwpup').'<br />';
642
  $response = $dropbox->oAuthAuthorize($response['oauth_token'], get_admin_url().'admin.php?page=BackWPup&subpage=edit&jobid='.$jobid.'&dropboxauth=AccessToken&_wpnonce='.wp_create_nonce('edit-job'));
643
  }
644
 
645
+ if ($_POST['dropboxauthdel']==__('Delete!', 'backwpup')) {
646
  $jobs[$jobid]['dropetoken']='';
647
  $jobs[$jobid]['dropesecret']='';
648
  $backwpup_message.=__('Dropbox authentication deleted!','backwpup').'<br />';
app/php-functions.php CHANGED
@@ -5,14 +5,6 @@ if ( !defined('ABSPATH') )
5
 
6
  //Thems Option menu entry
7
  function backwpup_admin_menu() {
8
- //add_menu_page( __('BackWPup','backwpup'), __('BackWPup','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPup', 'backwpup_jobs_page', plugins_url('css/backup-icon.gif',__FILE__) );
9
- //add_submenu_page( 'BackWPup', __('Jobs','backwpup'), __('Jobs','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPup', 'backwpup_jobs_page' );
10
- //add_submenu_page( 'BackWPup', __('Add New','backwpup'), __('Add New','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPup', 'backwpup_edit-jobs_page' );
11
- //add_submenu_page( 'BackWPup', __('Logs','backwpup'), __('Logs','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPupLogs', 'backwpup_logs_page' );
12
- //add_submenu_page( 'BackWPup', __('Backups','backwpup'), __('Backups','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPupBackups', 'backwpup_backups_page' );
13
- //add_submenu_page( 'BackWPup', __('Tools','backwpup'), __('Tools','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPupTools', 'backwpup_tools_page' );
14
- //add_submenu_page( 'BackWPup', __('Settings','backwpup'), __('Settings','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPupSettings', 'backwpup_settings_page' );
15
-
16
  $hook = add_management_page(__('BackWPup','backwpup'), __('BackWPup','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPup','backwpup_options_page') ;
17
  add_action('load-'.$hook, 'backwpup_options_load');
18
  }
@@ -145,7 +137,7 @@ function backwpup_options_load() {
145
  $table->prepare_items();
146
  break;
147
  case 'edit':
148
- if (!empty($_POST['submit']) or !empty($_REQUEST['dropboxauth'])) {
149
  require_once(dirname(__FILE__).'/options-save.php');
150
  if ($_GET['dropboxauth']=='AccessToken')
151
  $backwpup_message=backwpup_save_dropboxauth();
5
 
6
  //Thems Option menu entry
7
  function backwpup_admin_menu() {
 
 
 
 
 
 
 
 
8
  $hook = add_management_page(__('BackWPup','backwpup'), __('BackWPup','backwpup'), BACKWPUP_USER_CAPABILITY, 'BackWPup','backwpup_options_page') ;
9
  add_action('load-'.$hook, 'backwpup_options_load');
10
  }
137
  $table->prepare_items();
138
  break;
139
  case 'edit':
140
+ if (!empty($_POST['submit']) or !empty($_REQUEST['dropboxauth']) or !empty($_REQUEST['dropboxauthdel'])) {
141
  require_once(dirname(__FILE__).'/options-save.php');
142
  if ($_GET['dropboxauth']=='AccessToken')
143
  $backwpup_message=backwpup_save_dropboxauth();
backwpup.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: BackWPup
4
  Plugin URI: http://danielhuesken.de/portfolio/backwpup/
5
  Description: Backup and more of your WordPress Blog Database and Files.
6
  Author: Daniel H&uuml;sken
7
- Version: 1.7.3
8
  Author URI: http://danielhuesken.de
9
  Text Domain: backwpup
10
  Domain Path: /lang/
@@ -34,7 +34,7 @@ if ( !defined('ABSPATH') )
34
  //Set plugin dirname
35
  define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
36
  //Set Plugin Version
37
- define('BACKWPUP_VERSION', '1.7.3');
38
  //Set User Capability
39
  define('BACKWPUP_USER_CAPABILITY', '10');
40
  //Set useable destinations
4
  Plugin URI: http://danielhuesken.de/portfolio/backwpup/
5
  Description: Backup and more of your WordPress Blog Database and Files.
6
  Author: Daniel H&uuml;sken
7
+ Version: 1.7.4
8
  Author URI: http://danielhuesken.de
9
  Text Domain: backwpup
10
  Domain Path: /lang/
34
  //Set plugin dirname
35
  define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
36
  //Set Plugin Version
37
+ define('BACKWPUP_VERSION', '1.7.4');
38
  //Set User Capability
39
  define('BACKWPUP_USER_CAPABILITY', '10');
40
  //Set useable destinations
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: danielhuesken
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: backup, admin, file, Database, mysql, Cron, ftp, S3, export, xml, Rackspace, Cloud, Azure, DropBox, SugarSync
5
- Requires at least: 2.8
6
- Tested up to: 3.1.0
7
- Stable tag: 1.7.3
8
 
9
  Backup your WordPress Database and Files, and more!
10
 
@@ -40,7 +40,7 @@ Do backups and more.
40
  == Frequently Asked Questions ==
41
  = Requires =
42
  * PHP 5.2.0
43
- * WordPress 2.8, works best with 3.1
44
  * curl (for Amazon S3, MS Azur, RackSpace, Dropbox Support)
45
  * gzip (for PCLZIP and gzip archives)
46
  * bzip2 (for bzip2 archives)
@@ -102,6 +102,12 @@ Destinations are:
102
  1. Job Page
103
 
104
  == Changelog ==
 
 
 
 
 
 
105
  = 1.7.3 =
106
  * Fixed Dropbox PLAINTEXT signatre
107
  * Updated pod
2
  Contributors: danielhuesken
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: backup, admin, file, Database, mysql, Cron, ftp, S3, export, xml, Rackspace, Cloud, Azure, DropBox, SugarSync
5
+ Requires at least: 3.1.0
6
+ Tested up to: 3.1.3
7
+ Stable tag: 1.7.4
8
 
9
  Backup your WordPress Database and Files, and more!
10
 
40
  == Frequently Asked Questions ==
41
  = Requires =
42
  * PHP 5.2.0
43
+ * WordPress 3.1
44
  * curl (for Amazon S3, MS Azur, RackSpace, Dropbox Support)
45
  * gzip (for PCLZIP and gzip archives)
46
  * bzip2 (for bzip2 archives)
102
  1. Job Page
103
 
104
  == Changelog ==
105
+ = 1.7.4 =
106
+ * jobs not longer work ever... max. time is 5 min.
107
+ * hopfuly fix for dropbox upload
108
+ * fix dropbox auth deletion
109
+ * fixed bug in Sugarsync qouta
110
+
111
  = 1.7.3 =
112
  * Fixed Dropbox PLAINTEXT signatre
113
  * Updated pod