Exemplo n.º 1
0
 function testShowDocuNotReplaceHelpImg()
 {
     $GLOBALS['cfg']['ReplaceHelpImg'] = false;
     $anchor = "relation";
     $expected = '[<a href="Documentation.html#' . $anchor . '" target="documentation">' . __('Documentation') . '</a>]';
     $this->assertEquals($expected, PMA_showDocu($anchor));
 }
Exemplo n.º 2
0
    function testShowDocu()
    {
        $anchor = "relation";
        $expected = '<a href="Documentation.html#' . $anchor . '" target="documentation">'
                  . '<img src="themes/dot.gif" title="' . __('Documentation') . '" '
                  . 'alt="' . __('Documentation') . '" class="icon ic_b_help" /></a>';

        $this->assertEquals($expected, PMA_showDocu($anchor));

    }
/**
 * Displays for for language selection
 *
 * @access  public
 */
function PMA_select_language($use_fieldset = false, $show_doc = true)
{
    if (count($GLOBALS['available_languages']) == 1) {
        // no use in switching languages, there is only one available
        return;
    }
    global $cfg, $lang;
    ?>

<form method="post" action="index.php" target="_parent">
    <?php 
    $_form_params = array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']);
    echo PMA_generate_common_hidden_inputs($_form_params);
    // For non-English, display "Language" with emphasis because it's
    // not a proper word in the current language; we show it to help
    // people recognize the dialog
    $language_title = __('Language') . (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
    if ($show_doc) {
        $language_title .= PMA_showDocu('faq7_2');
    }
    if ($use_fieldset) {
        echo '<fieldset><legend lang="en" dir="ltr">' . $language_title . '</legend>';
    } else {
        echo '<bdo lang="en" dir="ltr"><label for="sel-lang">' . $language_title . ':</label></bdo>';
    }
    ?>

    <select name="lang" class="autosubmit" lang="en" dir="ltr" id="sel-lang">
    <?php 
    uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
    foreach ($GLOBALS['available_languages'] as $id => $tmplang) {
        $lang_name = PMA_langName($tmplang);
        //Is current one active?
        if ($lang == $id) {
            $selected = ' selected="selected"';
        } else {
            $selected = '';
        }
        echo '        ';
        echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . '</option>' . "\n";
    }
    ?>

    </select>
    <?php 
    if ($use_fieldset) {
        echo '</fieldset>';
    }
    ?>
</form>
    <?php 
}
Exemplo n.º 4
0
/**
 * Displays authentication form
 *
 * this function MUST exit/quit the application
 *
 * @global  string    the last connection error
 *
 * @access  public
 */
function PMA_auth()
{
    global $conn_error;
    /* Perform logout to custom URL */
    if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
        PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
        exit;
    }
    /* No recall if blowfish secret is not configured as it would produce garbage */
    if ($GLOBALS['cfg']['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) {
        $default_user = $GLOBALS['PHP_AUTH_USER'];
        $default_server = $GLOBALS['pma_auth_server'];
        $autocomplete = '';
    } else {
        $default_user = '';
        $default_server = '';
        // skip the IE autocomplete feature.
        $autocomplete = ' autocomplete="off"';
    }
    $cell_align = $GLOBALS['text_dir'] == 'ltr' ? 'left' : 'right';
    // Defines the charset to be used
    header('Content-Type: text/html; charset=utf-8');
    /* HTML header; do not show here the PMA version to improve security */
    $page_title = 'phpMyAdmin ';
    include './libraries/header_meta_style.inc.php';
    // if $page_title is set, this script uses it as the title:
    include './libraries/header_scripts.inc.php';
    ?>
</head>

<body class="loginform">

    <?php 
    if (file_exists(CUSTOM_HEADER_FILE)) {
        include CUSTOM_HEADER_FILE;
    }
    ?>

<div class="container">
<a href="<?php 
    echo PMA_linkURL('http://www.phpmyadmin.net/');
    ?>
" target="_blank" class="logo"><?php 
    $logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png';
    if (@file_exists($logo_image)) {
        echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />';
    } else {
        echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' . 'border="0" width="88" height="31" alt="phpMyAdmin" />';
    }
    ?>
</a>
<h1>
    <?php 
    echo sprintf(__('Welcome to %s'), '<bdo dir="ltr" lang="en">' . $page_title . '</bdo>');
    ?>
</h1>
    <?php 
    // Show error message
    if (!empty($conn_error)) {
        PMA_Message::rawError($conn_error)->display();
    }
    echo "<noscript>\n";
    PMA_message::error(__("Javascript must be enabled past this point"))->display();
    echo "</noscript>\n";
    echo "<div class='hide js-show'>";
    // Displays the languages form
    if (empty($GLOBALS['cfg']['Lang'])) {
        include_once './libraries/display_select_lang.lib.php';
        // use fieldset, don't show doc link
        PMA_select_language(true, false);
    }
    echo "</div>";
    ?>
<br />
<!-- Login form -->
<form method="post" action="index.php" name="login_form"<?php 
    echo $autocomplete;
    ?>
 target="_top" class="login hide js-show">
    <fieldset>
    <legend>
<?php 
    echo __('Log in');
    echo PMA_showDocu('');
    ?>
</legend>

<?php 
    if ($GLOBALS['cfg']['AllowArbitraryServer']) {
        ?>
        <div class="item">
            <label for="input_servername" title="<?php 
        echo __('You can enter hostname/IP address and port separated by space.');
        ?>
"><?php 
        echo __('Server:');
        ?>
</label>
            <input type="text" name="pma_servername" id="input_servername" value="<?php 
        echo htmlspecialchars($default_server);
        ?>
" size="24" class="textfield" title="<?php 
        echo __('You can enter hostname/IP address and port separated by space.');
        ?>
" />
        </div>
<?php 
    }
    ?>
        <div class="item">
            <label for="input_username"><?php 
    echo __('Username:'******'Password:'******'cfg']['Servers']) > 1) {
        ?>
        <div class="item">
            <label for="select_server"><?php 
        echo __('Server Choice');
        ?>
:</label>
            <select name="server" id="select_server"
        <?php 
        if ($GLOBALS['cfg']['AllowArbitraryServer']) {
            echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" ';
        }
        echo '>';
        include_once './libraries/select_server.lib.php';
        PMA_select_server(false, false);
        echo '</select></div>';
    } else {
        echo '    <input type="hidden" name="server" value="' . $GLOBALS['server'] . '" />';
    }
    // end if (server choice)
    ?>
    </fieldset>
    <fieldset class="tblFooters">
        <input value="<?php 
    echo __('Go');
    ?>
" type="submit" id="input_go" />
    <?php 
    $_form_params = array();
    if (!empty($GLOBALS['target'])) {
        $_form_params['target'] = $GLOBALS['target'];
    }
    if (!empty($GLOBALS['db'])) {
        $_form_params['db'] = $GLOBALS['db'];
    }
    if (!empty($GLOBALS['table'])) {
        $_form_params['table'] = $GLOBALS['table'];
    }
    // do not generate a "server" hidden field as we want the "server"
    // drop-down to have priority
    echo PMA_generate_common_hidden_inputs($_form_params, '', 0, 'server');
    ?>
    </fieldset>
</form>

    <?php 
    // BEGIN Swekey Integration
    Swekey_login('input_username', 'input_go');
    // END Swekey Integration
    // show the "Cookies required" message only if cookies are disabled
    // (we previously tried to set some cookies)
    if (empty($_COOKIE)) {
        trigger_error(__('Cookies must be enabled past this point.'), E_USER_NOTICE);
    }
    if ($GLOBALS['error_handler']->hasDisplayErrors()) {
        echo '<div>';
        $GLOBALS['error_handler']->dispErrors();
        echo '</div>';
    }
    ?>
</div>
    <?php 
    if (file_exists(CUSTOM_FOOTER_FILE)) {
        include CUSTOM_FOOTER_FILE;
    }
    ?>
<script type="text/javascript">
//<![CDATA[
// show login form in top frame.
if (top != self || document.body.className != 'loginform') {
    window.top.location.href=location;
}
//]]>
</script>
</body>
</html>
    <?php 
    exit;
}
Exemplo n.º 5
0
/**
 * prints bookmark fieldset
 *
 * @usedby  PMA_sqlQueryForm()
 */
function PMA_sqlQueryFormBookmark()
{
    $bookmark_list = PMA_Bookmark_getList($GLOBALS['db']);
    if (!$bookmark_list || count($bookmark_list) < 1) {
        return;
    }
    echo '<fieldset id="bookmarkoptions">';
    echo '<legend>';
    echo __('Bookmarked SQL query') . '</legend>' . "\n";
    echo '<div class="formelement">';
    echo '<select name="id_bookmark" id="id_bookmark">' . "\n";
    echo '<option value="">&nbsp;</option>' . "\n";
    foreach ($bookmark_list as $key => $value) {
        echo '<option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
    }
    // &nbsp; is required for correct display with styles/line height
    echo '</select>&nbsp;' . "\n";
    echo '</div>' . "\n";
    echo '<div class="formelement">' . "\n";
    echo __('Variable');
    echo PMA_showDocu('faqbookmark');
    echo '<input type="text" name="bookmark_variable" class="textfield"' . ' size="10" />' . "\n";
    echo '</div>' . "\n";
    echo '<div class="formelement">' . "\n";
    echo '<input type="radio" name="action_bookmark" value="0"' . ' id="radio_bookmark_exe" checked="checked" />' . '<label for="radio_bookmark_exe">' . __('Submit') . '</label>' . "\n";
    echo '<input type="radio" name="action_bookmark" value="1"' . ' id="radio_bookmark_view" />' . '<label for="radio_bookmark_view">' . __('View only') . '</label>' . "\n";
    echo '<input type="radio" name="action_bookmark" value="2"' . ' id="radio_bookmark_del" />' . '<label for="radio_bookmark_del">' . __('Delete') . '</label>' . "\n";
    echo '</div>' . "\n";
    echo '<div class="clearfloat"></div>' . "\n";
    echo '</fieldset>' . "\n";
    echo '<fieldset id="bookmarkoptionsfooter" class="tblFooters">' . "\n";
    echo '<input type="submit" name="SQL" id="button_submit_bookmark" value="' . __('Go') . '" />';
    echo '<div class="clearfloat"></div>' . "\n";
    echo '</fieldset>' . "\n";
}
            </form>
        </div>
        <?php 
if (file_exists('./setup/index.php')) {
    // show only if setup script is available, allows to disable this message
    // by simply removing setup directory
    ?>
        <div class="group">
            <h2><?php 
    echo __('More settings');
    ?>
</h2>
            <div class="group-cnt">
                <?php 
    echo sprintf(__('You can set more settings by modifying config.inc.php, eg. by using %sSetup script%s.'), '<a href="setup/index.php">', '</a>');
    echo PMA_showDocu('setup_script');
    ?>
            </div>
        </div>
        <?php 
}
?>
    </div>
    <div id="main_pane_right">
        <div class="group">
            <h2><?php 
echo __('Export');
?>
</h2>
            <div class="click-hide-message group-cnt" style="display:none">
                <?php 
Exemplo n.º 7
0
 * complain ;-)
 */
if (!$cfgRelation['relwork']) {
    echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n" . PMA_showDocu('relation') . "\n";
    require_once './libraries/footer.inc.php';
}
if (!$cfgRelation['displaywork']) {
    echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n" . PMA_showDocu('table_info') . "\n";
    require_once './libraries/footer.inc.php';
}
if (!isset($cfgRelation['table_coords'])) {
    echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n" . PMA_showDocu('table_coords') . "\n";
    require_once './libraries/footer.inc.php';
}
if (!isset($cfgRelation['pdf_pages'])) {
    echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n" . PMA_showDocu('pdf_pages') . "\n";
    require_once './libraries/footer.inc.php';
}
if ($cfgRelation['pdfwork']) {
    /**
     * User object created for presenting the HTML options
     * so, user can interact with it and perform export of relations schema
     */
    require_once './libraries/schema/User_Schema.class.php';
    $user_schema = new PMA_User_Schema();
    /**
     * This function will process the user defined pages
     * and tables which will be exported as Relational schema
     * you can set the table positions on the paper via scratchboard
     * for table positions, put the x,y co-ordinates
     * 
Exemplo n.º 8
0
                      }
                  );

              }
                window.setTimeout(perform_upload, 1000);

    <?php 
} else {
    // no plugin available
    ?>
                        $('#upload_form_status_info').html('<img src="<?php 
    echo $GLOBALS['pmaThemeImage'];
    ?>
ajax_clock_small.gif" alt="ajax clock" /> <?php 
    echo PMA_jsFormat(__('Please be patient, the file is being uploaded. Details about the upload are not available.'), false) . PMA_showDocu('faq2_9');
    ?>
');
                        $('#upload_form_status').css("display", "none");
    <?php 
}
// else
?>
                    }); // onclick
                }); // domready

                document.write('<form action="import.php" method="post" enctype="multipart/form-data" name="import"<?php 
if ($_SESSION[$SESSION_KEY]["handler"] != "noplugin") {
    echo ' target="import_upload_iframe"';
}
?>
	  $('status').tween('width', Math.round(percent)*2+'px');
	 } // else
    } // onComplete
   }); // [equest
   perform_upload = function () { 
     request_upload.send('r=' + $time() + $random(0, 100)); // hack for IE7,8 & webkit (Safari, Chrome, Arora...) 
   }
   periodical_upload = perform_upload.periodical(1000);
	<?php 
} else {
    ?>
	  $('upload_form_status_info').set('html', '<img src="<?php 
    echo $GLOBALS['pmaThemeImage'];
    ?>
ajax_clock_small.gif" alt="ajax clock" /> <?php 
    echo $strImportUploadInfoNotAvailable . PMA_showDocu('faq2_9');
    ?>
');
	  $('upload_form_status').setStyle("display", "none");
	<?php 
}
// else
?>
 
  }); // if click
}); // domready

  document.write('<form action="import.php" method="post" enctype="multipart/form-data" name="import"<?php 
if ($_SESSION[$SESSION_KEY]["handler"] != "noplugin") {
    echo ' target="import_upload_iframe"';
}
Exemplo n.º 10
0
 /**
  * Save this table's UI preferences into phpMyAdmin database.
  *
  * @return true|PMA_Message
  */
 protected function saveUiPrefsToDb()
 {
     $pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . PMA_backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
     $username = $GLOBALS['cfg']['Server']['user'];
     $sql_query = " REPLACE INTO " . $pma_table . " VALUES ('" . $username . "', '" . PMA_sqlAddSlashes($this->db_name) . "', '" . PMA_sqlAddSlashes($this->name) . "', '" . PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "', NULL)";
     $success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
     if (!$success) {
         $message = PMA_Message::error(__('Could not save table UI preferences'));
         $message->addMessage('<br /><br />');
         $message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
         return $message;
     }
     // Remove some old rows in table_uiprefs if it exceeds the configured maximum rows
     $sql_query = 'SELECT COUNT(*) FROM ' . $pma_table;
     $rows_count = PMA_DBI_fetch_value($sql_query);
     $max_rows = $GLOBALS['cfg']['Server']['MaxTableUiprefs'];
     if ($rows_count > $max_rows) {
         $num_rows_to_delete = $rows_count - $max_rows;
         $sql_query = ' DELETE FROM ' . $pma_table . ' ORDER BY last_update ASC' . ' LIMIT ' . $num_rows_to_delete;
         $success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
         if (!$success) {
             $message = PMA_Message::error(sprintf(__('Failed to cleanup table UI preferences (see $cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'), PMA_showDocu('cfg_Servers_MaxTableUiprefs')));
             $message->addMessage('<br /><br />');
             $message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
             print_r($message);
             return $message;
         }
     }
     return true;
 }
Exemplo n.º 11
0
/**
 * Function added to avoid path disclosures.
 * Called by each script that needs parameters, it displays
 * an error message and, by default, stops the execution.
 *
 * Not sure we could use a strMissingParameter message here,
 * would have to check if the error message file is always available
 *
 * @param array $params  The names of the parameters needed by the calling script.
 * @param bool  $request Whether to include this list in checking for special params.
 *
 * @return void
 *
 * @global  string  path to current script
 * @global  boolean flag whether any special variable was required
 *
 * @access  public
 */
function PMA_checkParameters($params, $request = true)
{
    global $checked_special;
    if (!isset($checked_special)) {
        $checked_special = false;
    }
    $reported_script_name = basename($GLOBALS['PMA_PHP_SELF']);
    $found_error = false;
    $error_message = '';
    foreach ($params as $param) {
        if ($request && $param != 'db' && $param != 'table') {
            $checked_special = true;
        }
        if (!isset($GLOBALS[$param])) {
            $error_message .= $reported_script_name . ': ' . __('Missing parameter:') . ' ' . $param . PMA_showDocu('faqmissingparameters') . '<br />';
            $found_error = true;
        }
    }
    if ($found_error) {
        PMA_fatalError($error_message, null, false);
    }
}
/**
 * string PMA_pluginGetOneOption(string $section, string $plugin_name, string $id, array &$opt)
 *
 * returns single option in a list element
 *
 * @uses    PMA_getString()
 * @uses    PMA_pluginCheckboxCheck()
 * @uses    PMA_pluginGetDefault()
 * @param   string  $section        name of config section in
 *                                  $GLOBALS['cfg'][$section] for plugin
 * @param   string  $plugin_name    unique plugin name
 * @param   string  $id             option id
 * @param   array   &$opt           plugin option details
 * @return  string                  table row with option
 */
function PMA_pluginGetOneOption($section, $plugin_name, $id, &$opt)
{
    $ret = "\n";
    if ($opt['type'] == 'bool') {
        $ret .= '<li>' . "\n";
        $ret .= '<input type="checkbox" name="' . $plugin_name . '_' . $opt['name'] . '"' . ' value="something" id="checkbox_' . $plugin_name . '_' . $opt['name'] . '"' . ' ' . PMA_pluginCheckboxCheck($section, $plugin_name . '_' . $opt['name']);
        if (isset($opt['force'])) {
            /* Same code is also few lines lower, update both if needed */
            $ret .= ' onclick="if (!this.checked &amp;&amp; ' . '(!document.getElementById(\'checkbox_' . $plugin_name . '_' . $opt['force'] . '\') ' . '|| !document.getElementById(\'checkbox_' . $plugin_name . '_' . $opt['force'] . '\').checked)) ' . 'return false; else return true;"';
        }
        $ret .= ' />';
        $ret .= '<label for="checkbox_' . $plugin_name . '_' . $opt['name'] . '">' . PMA_getString($opt['text']) . '</label>';
    } elseif ($opt['type'] == 'text') {
        $ret .= '<li>' . "\n";
        $ret .= '<label for="text_' . $plugin_name . '_' . $opt['name'] . '" class="desc">' . PMA_getString($opt['text']) . '</label>';
        $ret .= '<input type="text" name="' . $plugin_name . '_' . $opt['name'] . '"' . ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"' . ' id="text_' . $plugin_name . '_' . $opt['name'] . '"' . (isset($opt['size']) ? ' size="' . $opt['size'] . '"' : '') . (isset($opt['len']) ? ' maxlength="' . $opt['len'] . '"' : '') . ' />';
    } elseif ($opt['type'] == 'message_only') {
        $ret .= '<li>' . "\n";
        $ret .= '<p>' . PMA_getString($opt['text']) . '</p>';
    } elseif ($opt['type'] == 'select') {
        $ret .= '<li>' . "\n";
        $ret .= '<label for="select_' . $plugin_name . '_' . $opt['name'] . '" class="desc">' . PMA_getString($opt['text']) . '</label>';
        $ret .= '<select name="' . $plugin_name . '_' . $opt['name'] . '"' . ' id="select_' . $plugin_name . '_' . $opt['name'] . '">';
        $default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']);
        foreach ($opt['values'] as $key => $val) {
            $ret .= '<option value="' . $key . '"';
            if ($key == $default) {
                $ret .= ' selected="selected"';
            }
            $ret .= '>' . PMA_getString($val) . '</option>';
        }
        $ret .= '</select>';
    } elseif ($opt['type'] == 'radio') {
        $default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']);
        foreach ($opt['values'] as $key => $val) {
            $ret .= '<li><input type="radio" name="' . $plugin_name . '_' . $opt['name'] . '" value="' . $key . '" id="radio_' . $plugin_name . '_' . $opt['name'] . '_' . $key . '"';
            if ($key == $default) {
                $ret .= 'checked="checked"';
            }
            $ret .= ' />' . '<label for="radio_' . $plugin_name . '_' . $opt['name'] . '_' . $key . '">' . PMA_getString($val) . '</label></li>';
        }
    } elseif ($opt['type'] == 'hidden') {
        $ret .= '<li><input type="hidden" name="' . $plugin_name . '_' . $opt['name'] . '"' . ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"' . ' /></li>';
    } elseif ($opt['type'] == 'begin_group') {
        $ret .= '<div class="export_sub_options" id="' . $plugin_name . '_' . $opt['name'] . '">';
        if (isset($opt['text'])) {
            $ret .= '<h4>' . PMA_getString($opt['text']) . '</h4>';
        }
        $ret .= '<ul>';
    } elseif ($opt['type'] == 'end_group') {
        $ret .= '</ul></div>';
    } elseif ($opt['type'] == 'begin_subgroup') {
        /* each subgroup can have a header, which may also be a form element */
        $ret .= PMA_pluginGetOneOption($section, $plugin_name, $id, $opt['subgroup_header']) . '<li class="subgroup"><ul';
        if (isset($opt['subgroup_header']['name'])) {
            $ret .= ' id="ul_' . $opt['subgroup_header']['name'] . '">';
        } else {
            $ret .= '>';
        }
    } elseif ($opt['type'] == 'end_subgroup') {
        $ret .= '</ul></li>';
    } else {
        /* This should be seen only by plugin writers, so I do not thing this
         * needs translation. */
        $ret .= 'UNKNOWN OPTION ' . $opt['type'] . ' IN IMPORT PLUGIN ' . $plugin_name . '!';
    }
    if (isset($opt['doc'])) {
        if (count($opt['doc']) == 3) {
            $ret .= PMA_showMySQLDocu($opt['doc'][0], $opt['doc'][1], false, $opt['doc'][2]);
        } elseif (count($opt['doc']) == 1) {
            $ret .= PMA_showDocu($opt['doc'][0]);
        } else {
            $ret .= PMA_showMySQLDocu($opt['doc'][0], $opt['doc'][1]);
        }
    }
    // Close the list element after $opt['doc'] link is displayed
    if ($opt['type'] == 'bool' || $opt['type'] == 'text' || $opt['type'] == 'message_only' || $opt['type'] == 'select') {
        $ret .= '</li>';
    }
    $ret .= "\n";
    return $ret;
}
Exemplo n.º 13
0
}

if (! $cfgRelation['displaywork']) {
    echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n"
         . PMA_showDocu('table_info') . "\n";
    include_once 'libraries/footer.inc.php';
}

if (! isset($cfgRelation['table_coords'])) {
    echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n"
         . PMA_showDocu('table_coords') . "\n";
    include_once 'libraries/footer.inc.php';
}
if (! isset($cfgRelation['pdf_pages'])) {
    echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n"
         . PMA_showDocu('pdf_pages') . "\n";
    include_once 'libraries/footer.inc.php';
}

if ($cfgRelation['pdfwork']) {

    /**
     * User object created for presenting the HTML options
     * so, user can interact with it and perform export of relations schema
     */

    include_once 'libraries/schema/User_Schema.class.php';
    $user_schema = new PMA_User_Schema();

    /**
     * This function will process the user defined pages
	  $('status').tween('width', Math.round(percent)*2+'px');
	 } // else
    } // onComplete
   }); // [equest
   perform_upload = function () { 
     request_upload.send('r=' + $time() + $random(0, 100)); // hack for IE7,8 & webkit (Safari, Chrome, Arora...) 
   }
   periodical_upload = perform_upload.periodical(1000);
	<?php 
} else {
    ?>
	  $('upload_form_status_info').set('html', '<img src="<?php 
    echo $GLOBALS['pmaThemeImage'];
    ?>
ajax_clock_small.gif" alt="ajax clock" /> <?php 
    echo PMA_jsFormat($strImportUploadInfoNotAvailable) . PMA_showDocu('faq2_9');
    ?>
');
	  $('upload_form_status').setStyle("display", "none");
	<?php 
}
// else
?>
 
  }); // if click
}); // domready

  document.write('<form action="import.php" method="post" enctype="multipart/form-data" name="import"<?php 
if ($_SESSION[$SESSION_KEY]["handler"] != "noplugin") {
    echo ' target="import_upload_iframe"';
}
Exemplo n.º 15
0
/**
 * prints out diagnostic info for pma relation feature
 *
 * @param array $cfgRelation
 *
 * @return nothing
 */
function PMA_printRelationsParamDiagnostic($cfgRelation)
{
    $messages['error'] = '<font color="red"><strong>' . __('not OK') . '</strong></font> [ <a href="Documentation.html#%s" target="documentation">' . __('Documentation') . '</a> ]';
    $messages['ok'] = '<font color="green"><strong>' . __('OK') . '</strong></font>';
    $messages['enabled'] = '<font color="green">' . __('Enabled') . '</font>';
    $messages['disabled'] = '<font color="red">' . __('Disabled') . '</font>';
    if (false === $GLOBALS['cfg']['Server']['pmadb']) {
        echo 'PMA Database ... ' . sprintf($messages['error'], 'pmadb') . '<br />' . "\n" . __('General relation features') . ' <font color="green">' . __('Disabled') . '</font>' . "\n";
        return;
    }
    echo '<table>' . "\n";
    PMA_printDiagMessageForParameter('pmadb', $GLOBALS['cfg']['Server']['pmadb'], $messages, 'pmadb');
    PMA_printDiagMessageForParameter('relation', isset($cfgRelation['relation']), $messages, 'relation');
    PMA_printDiagMessageForFeature(__('General relation features'), 'relwork', $messages);
    PMA_printDiagMessageForParameter('table_info', isset($cfgRelation['table_info']), $messages, 'table_info');
    PMA_printDiagMessageForFeature(__('Display Features'), 'displaywork', $messages);
    PMA_printDiagMessageForParameter('table_coords', isset($cfgRelation['table_coords']), $messages, 'table_coords');
    PMA_printDiagMessageForParameter('pdf_pages', isset($cfgRelation['pdf_pages']), $messages, 'table_coords');
    PMA_printDiagMessageForFeature(__('Creation of PDFs'), 'pdfwork', $messages);
    PMA_printDiagMessageForParameter('column_info', isset($cfgRelation['column_info']), $messages, 'col_com');
    PMA_printDiagMessageForFeature(__('Displaying Column Comments'), 'commwork', $messages, false);
    PMA_printDiagMessageForFeature(__('Browser transformation'), 'mimework', $messages);
    if ($cfgRelation['commwork'] && !$cfgRelation['mimework']) {
        echo '<tr><td colspan=2 align="left">' . __('Please see the documentation on how to update your column_comments table') . '</td></tr>' . "\n";
    }
    PMA_printDiagMessageForParameter('bookmarktable', isset($cfgRelation['bookmark']), $messages, 'bookmark');
    PMA_printDiagMessageForFeature(__('Bookmarked SQL query'), 'bookmarkwork', $messages);
    PMA_printDiagMessageForParameter('history', isset($cfgRelation['history']), $messages, 'history');
    PMA_printDiagMessageForFeature(__('SQL history'), 'historywork', $messages);
    PMA_printDiagMessageForParameter('designer_coords', isset($cfgRelation['designer_coords']), $messages, 'designer_coords');
    PMA_printDiagMessageForFeature(__('Designer'), 'designerwork', $messages);
    PMA_printDiagMessageForParameter('recent', isset($cfgRelation['recent']), $messages, 'recent');
    PMA_printDiagMessageForFeature(__('Persistent recently used tables'), 'recentwork', $messages);
    PMA_printDiagMessageForParameter('table_uiprefs', isset($cfgRelation['table_uiprefs']), $messages, 'table_uiprefs');
    PMA_printDiagMessageForFeature(__('Persistent tables\' UI preferences'), 'uiprefswork', $messages);
    PMA_printDiagMessageForParameter('tracking', isset($cfgRelation['tracking']), $messages, 'tracking');
    PMA_printDiagMessageForFeature(__('Tracking'), 'trackingwork', $messages);
    PMA_printDiagMessageForParameter('userconfig', isset($cfgRelation['userconfig']), $messages, 'userconfig');
    PMA_printDiagMessageForFeature(__('User preferences'), 'userconfigwork', $messages);
    echo '</table>' . "\n";
    echo '<p>' . __('Quick steps to setup advanced features:') . '</p>';
    echo '<ul>';
    echo '<li>' . __('Create the needed tables with the <code>examples/create_tables.sql</code>.') . ' ' . PMA_showDocu('linked-tables') . '</li>';
    echo '<li>' . __('Create a pma user and give access to these tables.') . ' ' . PMA_showDocu('pmausr') . '</li>';
    echo '<li>' . __('Enable advanced features in configuration file (<code>config.inc.php</code>), for example by starting from <code>config.sample.inc.php</code>.') . ' ' . PMA_showDocu('quick_install') . '</li>';
    echo '<li>' . __('Re-login to phpMyAdmin to load the updated configuration file.') . '</li>';
    echo '</ul>';
}
Exemplo n.º 16
0
// Default to browse if no query set and we have table
// (needed for browsing from DefaultTabTable)
if (empty($sql_query) && strlen($table) && strlen($db)) {
    include_once 'libraries/bookmark.lib.php';
    $book_sql_query = PMA_Bookmark_get(
        $db,
        '\'' . PMA_sqlAddSlashes($table) . '\'',
        'label',
        false,
        true
    );

    if (! empty($book_sql_query)) {
        $GLOBALS['using_bookmark_message'] = PMA_message::notice(__('Using bookmark "%s" as default browse query.'));
        $GLOBALS['using_bookmark_message']->addParam($table);
        $GLOBALS['using_bookmark_message']->addMessage(PMA_showDocu('faq6_22'));
        $sql_query = $book_sql_query;
    } else {
        $sql_query = 'SELECT * FROM ' . PMA_backquote($table);
    }
    unset($book_sql_query);

    // set $goto to what will be displayed if query returns 0 rows
    $goto = 'tbl_structure.php';
} else {
    // Now we can check the parameters
    PMA_checkParameters(array('sql_query'));
}

// instead of doing the test twice
$is_drop_database = preg_match(
if (!PMA_DBI_checkDbExtension($GLOBALS['cfg']['Server']['extension'])) {
    // if it fails try alternative extension ...
    // and display an error ...
    /**
     * @todo add different messages for alternative extension
     * and complete fail (no alternative extension too)
     */
    PMA_warnMissingExtension($GLOBALS['cfg']['Server']['extension'], false, PMA_showDocu('faqmysql'));
    if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') {
        $alternativ_extension = 'mysqli';
    } else {
        $alternativ_extension = 'mysql';
    }
    if (!PMA_DBI_checkDbExtension($alternativ_extension)) {
        // if alternative fails too ...
        PMA_warnMissingExtension($GLOBALS['cfg']['Server']['extension'], true, PMA_showDocu('faqmysql'));
    }
    $GLOBALS['cfg']['Server']['extension'] = $alternativ_extension;
    unset($alternativ_extension);
}
/**
 * Including The DBI Plugin
 */
require_once './libraries/dbi/' . $GLOBALS['cfg']['Server']['extension'] . '.dbi.lib.php';
/**
 * runs a query
 *
 * @param string $query               SQL query to execte
 * @param mixed  $link                optional database link to use
 * @param int    $options             optional query options
 * @param bool   $cache_affected_rows whether to cache affected rows
Exemplo n.º 18
0
/**
 * Function added to avoid path disclosures.
 * Called by each script that needs parameters, it displays
 * an error message and, by default, stops the execution.
 *
 * Not sure we could use a strMissingParameter message here,
 * would have to check if the error message file is always available
 *
 * @param array $params  The names of the parameters needed by the calling script.
 * @param bool  $die     Stop the execution?
 *                       (Set this manually to false in the calling script
 *                       until you know all needed parameters to check).
 * @param bool  $request Whether to include this list in checking for special params.
 *
 * @global  string  path to current script
 * @global  boolean flag whether any special variable was required
 *
 * @access  public
 * @todo    use PMA_fatalError() if $die === true?
 */
function PMA_checkParameters($params, $die = true, $request = true)
{
    global $checked_special;
    if (!isset($checked_special)) {
        $checked_special = false;
    }
    $reported_script_name = basename($GLOBALS['PMA_PHP_SELF']);
    $found_error = false;
    $error_message = '';
    foreach ($params as $param) {
        if ($request && $param != 'db' && $param != 'table') {
            $checked_special = true;
        }
        if (!isset($GLOBALS[$param])) {
            $error_message .= $reported_script_name . ': ' . __('Missing parameter:') . ' ' . $param . PMA_showDocu('faqmissingparameters') . '<br />';
            $found_error = true;
        }
    }
    if ($found_error) {
        /**
         * display html meta tags
         */
        include_once './libraries/header_meta_style.inc.php';
        echo '</head><body><p>' . $error_message . '</p></body></html>';
        if ($die) {
            exit;
        }
    }
}
/**
 * Displays for for language selection
 *
 * @access  public
 */
function PMA_select_language($use_fieldset = FALSE, $show_doc = TRUE)
{
    global $cfg, $lang;
    ?>

<form method="post" action="index.php" target="_parent">
    <?php 
    $_form_params = array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']);
    echo PMA_generate_common_hidden_inputs($_form_params);
    // For non-English, display "Language" with emphasis because it's
    // not a proper word in the current language; we show it to help
    // people recognize the dialog
    $language_title = __('Language') . (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
    if ($show_doc) {
        $language_title .= PMA_showDocu('faq7_2');
    }
    if ($use_fieldset) {
        echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
    } else {
        echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
    }
    ?>

    <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
    <?php 
    uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
    foreach ($GLOBALS['available_languages'] as $id => $tmplang) {
        $lang_name = PMA_langName($tmplang);
        //Is current one active?
        if ($lang == $id) {
            $selected = ' selected="selected"';
        } else {
            $selected = '';
        }
        echo '        ';
        echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . '</option>' . "\n";
    }
    ?>

    </select>
    <?php 
    if ($use_fieldset) {
        echo '</fieldset>';
    }
    ?>

    <noscript>
    <?php 
    if ($use_fieldset) {
        echo '<fieldset class="tblFooters">';
    }
    ?>

        <input type="submit" value="Go" />
    <?php 
    if ($use_fieldset) {
        echo '</fieldset>';
    }
    ?>

    </noscript>
</form>
    <?php 
}