-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate.php
806 lines (730 loc) · 33.1 KB
/
migrate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
<?php
/*
* XImageSharing => Reservo Migration Script.
*
* Mirgration script for converting users, images data
* from XImageSharing. Set the config values below, upload this
* script to the base of your Reservo install and load it within
* a browser.
*
* REQUIREMENTS:
* MySQL PDO
* Reservo installed
*/
// XImageSharing - database settings
define('XIMAGESHARING_DB_HOST', 'localhost');
define('XIMAGESHARING_DB_NAME', '');
define('XIMAGESHARING_DB_USER', '');
define('XIMAGESHARING_DB_PASS', '');
// XImageSharing password hash. Needed to decode user passwords
// for migration. This value is in XFileConfig.pm in password_salt.
// i.e. pasword_salt => '',
define('XIMAGESHARING_PASSWORD_HASH', '[hash]');
// XImageSharing storage path for local files. Include trailing forward slash.
//define('XIMAGESHARING_FILE_STORAGE_PATH', 'cgi-bin/uploads/00000/');
// XImageSharing payments currency in three digital country code
define('XIMAGESHARING_PAYMENT_CURRENCY', 'USD');
// XImageSharing grouping for file storage. This value is in XFileConfig.pm in files_per_folder. Normally 5000. Set to 0 to avoid this migration appending the folder names to the original file. i.e. 00001, 00002, 00003 etc.
define('XIMAGESHARING_FOLDER_GROUPING', '5000');
// Reservo - config file path
define('RESERVO_CONFIG_FILE_PATH', '_config.inc.php');
/*
* ******************************************************************
* END OF CONFIG SECTION, YOU SHOULDN'T NEED TO CHANGE ANYTHING ELSE
* ******************************************************************
*/
// allow up to 24 hours for it to run
set_time_limit(60*60*24);
// make sure we are in the root and can find the config file
if (!file_exists(RESERVO_CONFIG_FILE_PATH))
{
die('ERROR: Could not load Reservo config file. Ensure you\'re running this script from the root of your Reservo install.');
}
// include Reservo config
require_once(RESERVO_CONFIG_FILE_PATH);
// test database connectivity, Reservo
try
{
$ysDBH = new PDO("mysql:host=" . _CONFIG_DB_HOST . ";dbname=" . _CONFIG_DB_NAME, _CONFIG_DB_USER, _CONFIG_DB_PASS);
$ysDBH->exec("set names utf8");
}
catch (PDOException $e)
{
die('ERROR: Could not connect to Reservo database. ' . $e->getMessage());
}
// test database connectivity, XImageSharing
try
{
$xisDBH = new PDO("mysql:host=" . XIMAGESHARING_DB_HOST . ";dbname=" . XIMAGESHARING_DB_NAME, XIMAGESHARING_DB_USER, XIMAGESHARING_DB_PASS);
$xisDBH->exec("set names utf8");
}
catch (PDOException $e)
{
die('ERROR: Could not connect to XImageSharing database. ' . $e->getMessage());
}
// check file storage exists
/*
if(!file_exists(XIMAGESHARING_FILE_STORAGE_PATH))
{
die('ERROR: Could not find XImageSharing file storage folder. ' . XIMAGESHARING_FILE_STORAGE_PATH);
}
*/
// check Reservo file storage is writable
if(!is_writable(_CONFIG_FILE_STORAGE_PATH))
{
die('ERROR: Reservo file storage is not writable. Set to CHMOD 777 or 755. ' . _CONFIG_FILE_STORAGE_PATH);
}
// initial checks passed, load stats for converting and get user confirmation
$xfsStats = array();
// servers
$getFiles = $xisDBH->query('SELECT COUNT(srv_id) AS total FROM Servers');
$row = $getFiles->fetchObject();
$xfsStats['totalServers'] = (int) $row->total;
// files
$getFiles = $xisDBH->query('SELECT COUNT(file_id) AS total FROM Files');
$row = $getFiles->fetchObject();
$xfsStats['totalFiles'] = (int) $row->total;
// users
$getUsers = $xisDBH->query('SELECT COUNT(usr_id) AS total FROM Users');
$row = $getUsers->fetchObject();
$xfsStats['totalUsers'] = (int) $row->total;
// folders
$getFolders = $xisDBH->query('SELECT COUNT(fld_id) AS total FROM Folders');
$row = $getFolders->fetchObject();
$xfsStats['totalFolders'] = (int) $row->total;
// payments
$getPayments = $xisDBH->query('SELECT COUNT(id) AS total FROM Payments');
$row = $getPayments->fetchObject();
$xfsStats['totalPayments'] = (int) $row->total;
// page setup
define('PAGE_TITLE', 'XImageSharing => Reservo Migration Tool');
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo PAGE_TITLE; ?></title>
<meta name="distribution" content="global" />
<style>
body
{
margin: 0px;
padding: 0;
font: 100%/1.0 helvetica, arial, sans-serif;
color: #444;
background: #ccc;
}
h1, h2, h3, h4, h5, h6
{
margin: 0 0 1em;
line-height: 1.1;
}
h2, h3 { color: #003d5d; }
h2 { font-size: 218.75%; }
h3 { font-size: 137.5%; }
h4 { font-size: 118.75%; }
h5 { font-size: 112.5%; }
p { margin: 0 0 1em; }
img { border: none; }
a:link { color: #035389; }
a:visited { color: #09619C; }
a:focus
{
color: #fff;
background: #000;
}
a:hover { color: #000; }
a:active
{
color: #cc0000;
background: #fff;
}
table
{
margin: 1em 0;
border-collapse: collapse;
width: 100%;
}
table caption
{
text-align: left;
font-weight: bold;
padding: 0 0 5px;
text-transform: uppercase;
color: #236271;
}
table td, table th
{
text-align: left;
border: 1px solid #b1d2e4;
padding: 5px 10px;
vertical-align: top;
}
table th { background: #ecf7fd; }
blockquote
{
background: #ecf7fd;
margin: 1em 0;
padding: 1.5em;
}
code
{
background: #ecf7fd;
font: 115% courier, monaco, monospace;
margin: 0 .3em;
}
abbr, acronym
{
border-bottom: .1em dotted;
cursor: help;
}
#container
{
margin: 0 0px;
background: #fff;
}
#header
{
background: #ccc;
padding: 20px;
}
#header h1 { margin: 0; }
#navigation
{
float: left;
width: 100%;
background: #333;
}
#navigation ul
{
margin: 0;
padding: 0;
}
#navigation ul li
{
list-style-type: none;
display: inline;
}
#navigation li a
{
display: block;
float: left;
padding: 5px 10px;
color: #fff;
text-decoration: none;
border-right: 1px solid #fff;
}
#navigation li a:hover { background: #383; }
#content
{
clear: left;
padding: 20px;
}
#content h2
{
color: #000;
font-size: 160%;
margin: 0 0 .5em;
}
#footer
{
background: #ccc;
text-align: right;
padding: 20px;
height: 1%;
font-size: 12px;
}
.important, .error
{
color: red;
font-weight: bold;
}
.success
{
color: green;
font-weight: bold;
}
.button
{
border:1px solid #4b546a;-webkit-box-shadow: #B7B8B8 0px 1px 0px inset;-moz-box-shadow: #B7B8B8 0px 1px 0px inset; box-shadow: #B7B8B8 0px 1px 0px inset;-webkit-border-radius: br_rightpx br_leftpx -1px -1px;-moz-border-radius: br_rightpx br_leftpx -1px -1px;border-radius: br_rightpx br_leftpx -1px -1px; padding: 10px 10px 10px 10px; text-decoration:none; display:inline-block;text-shadow: -1px -1px 0 rgba(0,0,0,0.3);font-weight:bold; color: #FFFFFF;
background-color: #606c88; background-image: -webkit-gradient(linear, left top, left bottom, from(#606c88), to(#3f4c6b));
background-image: -webkit-linear-gradient(top, #606c88, #3f4c6b);
background-image: -moz-linear-gradient(top, #606c88, #3f4c6b);
background-image: -ms-linear-gradient(top, #606c88, #3f4c6b);
background-image: -o-linear-gradient(top, #606c88, #3f4c6b);
background-image: linear-gradient(to bottom, #606c88, #3f4c6b);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#606c88, endColorstr=#3f4c6b);
cursor: pointer;
}
.button:hover
{
border:1px solid #4b546a;
background-color: #4b546a; background-image: -webkit-gradient(linear, left top, left bottom, from(#4b546a), to(#2c354b));
background-image: -webkit-linear-gradient(top, #4b546a, #2c354b);
background-image: -moz-linear-gradient(top, #4b546a, #2c354b);
background-image: -ms-linear-gradient(top, #4b546a, #2c354b);
background-image: -o-linear-gradient(top, #4b546a, #2c354b);
background-image: linear-gradient(to bottom, #4b546a, #2c354b);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#4b546a, endColorstr=#2c354b);
}
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>
<?php echo PAGE_TITLE; ?>
</h1>
</div>
<div id="content">
<?php if (!isset($_REQUEST['submitted'])): ?>
<h2>
Confirm Migration
</h2>
<p>
Use this tool to migrate your user, files, folders and payments data from XImageSharing Pro into a Reservo install.
</p>
<p>
To start, upload this file to the root of your Reservo install, ensure you've set your configuration at the top of this php script, then click 'start migration' below. To confirm, we've loaded your existing XImageSharing table sizes below.
</p>
<p style='padding-top: 4px; padding-bottom: 4px;'>
<table style='width: auto;'>
<tr>
<th style='width: 150px;'>XIS Table:</th>
<th style='width: 150px;'>Total Rows:</th>
</tr>
<tr>
<td>Servers:</td>
<td><?php echo $xfsStats['totalServers']; ?></td>
</tr>
<tr>
<td>Files:</td>
<td><?php echo $xfsStats['totalFiles']; ?></td>
</tr>
<tr>
<td>Users:</td>
<td><?php echo $xfsStats['totalUsers']; ?></td>
</tr>
<tr>
<td>Folders:</td>
<td><?php echo $xfsStats['totalFolders']; ?></td>
</tr>
<tr>
<td>Payments: (paid)</td>
<td><?php echo $xfsStats['totalPayments']; ?></td>
</tr>
</table>
</p>
<p class="important">
IMPORTANT: When you start this process, any existing data in your Reservo database will be cleared. Please ensure you've backed up both databases beforehand so you can easily revert if you need to.
</p>
<p class="important">
This process wont actually migrate your files, it converts all the data in your XImageSharing database for Reservo. Although it does keep the same file names for your stored files. So after this is completed you should move all your files into the Reservo /files/ folder on each server.
</p>
<p style="padding-top: 4px;">
<form method="POST" action="migrate.php">
<input type="hidden" name="submitted" value="1"/>
<input type="submit" value="Start Migration" name="submit" class="button" onClick="return confirm('Are you sure you want to delete all the data from your Reservo database and import from the XImageSharing database?');"/>
</form>
</p>
<?php else: ?>
<h2>
Importing Data
</h2>
<p>
Clearing existing Reservo data...
<?php
// delete reservo data
$ysDBH->query('DELETE FROM download_tracker');
$ysDBH->query('DELETE FROM file');
$ysDBH->query('DELETE FROM file_folder');
$ysDBH->query('DELETE FROM payment_log');
$ysDBH->query('DELETE FROM sessions');
$ysDBH->query('DELETE FROM session_transfer');
$ysDBH->query('DELETE FROM stats');
$ysDBH->query('DELETE FROM users');
$ysDBH->query('DELETE FROM file_server');
echo 'done.';
?>
<?php updateScreen(); ?>
</p>
<p style='padding-top: 4px; padding-bottom: 4px;'>
<table style='width: auto;'>
<tr>
<th style='width: 150px;'>XIS Table:</th>
<th style='width: 150px;'>Total Rows:</th>
<th style='width: 150px;'>Reservo Table:</th>
<th style='width: 150px;'>Successful Rows:</th>
<th style='width: 150px;'>Failed Rows:</th>
</tr>
<?php
// do servers
$getServers = $xisDBH->query('SELECT srv_id, srv_name, srv_ip, srv_htdocs_url, srv_status, srv_created, srv_disk, srv_disk_max FROM Servers');
$success = 0;
$error = 0;
while($row = $getServers->fetch())
{
$statusId = 2;
if($row['srv_status'] == 'READONLY')
{
$statusId = 3;
}
$domain = $row['srv_htdocs_url'];
$domainArr = parse_url($domain);
$domain = $domainArr['host'];
// insert into Reservo db
$sql = "INSERT INTO file_server (id, serverLabel, serverType, ipAddress, statusId, storagePath, fileServerDomainName, scriptPath, totalSpaceUsed, maximumStorageBytes) VALUES (:id, :serverLabel, 'direct', :ipAddress, :statusId, 'files/', :fileServerDomainName, '/', :totalSpaceUsed, :maximumStorageBytes)";
$q = $ysDBH->prepare($sql);
$count = $q->execute(array(
':id' => $row['srv_id'],
':serverLabel' => $row['srv_name'],
':ipAddress' => $row['srv_ip'],
':statusId' => $statusId,
':fileServerDomainName' => $domain,
':totalSpaceUsed' => $row['srv_disk'],
':maximumStorageBytes' => $row['srv_disk_max'],
));
if ($count)
{
$success++;
}
else
{
$error++;
}
}
?>
<tr>
<td>Servers:</td>
<td><?php echo $xfsStats['totalServers']; ?></td>
<td>file_server:</td>
<td><?php echo $success; ?></td>
<td><?php echo $error; ?></td>
</tr>
<?php updateScreen(); ?>
<?php
// do files
$getFiles = $xisDBH->query('SELECT file_id, usr_id, file_name, file_code, file_fld_id, file_views AS file_downloads, file_size, file_ip, file_last_view AS file_last_download, file_created, srv_id FROM Files');
$success = 0;
$error = 0;
$fileMoveErrors = array();
while($row = $getFiles->fetch())
{
$dbFileStorageValue = $row['file_code'];
// apprend file path
if((int)XIMAGESHARING_FOLDER_GROUPING > 0)
{
$actualFolderId = floor((int)$row['file_id']/5000);
$formattedFolderId = str_pad($actualFolderId, 5, "0", STR_PAD_LEFT);
$dbFileStorageValue = $formattedFolderId.'/'.$dbFileStorageValue;
}
// insert into Reservo db
$sql = "INSERT INTO file (id, originalFilename, shortUrl, fileType, extension, fileSize, localFilePath, userId, totalDownload, uploadedIP, uploadedDate, statusId, visits, lastAccessed, deleteHash, folderId, serverId, accessPassword) VALUES (:id, :originalFilename, :shortUrl, :fileType, :extension, :fileSize, :localFilePath, :userId, :totalDownload, :uploadedIP, :uploadedDate, :statusId, :visits, :lastAccessed, :deleteHash, :folderId, :serverId, :accessPassword)";
$q = $ysDBH->prepare($sql);
$count = $q->execute(array(
':id' => $row['file_id'],
':originalFilename' => $row['file_name'],
':shortUrl' => $row['file_code'],
':fileType' => guess_mime_type($row['file_name']),
':extension' => strtolower(get_file_extension($row['file_name'])),
':fileSize' => $row['file_size'],
':localFilePath' => $dbFileStorageValue,
':userId' => ((int)$row['usr_id']==0?'null':$row['usr_id']),
':totalDownload' => $row['file_downloads'],
':uploadedIP' => long2Ip32bit($row['file_ip']),
':uploadedDate' => $row['file_created'],
':statusId' => 1,
':visits' => $row['file_downloads'],
':lastAccessed' => $row['file_last_download'],
':deleteHash' => MD5($row['file_id'].rand(10000,99999).$row['file_created']),
':folderId' => $row['file_fld_id'],
':serverId' => $row['srv_id'],
':accessPassword' => null,
));
if ($count)
{
$success++;
}
else
{
$error++;
}
}
?>
<tr>
<td>Files:</td>
<td><?php echo $xfsStats['totalFiles']; ?></td>
<td>file:</td>
<td><?php echo $success; ?></td>
<td><?php echo $error; ?></td>
</tr>
<?php updateScreen(); ?>
<?php
// do users
$getUsers = $xisDBH->query('SELECT usr_id, usr_login, DECODE( usr_password, \'' . XIMAGESHARING_PASSWORD_HASH . '\' ) AS raw_password, usr_email, usr_adm, usr_status, usr_disk_space, usr_premium_expire, usr_created, usr_lastlogin, usr_lastip FROM Users ORDER BY usr_id DESC');
$success = 0;
$error = 0;
while($row = $getUsers->fetch())
{
// insert into Reservo db
$sql = "INSERT INTO users (id, username, password, level_id, email, lastlogindate, lastloginip, status, storageLimitOverride, datecreated, createdip, paidExpiryDate, paymentTracker, identifier) VALUES (:id, :username, :password, :level_id, :email, :lastlogindate, :lastloginip, :status, :storageLimitOverride, :datecreated, :createdip, :paidExpiryDate, :paymentTracker, :identifier)";
$q = $ysDBH->prepare($sql);
$userLevel = 1;
if ($row['usr_adm'] == 1)
{
$userLevel = 20;
}
elseif (strtotime($row['usr_premium_expire']) > time())
{
$userLevel = 2;
}
$status = 'active';
if ($row['usr_status'] == 'PENDING')
{
$status = 'pending';
}
elseif ($row['usr_status'] == 'BANNED')
{
$status = 'suspended';
}
$disk_space = '';
if ($row['usr_disk_space'] > 0)
{
$disk_space = $row['usr_disk_space'] * 1048576;
}
$count = $q->execute(array(
':id' => $row['usr_id'],
':username' => $row['usr_login'],
':password' => MD5($row['raw_password']),
':level_id' => $userLevel,
':email' => $row['usr_email'],
':lastlogindate' => $row['usr_lastlogin'],
':lastloginip' => long2Ip32bit($row['usr_lastip']),
':status' => $status,
':storageLimitOverride' => $disk_space,
':datecreated' => $row['usr_created'],
':createdip' => long2Ip32bit($row['usr_lastip']),
':paidExpiryDate' => $row['usr_premium_expire'],
':paymentTracker' => MD5(microtime() . $row['usr_id']),
':identifier' => MD5(microtime() . $row['usr_id'] . microtime()),
));
if($q->errorCode() == 0)
{
$success++;
}
else
{
if($error < 100)
{
$errorLocal = $q->errorInfo();
echo 'Skipped Row: '.$errorLocal[2]."<br/>";
}
if($error == 100)
{
echo "<strong>... [truncated insert errors to first 100]</strong><br/>";
}
$error++;
}
}
?>
<tr>
<td>Users:</td>
<td><?php echo $xfsStats['totalUsers']; ?></td>
<td>users:</td>
<td><?php echo $success; ?></td>
<td><?php echo $error; ?></td>
</tr>
<?php updateScreen(); ?>
<?php
// do folders
$getFolders = $xisDBH->query('SELECT fld_id, usr_id, fld_name FROM Folders');
$success = 0;
$error = 0;
while($row = $getFolders->fetch())
{
// insert into Reservo db
$sql = "INSERT INTO file_folder (id, userId, folderName, isPublic) VALUES (:id, :userId, :folderName, :isPublic)";
$q = $ysDBH->prepare($sql);
$count = $q->execute(array(
':id' => $row['fld_id'],
':userId' => $row['usr_id'],
':folderName' => $row['fld_name'],
':isPublic' => 0,
));
if ($count)
{
$success++;
}
else
{
$error++;
}
}
?>
<tr>
<td>Folders:</td>
<td><?php echo $xfsStats['totalFolders']; ?></td>
<td>file_folder:</td>
<td><?php echo $success; ?></td>
<td><?php echo $error; ?></td>
</tr>
<?php updateScreen(); ?>
<?php
// do payments
$getPayments = $xisDBH->query('SELECT id, usr_id, amount, status, created, pay_info AS pay_email, pay_type FROM Payments WHERE status=\'PAID\'');
$success = 0;
$error = 0;
while($row = $getPayments->fetch())
{
// figure out status
$newStatus = 'cancelled';
switch($row['status'])
{
case 'PENDING':
$newStatus = 'pending';
break;
case 'PAID':
$newStatus = 'paid';
break;
// 'REJECTED':
default:
$newStatus = 'cancelled';
break;
}
// insert withdraw request
$sql = "INSERT INTO plugin_reward_withdraw_request (id, reward_user_id, requested_date, amount, status, payment_date, payment_notes) VALUES (:id, :reward_user_id, :requested_date, :amount, :status, :payment_date, :payment_notes)";
$q = $ysDBH->prepare($sql);
$count = $q->execute(array(
':id' => $row['id'],
':reward_user_id' => $row['reward_user_id'],
':requested_date' => $row['created'],
':amount' => $row['amount'],
':status' => $newStatus,
':payment_date' => $row['created'],
':payment_notes' => $row['pay_type'].' '.$row['pay_email'],
));
if ($count)
{
$success++;
}
else
{
$error++;
}
}
?>
<tr>
<td>Payments: (paid)</td>
<td><?php echo $xfsStats['totalPayments']; ?></td>
<td>payment_log:</td>
<td><?php echo $success; ?></td>
<td><?php echo $error; ?></td>
</tr>
<?php updateScreen(); ?>
</table>
</p>
<?php
if (COUNT($fileMoveErrors) > 0)
{
echo '<p class="error">';
foreach ($fileMoveErrors AS $k => $fileMoveError)
{
// only show first 100
if ($k < 100)
{
echo '- ' . $fileMoveError . '<br/>';
}
}
echo '</p>';
}
?>
<p>
Import finished. Note that your admin login to Reservo will be updated to reflect your old XImageSharing one.
</p>
<p style="padding-top: 4px;">
<form method="POST" action="migrate.php">
<input type="submit" value="Restart" name="submit" class="button"/>
</form>
</p>
<?php endif; ?>
</div>
<div id="footer">
Copyright © <?php echo date('Y'); ?> <a href="https://reservo.co" target="_blank">Reservo.co</a>
</div>
</div>
</body>
</html>
<?php
// local functions
function updateScreen()
{
flush();
ob_flush();
}
function get_file_extension($file_name)
{
return substr(strrchr($file_name, '.'), 1);
}
function long2Ip32bit($ip)
{
return long2ip((float) $ip);
}
function guess_mime_type($filename)
{
$mime_types = array(
'txt' => 'text/plain',
'htm' => 'text/html',
'html' => 'text/html',
'php' => 'text/html',
'css' => 'text/css',
'js' => 'application/javascript',
'json' => 'application/json',
'xml' => 'application/xml',
'swf' => 'application/x-shockwave-flash',
'flv' => 'video/x-flv',
// images
'png' => 'image/png',
'jpe' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'gif' => 'image/gif',
'bmp' => 'image/bmp',
'ico' => 'image/vnd.microsoft.icon',
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'svg' => 'image/svg+xml',
'svgz' => 'image/svg+xml',
// archives
'zip' => 'application/zip',
'rar' => 'application/x-rar-compressed',
'exe' => 'application/x-msdownload',
'msi' => 'application/x-msdownload',
'cab' => 'application/vnd.ms-cab-compressed',
// audio/video
'mp3' => 'audio/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
// adobe
'pdf' => 'application/pdf',
'psd' => 'image/vnd.adobe.photoshop',
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
// ms office
'doc' => 'application/msword',
'rtf' => 'application/rtf',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
// open office
'odt' => 'application/vnd.oasis.opendocument.text',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'avi' => 'video/avi',
);
$ext = strtolower(array_pop(explode('.', $filename)));
if (array_key_exists($ext, $mime_types))
{
return $mime_types[$ext];
}
else
{
return 'application/octet-stream';
}
}
?>