~automne-team/automne/trunk

« back to all changes in this revision

Viewing changes to automne/phpMyAdmin/view_operations.php

  • Committer: sebastien-pauchet
  • Date: 2012-02-15 16:47:40 UTC
  • mfrom: (363.2.105 4.2)
  • Revision ID: seb@automne-cms.org-20120215164740-xrk26iafkvztwv6s
Merge stable branch 4.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/* vim: set expandtab sw=4 ts=4 sts=4: */
 
3
/**
 
4
 *
 
5
 * @package phpMyAdmin
 
6
 */
 
7
 
 
8
/**
 
9
 *
 
10
 */
 
11
require_once './libraries/common.inc.php';
 
12
 
 
13
$pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
 
14
 
 
15
/**
 
16
 * Runs common work
 
17
 */
 
18
require './libraries/tbl_common.php';
 
19
$url_query .= '&amp;goto=view_operations.php&amp;back=view_operations.php';
 
20
$url_params['goto'] = $url_params['back'] = 'view_operations.php';
 
21
 
 
22
/**
 
23
 * Gets tables informations
 
24
 */
 
25
 
 
26
require './libraries/tbl_info.inc.php';
 
27
$reread_info = false;
 
28
 
 
29
/**
 
30
 * Updates if required
 
31
 */
 
32
if (isset($_REQUEST['submitoptions'])) {
 
33
    $_message = '';
 
34
    $warning_messages = array();
 
35
 
 
36
    if (isset($_REQUEST['new_name'])) {
 
37
        if ($pma_table->rename($_REQUEST['new_name'], null, $is_view = true)) {
 
38
            $_message .= $pma_table->getLastMessage();
 
39
            $result = true;
 
40
            $GLOBALS['table'] = $pma_table->getName();
 
41
            $reread_info = true;
 
42
            $reload = true;
 
43
        } else {
 
44
            $_message .= $pma_table->getLastError();
 
45
            $result = false;
 
46
        }
 
47
    }
 
48
}
 
49
 
 
50
/**
 
51
 * Displays top menu links
 
52
 */
 
53
require_once './libraries/tbl_links.inc.php';
 
54
 
 
55
if (isset($result)) {
 
56
    // set to success by default, because result set could be empty
 
57
    // (for example, a table rename)
 
58
    $_type = 'success';
 
59
    if (empty($_message)) {
 
60
        $_message = $result ? __('Your SQL query has been executed successfully') : __('Error');
 
61
        // $result should exist, regardless of $_message
 
62
        $_type = $result ? 'success' : 'error';
 
63
    }
 
64
    if (! empty($warning_messages)) {
 
65
        $_message = new PMA_Message;
 
66
        $_message->addMessages($warning_messages);
 
67
        $_message->isError(true);
 
68
        unset($warning_messages);
 
69
    }
 
70
    PMA_showMessage($_message, $sql_query, $_type, $is_view = true);
 
71
    unset($_message, $_type);
 
72
}
 
73
 
 
74
$url_params['goto'] = 'view_operations.php';
 
75
$url_params['back'] = 'view_operations.php';
 
76
 
 
77
/**
 
78
 * Displays the page
 
79
 */
 
80
?>
 
81
<!-- Table operations -->
 
82
<div class="operations_half_width">
 
83
<form method="post" action="view_operations.php">
 
84
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
 
85
<input type="hidden" name="reload" value="1" />
 
86
<fieldset>
 
87
    <legend><?php echo __('Operations'); ?></legend>
 
88
 
 
89
    <table>
 
90
    <!-- Change view name -->
 
91
    <tr><td><?php echo __('Rename view to'); ?></td>
 
92
        <td><input type="text" size="20" name="new_name" onfocus="this.select()"
 
93
                value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
 
94
        </td>
 
95
    </tr>
 
96
    </table>
 
97
</fieldset>
 
98
<fieldset class="tblFooters">
 
99
        <input type="submit" name="submitoptions" value="<?php echo __('Go'); ?>" />
 
100
</fieldset>
 
101
</form>
 
102
</div>
 
103
 
 
104
<?php
 
105
/**
 
106
 * Displays the footer
 
107
 */
 
108
require './libraries/footer.inc.php';
 
109
?>