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