1 | <?php |
---|
2 | define('PHPWG_ROOT_PATH','../../../'); |
---|
3 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
4 | |
---|
5 | if (!is_admin()) die('Access denied'); |
---|
6 | ?> |
---|
7 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
---|
8 | "http://www.w3.org/TR/html4/strict.dtd"> |
---|
9 | <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"> |
---|
10 | <head> |
---|
11 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
---|
12 | <title>GuestBook import</title> |
---|
13 | |
---|
14 | <style> |
---|
15 | h3 { color:red; } |
---|
16 | </style> |
---|
17 | </head> |
---|
18 | |
---|
19 | <body> |
---|
20 | <h2>GuestBook import</h2> |
---|
21 | |
---|
22 | <?php |
---|
23 | $show_form = true; |
---|
24 | |
---|
25 | if (isset($_POST['image_id'])) |
---|
26 | { |
---|
27 | if (!preg_match('#^[0-9]+$#', $_POST['image_id'])) |
---|
28 | { |
---|
29 | echo '<h3>Incorrect image Id</h3><br>'; |
---|
30 | } |
---|
31 | else |
---|
32 | { |
---|
33 | $query = ' |
---|
34 | SELECT * FROM '.COMMENTS_TABLE.' |
---|
35 | WHERE image_id = '.$_POST['image_id'].' |
---|
36 | ;'; |
---|
37 | $comms = hash_from_query($query, 'id'); |
---|
38 | |
---|
39 | if (!count($comms)) |
---|
40 | { |
---|
41 | echo '<h3>No comments for this picture</h3><br>'; |
---|
42 | } |
---|
43 | else |
---|
44 | { |
---|
45 | mass_inserts( |
---|
46 | GUESTBOOK_TABLE, |
---|
47 | array('date', 'author', 'author_id', 'anonymous_id', 'email', 'website', 'content', 'rate', 'validated', 'validation_date'), |
---|
48 | $comms |
---|
49 | ); |
---|
50 | |
---|
51 | echo '<h3>'.count($comms).' comments imported into the Guestbook</h3><br>'; |
---|
52 | $show_form = false; |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | if ($show_form) |
---|
58 | { |
---|
59 | ?> |
---|
60 | Just enter the id of your old guestbook picture (the Id can be found a the picture edition page, near the thumbnail) and click the <b>import</b> button. |
---|
61 | <form action="" method="post"> |
---|
62 | <label>Image id. <input type="text" size="5" name="image_id"></label><br> |
---|
63 | <input type="submit" value="import"> |
---|
64 | </form> |
---|
65 | |
---|
66 | <?php |
---|
67 | } |
---|
68 | ?> |
---|
69 | |
---|
70 | <br> |
---|
71 | <a href="<?php echo GUESTBOOK_ADMIN; ?>-config">Go back</a> |
---|
72 | |
---|
73 | </body> |
---|
74 | </html> |
---|