/**
 * Returns the html for create table.
 *
 * @param string $db database name
 *
 * @return string
 */
function PMA_getHtmlForCreateTable($db)
{
    $html = '<form id="create_table_form_minimal" method="post" ' . 'action="tbl_create.php">';
    $html .= '<fieldset>';
    $html .= '<legend>';
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $html .= PMA_Util::getImage('b_newtbl.png');
    }
    $html .= __('Create table');
    $html .= ' </legend>';
    $html .= PMA_URL_getHiddenInputs($db);
    $html .= '<div class="formelement">';
    $html .= __('Name') . ":";
    $html .= '  <input type="text" name="table" maxlength="64" ' . 'size="30" required="required" />';
    $html .= ' </div>';
    $html .= '  <div class="formelement">';
    $html .= __('Number of columns') . ":";
    $html .= '  <input type="number" min="1" name="num_fields" value="4" required="required" />';
    $html .= ' </div>';
    $html .= '  <div class="clearfloat"></div>';
    $html .= '</fieldset>';
    $html .= '<fieldset class="tblFooters">';
    $html .= '   <input type="submit" value="' . __('Go') . '" />';
    $html .= '</fieldset>';
    $html .= '</form>';
    return $html;
}
Beispiel #2
0
/**
 * Get HTML snippet for change database charset
 *
 * @param string $db    database name
 * @param string $table table name
 *
 * @return string $html_output
 */
function PMA_getHtmlForChangeDatabaseCharset($db, $table)
{
    $html_output = '<div class="operations_half_width">' . '<form id="change_db_charset_form" ';
    $html_output .= 'class="ajax" ';
    $html_output .= 'method="post" action="db_operations.php">';
    $html_output .= PMA_URL_getHiddenInputs($db, $table);
    $html_output .= '<fieldset>' . "\n" . '    <legend>';
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $html_output .= PMA_Util::getImage('s_asci.png') . '&nbsp';
    }
    $html_output .= '<label for="select_db_collation">' . __('Collation') . '</label>' . "\n" . '</legend>' . "\n" . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', isset($_REQUEST['db_collation']) ? $_REQUEST['db_collation'] : '', false) . '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="submit" name="submitcollation"' . ' value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n" . '</form></div>' . "\n";
    return $html_output;
}
Beispiel #3
0
/**
 * Function to get html for tracking report and tracking report export
 *
 * @param string  $url_query        url query
 * @param array   $data             data
 * @param array   $url_params       url params
 * @param boolean $selection_schema selection schema
 * @param boolean $selection_data   selection data
 * @param boolean $selection_both   selection both
 * @param int     $filter_ts_to     filter time stamp from
 * @param int     $filter_ts_from   filter time stamp tp
 * @param array   $filter_users     filter users
 *
 * @return string
 */
function PMA_getHtmlForTrackingReport($url_query, $data, $url_params, $selection_schema, $selection_data, $selection_both, $filter_ts_to, $filter_ts_from, $filter_users)
{
    $html = '<h3>' . __('Tracking report') . '  [<a href="tbl_tracking.php' . $url_query . '">' . __('Close') . '</a>]</h3>';
    $html .= '<small>' . __('Tracking statements') . ' ' . htmlspecialchars($data['tracking']) . '</small><br/>';
    $html .= '<br/>';
    list($str1, $str2, $str3, $str4, $str5) = PMA_getHtmlForElementsOfTrackingReport($selection_schema, $selection_data, $selection_both);
    // Prepare delete link content here
    $drop_image_or_text = '';
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $drop_image_or_text .= PMA_Util::getImage('b_drop.png', __('Delete tracking data row from report'));
    }
    if (PMA_Util::showText('ActionLinksMode')) {
        $drop_image_or_text .= __('Delete');
    }
    /*
     *  First, list tracked data definition statements
     */
    if (count($data['ddlog']) == 0 && count($data['dmlog']) == 0) {
        $msg = PMA_Message::notice(__('No data'));
        $msg->display();
    }
    $html .= PMA_getHtmlForTrackingReportExportForm1($data, $url_params, $selection_schema, $selection_data, $selection_both, $filter_ts_to, $filter_ts_from, $filter_users, $str1, $str2, $str3, $str4, $str5, $drop_image_or_text);
    $html .= PMA_getHtmlForTrackingReportExportForm2($url_params, $str1, $str2, $str3, $str4, $str5);
    $html .= "<br/><br/><hr/><br/>\n";
    return $html;
}
/**
 * Returns the html for Navigation Row.
 *
 * @param Array $url_params     Links parameters
 * @param int   $pos            Position to display
 * @param int   $num_rows       Number of results row
 * @param bool  $dontlimitchars Whether limit chars
 *
 * @return string
 */
function PMA_getNavigationRow($url_params, $pos, $num_rows, $dontlimitchars)
{
    $html = "";
    // we do not know how much rows are in the binlog
    // so we can just force 'NEXT' button
    if ($pos > 0) {
        $this_url_params = $url_params;
        if ($pos > $GLOBALS['cfg']['MaxRows']) {
            $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
        }
        $html .= '<a href="server_binlog.php' . PMA_URL_getCommon($this_url_params) . '"';
        if (PMA_Util::showIcons('TableNavigationLinksMode')) {
            $html .= ' title="' . _pgettext('Previous page', 'Previous') . '">';
        } else {
            $html .= '>' . _pgettext('Previous page', 'Previous');
        }
        // end if... else...
        $html .= ' &lt; </a> - ';
    }
    $this_url_params = $url_params;
    if ($pos > 0) {
        $this_url_params['pos'] = $pos;
    }
    if ($dontlimitchars) {
        unset($this_url_params['dontlimitchars']);
        $tempTitle = __('Truncate Shown Queries');
        $tempImgMode = 'partial';
    } else {
        $this_url_params['dontlimitchars'] = 1;
        $tempTitle = __('Show Full Queries');
        $tempImgMode = 'full';
    }
    $html .= '<a href="server_binlog.php' . PMA_URL_getCommon($this_url_params) . '" title="' . $tempTitle . '">' . '<img src="' . $GLOBALS['pmaThemeImage'] . 's_' . $tempImgMode . 'text.png" alt="' . $tempTitle . '" /></a>';
    // we do not now how much rows are in the binlog
    // so we can just force 'NEXT' button
    if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
        $this_url_params = $url_params;
        $this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
        $html .= ' - <a href="server_binlog.php' . PMA_URL_getCommon($this_url_params) . '"';
        if (PMA_Util::showIcons('TableNavigationLinksMode')) {
            $html .= ' title="' . _pgettext('Next page', 'Next') . '">';
        } else {
            $html .= '>' . _pgettext('Next page', 'Next');
        }
        // end if... else...
        $html .= ' &gt; </a>';
    }
    return $html;
}
/**
 * return HTML for Sql Query Form Insert
 *
 * @param string $query     query to display in the textarea
 * @param string $delimiter default delimiter to use
 *
 * @return string
 *
 * @usedby  PMA_getHtmlForSqlQueryForm()
 */
function PMA_getHtmlForSqlQueryFormInsert($query = '', $delimiter = ';')
{
    // enable auto select text in textarea
    if ($GLOBALS['cfg']['TextareaAutoSelect']) {
        $auto_sel = ' onclick="selectContent(this, sql_box_locked, true);"';
    } else {
        $auto_sel = '';
    }
    $locking = '';
    $height = $GLOBALS['cfg']['TextareaRows'] * 2;
    $table = '';
    $db = '';
    $fields_list = array();
    if (!mb_strlen($GLOBALS['db'])) {
        // prepare for server related
        $legend = sprintf(__('Run SQL query/queries on server %s'), '&quot;' . htmlspecialchars(!empty($GLOBALS['cfg']['Servers'][$GLOBALS['server']]['verbose']) ? $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['verbose'] : $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host']) . '&quot;');
    } elseif (!mb_strlen($GLOBALS['table'])) {
        // prepare for db related
        $db = $GLOBALS['db'];
        // if you want navigation:
        $tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . PMA_URL_getCommon(array('db' => $db)) . '"';
        $tmp_db_link .= '>' . htmlspecialchars($db) . '</a>';
        // else use
        // $tmp_db_link = htmlspecialchars($db);
        $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
        if (empty($query)) {
            $query = PMA_Util::expandUserString($GLOBALS['cfg']['DefaultQueryDatabase'], 'backquote');
        }
    } else {
        $table = $GLOBALS['table'];
        $db = $GLOBALS['db'];
        // Get the list and number of fields
        // we do a try_query here, because we could be in the query window,
        // trying to synchronize and the table has not yet been created
        $fields_list = $GLOBALS['dbi']->getColumns($db, $GLOBALS['table'], null, true);
        $tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . PMA_URL_getCommon(array('db' => $db)) . '"';
        $tmp_db_link .= '>' . htmlspecialchars($db) . '</a>';
        // else use
        // $tmp_db_link = htmlspecialchars($db);
        $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
        if (empty($query)) {
            $query = PMA_Util::expandUserString($GLOBALS['cfg']['DefaultQueryTable'], 'backquote');
        }
    }
    $legend .= ': ' . PMA_Util::showMySQLDocu('SELECT');
    if (count($fields_list)) {
        $sqlquerycontainer_id = 'sqlquerycontainer';
    } else {
        $sqlquerycontainer_id = 'sqlquerycontainerfull';
    }
    $html = '<a id="querybox"></a>' . '<div id="queryboxcontainer">' . '<fieldset id="queryboxf">';
    $html .= '<legend>' . $legend . '</legend>';
    $html .= '<div id="queryfieldscontainer">';
    $html .= '<div id="' . $sqlquerycontainer_id . '">' . '<textarea tabindex="100" name="sql_query" id="sqlquery"' . '  cols="' . $GLOBALS['cfg']['TextareaCols'] . '"' . '  rows="' . $height . '"' . '  dir="' . $GLOBALS['text_dir'] . '"' . $auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>';
    // Add buttons to generate query easily for
    // select all, single select, insert, update and delete
    if (count($fields_list)) {
        $html .= '<input type="button" value="SELECT *" id="selectall"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="SELECT" id="select"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="INSERT" id="insert"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="UPDATE" id="update"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="DELETE" id="delete"' . ' class="button sqlbutton" />';
    }
    $html .= '<input type="button" value="' . __('Clear') . '" id="clear"' . ' class="button sqlbutton" />';
    $html .= '</div>' . "\n";
    if (count($fields_list)) {
        $html .= '<div id="tablefieldscontainer">' . '<label>' . __('Columns') . '</label>' . '<select id="tablefields" name="dummy" ' . 'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" ' . 'multiple="multiple" ondblclick="insertValueQuery()">';
        foreach ($fields_list as $field) {
            $html .= '<option value="' . PMA_Util::backquote(htmlspecialchars($field['Field'])) . '"';
            if (isset($field['Field']) && mb_strlen($field['Field']) && isset($field['Comment'])) {
                $html .= ' title="' . htmlspecialchars($field['Comment']) . '"';
            }
            $html .= '>' . htmlspecialchars($field['Field']) . '</option>' . "\n";
        }
        $html .= '</select>' . '<div id="tablefieldinsertbuttoncontainer">';
        if (PMA_Util::showIcons('ActionLinksMode')) {
            $html .= '<input type="button" class="button" name="insert"' . ' value="&lt;&lt;" onclick="insertValueQuery()"' . ' title="' . __('Insert') . '" />';
        } else {
            $html .= '<input type="button" class="button" name="insert"' . ' value="' . __('Insert') . '"' . ' onclick="insertValueQuery()" />';
        }
        $html .= '</div>' . "\n" . '</div>' . "\n";
    }
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</div>' . "\n";
    $cfgBookmark = PMA_Bookmark_getParams();
    if ($cfgBookmark) {
        $html .= '<div id="bookmarkoptions">';
        $html .= '<div class="formelement">';
        $html .= '<label for="bkm_label">' . __('Bookmark this SQL query:') . '</label>';
        $html .= '<input type="text" name="bkm_label" id="bkm_label"' . ' tabindex="110" value="" />';
        $html .= '</div>';
        $html .= '<div class="formelement">';
        $html .= '<input type="checkbox" name="bkm_all_users" tabindex="111"' . ' id="id_bkm_all_users" value="true" />';
        $html .= '<label for="id_bkm_all_users">' . __('Let every user access this bookmark') . '</label>';
        $html .= '</div>';
        $html .= '<div class="formelement">';
        $html .= '<input type="checkbox" name="bkm_replace" tabindex="112"' . ' id="id_bkm_replace" value="true" />';
        $html .= '<label for="id_bkm_replace">' . __('Replace existing bookmark of same name') . '</label>';
        $html .= '</div>';
        $html .= '</div>';
    }
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</fieldset>' . "\n" . '</div>' . "\n";
    $html .= '<fieldset id="queryboxfooter" class="tblFooters">' . "\n";
    $html .= '<div class="formelement">' . "\n";
    $html .= '</div>' . "\n";
    $html .= '<div class="formelement">' . "\n";
    $html .= '<label for="id_sql_delimiter">[ ' . __('Delimiter') . '</label>' . "\n";
    $html .= '<input type="text" name="sql_delimiter" tabindex="131" size="3" ' . 'value="' . $delimiter . '" ' . 'id="id_sql_delimiter" /> ]';
    $html .= '<input type="checkbox" name="show_query" value="1" ' . 'id="checkbox_show_query" tabindex="132" checked="checked" />' . '<label for="checkbox_show_query">' . __('Show this query here again') . '</label>';
    $html .= '<input type="checkbox" name="retain_query_box" value="1" ' . 'id="retain_query_box" tabindex="133" ' . ($GLOBALS['cfg']['RetainQueryBox'] === false ? '' : ' checked="checked"') . ' />' . '<label for="retain_query_box">' . __('Retain query box') . '</label>';
    $html .= '<input type="checkbox" name="rollback_query" value="1" ' . 'id="rollback_query" tabindex="134" />' . '<label for="rollback_query">' . __('Rollback when finished') . '</label>';
    $html .= '</div>' . "\n";
    $html .= '<input type="submit" id="button_submit_query" name="SQL"';
    $html .= ' tabindex="200" value="' . __('Go') . '" />' . "\n";
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</fieldset>' . "\n";
    return $html;
}
Beispiel #6
0
 /**
  * Returns the breadcrumbs as HTML
  *
  * @return string HTML formatted breadcrumbs
  */
 private function _getBreadcrumbs()
 {
     $retval = '';
     $tbl_is_view = PMA_Table::isView($this->_db, $this->_table);
     $server_info = !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : $GLOBALS['cfg']['Server']['host'];
     $server_info .= empty($GLOBALS['cfg']['Server']['port']) ? '' : ':' . $GLOBALS['cfg']['Server']['port'];
     $separator = "<span class='separator item'>&nbsp;»</span>";
     $item = '<a href="%1$s%2$s" class="item">';
     if (PMA_Util::showText('TabsMode')) {
         $item .= '%4$s: ';
     }
     $item .= '%3$s</a>';
     $retval .= "<div id='floating_menubar'></div>";
     $retval .= "<div id='serverinfo'>";
     if (PMA_Util::showIcons('TabsMode')) {
         $retval .= PMA_Util::getImage('s_host.png', '', array('class' => 'item'));
     }
     $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabServer'], PMA_URL_getCommon(), htmlspecialchars($server_info), __('Server'));
     if (mb_strlen($this->_db)) {
         $retval .= $separator;
         if (PMA_Util::showIcons('TabsMode')) {
             $retval .= PMA_Util::getImage('s_db.png', '', array('class' => 'item'));
         }
         $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabDatabase'], PMA_URL_getCommon(array('db' => $this->_db)), htmlspecialchars($this->_db), __('Database'));
         // if the table is being dropped, $_REQUEST['purge'] is set to '1'
         // so do not display the table name in upper div
         if (mb_strlen($this->_table) && !(isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
             include './libraries/tbl_info.inc.php';
             $retval .= $separator;
             if (PMA_Util::showIcons('TabsMode')) {
                 $icon = $tbl_is_view ? 'b_views.png' : 's_tbl.png';
                 $retval .= PMA_Util::getImage($icon, '', array('class' => 'item'));
             }
             $retval .= sprintf($item, $GLOBALS['cfg']['DefaultTabTable'], PMA_URL_getCommon(array('db' => $this->_db, 'table' => $this->_table)), str_replace(' ', '&nbsp;', htmlspecialchars($this->_table)), $tbl_is_view ? __('View') : __('Table'));
             /**
              * Displays table comment
              */
             if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
                 if (mb_strstr($show_comment, '; InnoDB free')) {
                     $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
                 }
                 $retval .= '<span class="table_comment"';
                 $retval .= ' id="span_table_comment">&quot;';
                 $retval .= htmlspecialchars($show_comment);
                 $retval .= '&quot;</span>';
             }
             // end if
         } else {
             // no table selected, display database comment if present
             $cfgRelation = PMA_getRelationsParam();
             // Get additional information about tables for tooltip is done
             // in libraries/db_info.inc.php only once
             if ($cfgRelation['commwork']) {
                 $comment = PMA_getDbComment($this->_db);
                 /**
                  * Displays table comment
                  */
                 if (!empty($comment)) {
                     $retval .= '<span class="table_comment"' . ' id="span_table_comment">&quot;' . htmlspecialchars($comment) . '&quot;</span>';
                 }
                 // end if
             }
         }
     }
     $retval .= '<div class="clearfloat"></div>';
     $retval .= '</div>';
     return $retval;
 }
/**
 * return HTML for Sql Query Form Insert
 *
 * @param string $query     query to display in the textarea
 * @param string $delimiter default delimiter to use
 *
 * @return string
 *
 * @usedby  PMA_getHtmlForSqlQueryForm()
 */
function PMA_getHtmlForSqlQueryFormInsert($query = '', $delimiter = ';')
{
    // enable auto select text in textarea
    if ($GLOBALS['cfg']['TextareaAutoSelect']) {
        $auto_sel = ' onclick="selectContent(this, sql_box_locked, true);"';
    } else {
        $auto_sel = '';
    }
    $locking = '';
    $height = $GLOBALS['cfg']['TextareaRows'] * 2;
    list($legend, $query, $columns_list) = PMA_initQueryForm($query);
    if (!empty($columns_list)) {
        $sqlquerycontainer_id = 'sqlquerycontainer';
    } else {
        $sqlquerycontainer_id = 'sqlquerycontainerfull';
    }
    $html = '<a id="querybox"></a>' . '<div id="queryboxcontainer">' . '<fieldset id="queryboxf">';
    $html .= '<legend>' . $legend . '</legend>';
    $html .= '<div id="queryfieldscontainer">';
    $html .= '<div id="' . $sqlquerycontainer_id . '">' . '<textarea tabindex="100" name="sql_query" id="sqlquery"' . '  cols="' . $GLOBALS['cfg']['TextareaCols'] . '"' . '  rows="' . $height . '"' . '  dir="' . $GLOBALS['text_dir'] . '"' . $auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>';
    $html .= '<div id="querymessage"></div>';
    // Add buttons to generate query easily for
    // select all, single select, insert, update and delete
    if (!empty($columns_list)) {
        $html .= '<input type="button" value="SELECT *" id="selectall"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="SELECT" id="select"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="INSERT" id="insert"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="UPDATE" id="update"' . ' class="button sqlbutton" />';
        $html .= '<input type="button" value="DELETE" id="delete"' . ' class="button sqlbutton" />';
    }
    $html .= '<input type="button" value="' . __('Clear') . '" id="clear"' . ' class="button sqlbutton" />';
    if ($GLOBALS['cfg']['CodemirrorEnable']) {
        $html .= '<input type="button" value="' . __('Format') . '" id="format"' . ' class="button sqlbutton" />';
    }
    $html .= '<input type="button" value="' . __('Get auto-saved query') . '" id="saved"' . ' class="button sqlbutton" />';
    // Disable/Enable foreign key checks
    $html .= '<div>';
    $html .= PMA_Util::getFKCheckbox();
    $html .= '</div>';
    // parameter binding
    $html .= '<div>';
    $html .= '<input type="checkbox" name="parameterized" id="parameterized" />';
    $html .= '<label for="parameterized">' . __('Bind parameters') . '</label>';
    $html .= '<div id="parametersDiv"></div>';
    $html .= '</div>';
    $html .= '</div>' . "\n";
    if (!empty($columns_list)) {
        $html .= '<div id="tablefieldscontainer">' . '<label>' . __('Columns') . '</label>' . '<select id="tablefields" name="dummy" ' . 'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" ' . 'multiple="multiple" ondblclick="insertValueQuery()">';
        foreach ($columns_list as $field) {
            $html .= '<option value="' . PMA_Util::backquote(htmlspecialchars($field['Field'])) . '"';
            if (isset($field['Field']) && mb_strlen($field['Field']) && isset($field['Comment'])) {
                $html .= ' title="' . htmlspecialchars($field['Comment']) . '"';
            }
            $html .= '>' . htmlspecialchars($field['Field']) . '</option>' . "\n";
        }
        $html .= '</select>' . '<div id="tablefieldinsertbuttoncontainer">';
        if (PMA_Util::showIcons('ActionLinksMode')) {
            $html .= '<input type="button" class="button" name="insert"' . ' value="&lt;&lt;" onclick="insertValueQuery()"' . ' title="' . __('Insert') . '" />';
        } else {
            $html .= '<input type="button" class="button" name="insert"' . ' value="' . __('Insert') . '"' . ' onclick="insertValueQuery()" />';
        }
        $html .= '</div>' . "\n" . '</div>' . "\n";
    }
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</div>' . "\n";
    $cfgBookmark = PMA_Bookmark_getParams();
    if ($cfgBookmark) {
        $html .= '<div id="bookmarkoptions">';
        $html .= '<div class="formelement">';
        $html .= '<label for="bkm_label">' . __('Bookmark this SQL query:') . '</label>';
        $html .= '<input type="text" name="bkm_label" id="bkm_label"' . ' tabindex="110" value="" />';
        $html .= '</div>';
        $html .= '<div class="formelement">';
        $html .= '<input type="checkbox" name="bkm_all_users" tabindex="111"' . ' id="id_bkm_all_users" value="true" />';
        $html .= '<label for="id_bkm_all_users">' . __('Let every user access this bookmark') . '</label>';
        $html .= '</div>';
        $html .= '<div class="formelement">';
        $html .= '<input type="checkbox" name="bkm_replace" tabindex="112"' . ' id="id_bkm_replace" value="true" />';
        $html .= '<label for="id_bkm_replace">' . __('Replace existing bookmark of same name') . '</label>';
        $html .= '</div>';
        $html .= '</div>';
    }
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</fieldset>' . "\n" . '</div>' . "\n";
    $html .= '<fieldset id="queryboxfooter" class="tblFooters">' . "\n";
    $html .= '<div class="formelement">' . "\n";
    $html .= '</div>' . "\n";
    $html .= '<div class="formelement">' . "\n";
    $html .= '<label for="id_sql_delimiter">[ ' . __('Delimiter') . '</label>' . "\n";
    $html .= '<input type="text" name="sql_delimiter" tabindex="131" size="3" ' . 'value="' . $delimiter . '" ' . 'id="id_sql_delimiter" /> ]';
    $html .= '<input type="checkbox" name="show_query" value="1" ' . 'id="checkbox_show_query" tabindex="132" checked="checked" />' . '<label for="checkbox_show_query">' . __('Show this query here again') . '</label>';
    $html .= '<input type="checkbox" name="retain_query_box" value="1" ' . 'id="retain_query_box" tabindex="133" ' . ($GLOBALS['cfg']['RetainQueryBox'] === false ? '' : ' checked="checked"') . ' />' . '<label for="retain_query_box">' . __('Retain query box') . '</label>';
    $html .= '<input type="checkbox" name="rollback_query" value="1" ' . 'id="rollback_query" tabindex="134" />' . '<label for="rollback_query">' . __('Rollback when finished') . '</label>';
    $html .= '</div>' . "\n";
    $html .= '<input type="submit" id="button_submit_query" name="SQL"';
    $html .= ' tabindex="200" value="' . __('Go') . '" />' . "\n";
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</fieldset>' . "\n";
    return $html;
}
 /**
  * Renders a single node or a branch of the tree
  *
  * @param Node   $node      The node to render
  * @param bool   $recursive Bool: Whether to render a single node or a branch
  * @param string $class     An additional class for the list item
  *
  * @return string HTML code for the tree node or branch
  */
 private function _renderNode($node, $recursive, $class = '')
 {
     $retval = '';
     $paths = $node->getPaths();
     if ($node->hasSiblings() || isset($_REQUEST['results']) || $node->realParent() === false) {
         if ($node->type == Node::CONTAINER && count($node->children) == 0 && $GLOBALS['is_ajax_request'] != true) {
             return '';
         }
         $retval .= '<li class="' . trim($class . ' ' . $node->classes) . '">';
         $sterile = array('events', 'triggers', 'functions', 'procedures', 'views', 'columns', 'indexes');
         $parentName = '';
         $parents = $node->parents(false, true);
         if (count($parents)) {
             $parentName = $parents[0]->real_name;
         }
         // if node name itself is in sterile, then allow
         if ($node->is_group || !in_array($parentName, $sterile) && !$node->isNew || in_array($node->real_name, $sterile)) {
             $retval .= "<div class='block'>";
             $iClass = '';
             if ($class == 'first') {
                 $iClass = " class='first'";
             }
             $retval .= "<i{$iClass}></i>";
             if (strpos($class, 'last') === false) {
                 $retval .= "<b></b>";
             }
             $match = $this->_findTreeMatch($this->_aPath, $paths['aPath_clean']);
             $match |= $this->_findTreeMatch($this->_vPath, $paths['vPath_clean']);
             $retval .= '<a class="' . $node->getCssClasses($match) . '"';
             $retval .= " href='#'>";
             $retval .= "<span class='hide aPath'>";
             $retval .= $paths['aPath'];
             $retval .= "</span>";
             $retval .= "<span class='hide vPath'>";
             $retval .= $paths['vPath'];
             $retval .= "</span>";
             $retval .= "<span class='hide pos'>";
             $retval .= $this->_pos;
             $retval .= "</span>";
             $retval .= $this->_getPaginationParamsHtml($node);
             $retval .= $node->getIcon($match);
             $retval .= "</a>";
             $retval .= "</div>";
         } else {
             $retval .= "<div class='block'>";
             $iClass = '';
             if ($class == 'first') {
                 $iClass = " class='first'";
             }
             $retval .= "<i{$iClass}></i>";
             $retval .= $this->_getPaginationParamsHtml($node);
             $retval .= "</div>";
         }
         $linkClass = '';
         $haveAjax = array('functions', 'procedures', 'events', 'triggers', 'indexes');
         $parent = $node->parents(false, true);
         $isNewView = $parent[0]->real_name == 'views' && $node->isNew == true;
         if ($parent[0]->type == Node::CONTAINER && (in_array($parent[0]->real_name, $haveAjax) || $isNewView)) {
             $linkClass = ' ajax';
         }
         if ($node->type == Node::CONTAINER) {
             $retval .= "<i>";
         }
         if (PMA_Util::showIcons('TableNavigationLinksMode')) {
             $retval .= "<div class='block'>";
             if (isset($node->links['icon'])) {
                 $args = array();
                 foreach ($node->parents(true) as $parent) {
                     $args[] = urlencode($parent->real_name);
                 }
                 $link = vsprintf($node->links['icon'], $args);
                 if ($linkClass != '') {
                     $retval .= "<a class='{$linkClass}' href='{$link}'>";
                     $retval .= "{$node->icon}</a>";
                 } else {
                     $retval .= "<a href='{$link}'>{$node->icon}</a>";
                 }
             } else {
                 $retval .= "<u>{$node->icon}</u>";
             }
             $retval .= "</div>";
         }
         if (isset($node->links['text'])) {
             $args = array();
             foreach ($node->parents(true) as $parent) {
                 $args[] = urlencode($parent->real_name);
             }
             $link = vsprintf($node->links['text'], $args);
             $title = empty($node->links['title']) ? '' : $node->links['title'];
             if ($node->type == Node::CONTAINER) {
                 $retval .= "&nbsp;<a class='hover_show_full' href='{$link}'>";
                 $retval .= htmlspecialchars($node->name);
                 $retval .= "</a>";
             } else {
                 $retval .= "<a class='hover_show_full{$linkClass}' href='{$link}'";
                 $retval .= " title='{$title}'>";
                 $retval .= htmlspecialchars($node->real_name);
                 $retval .= "</a>";
             }
         } else {
             $retval .= "&nbsp;{$node->name}";
         }
         if ($node->type == Node::CONTAINER) {
             $retval .= "</i>";
         }
         $retval .= $node->getHtmlForControlButtons();
         $retval .= '<div class="clearfloat"></div>';
         $wrap = true;
     } else {
         $node->visible = true;
         $wrap = false;
         $retval .= $this->_getPaginationParamsHtml($node);
     }
     if ($recursive) {
         $hide = '';
         if ($node->visible == false) {
             $hide = " style='display: none;'";
         }
         $children = $node->children;
         usort($children, array('PMA_NavigationTree', 'sortNode'));
         $buffer = '';
         $extra_class = '';
         for ($i = 0, $nbChildren = count($children); $i < $nbChildren; $i++) {
             if ($i + 1 == $nbChildren) {
                 $extra_class = ' last';
             }
             $buffer .= $this->_renderNode($children[$i], true, $children[$i]->classes . $extra_class);
         }
         if (!empty($buffer)) {
             if ($wrap) {
                 $retval .= "<div{$hide} class='list_container'><ul>";
             }
             $retval .= $this->_fastFilterHtml($node);
             $retval .= $this->_getPageSelector($node);
             $retval .= $buffer;
             if ($wrap) {
                 $retval .= "</ul></div>";
             }
         }
     }
     if ($node->hasSiblings() || isset($_REQUEST['results'])) {
         $retval .= "</li>";
     }
     return $retval;
 }
Beispiel #9
0
/**
 * Get HTML snippet for "Add column" feature in structure table
 *
 * @param array $columns_list column list array
 *
 * @return string $html_output
 */
function PMA_getHtmlForAddColumn($columns_list)
{
    $html_output = '<form method="post" action="tbl_addfield.php" ' . 'id="addColumns" name="addColumns" ' . 'onsubmit="return checkFormElementInRange(' . 'this, \'num_fields\', \'' . str_replace('\'', '\\\'', __('You have to add at least one column.')) . '\', 1)' . '">';
    $html_output .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $html_output .= PMA_Util::getImage('b_insrow.png', __('Add column'));
        $html_output .= '&nbsp;';
    }
    $num_fields = '<input type="number" name="num_fields" ' . 'value="1" onfocus="this.select()" ' . 'min="1" required />';
    $html_output .= sprintf(__('Add %s column(s)'), $num_fields);
    // I tried displaying the drop-down inside the label but with Firefox
    // the drop-down was blinking
    $column_selector = '<select name="after_field" ' . 'onchange="checkFirst()">';
    $column_selector .= '<option ' . 'value="first" data-pos = "first">' . __('at beginning of table') . '</option>';
    $cols_count = count($columns_list);
    foreach ($columns_list as $one_column_name) {
        //by default select the last column (add column at the end of the table)
        if (--$cols_count == 0) {
            $column_selector .= '<option ' . 'value="' . htmlspecialchars($one_column_name) . '" selected="selected">';
        } else {
            $column_selector .= '<option ' . 'value="' . htmlspecialchars($one_column_name) . '">';
        }
        $column_selector .= sprintf(__('after %s'), htmlspecialchars($one_column_name)) . '</option>';
    }
    $column_selector .= '</select>';
    $html_output .= '<input type="hidden" name="field_where" value="after"/>';
    $html_output .= '&nbsp;';
    $html_output .= $column_selector;
    $html_output .= '<input type="submit" value="' . __('Go') . '" />' . '</form>';
    return $html_output;
}
Beispiel #10
0
</th>
        <th><?php 
    echo __('Action');
    ?>
</th>
        <th><?php 
    echo __('Show');
    ?>
</th>
    </tr>
    </thead>
    <tbody>
    <?php 
    // Print out information about versions
    $drop_image_or_text = '';
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $drop_image_or_text .= PMA_Util::getImage('b_drop.png', __('Delete tracking data for this table'));
    }
    if (PMA_Util::showText('ActionLinksMode')) {
        $drop_image_or_text .= __('Drop');
    }
    $style = 'odd';
    while ($one_result = $GLOBALS['dbi']->fetchArray($all_tables_result)) {
        list($table_name, $version_number) = $one_result;
        $table_query = ' SELECT * FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['tracking']) . ' WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($_REQUEST['db']) . '\' AND `table_name`  = \'' . PMA_Util::sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';
        $table_result = PMA_queryAsControlUser($table_query);
        $version_data = $GLOBALS['dbi']->fetchArray($table_result);
        $tmp_link = 'tbl_tracking.php' . $url_query . '&amp;table=' . htmlspecialchars($version_data['table_name']);
        $delete_link = 'db_tracking.php' . $url_query . '&amp;table=' . htmlspecialchars($version_data['table_name']) . '&amp;delete_tracking=true&amp';
        ?>
        <tr class="noclick <?php 
 /**
  * show Export relational schema generation options
  * user can select export type of his own choice
  * and the attributes related to it
  *
  * @return void
  * @access public
  */
 public function displaySchemaGenerationOptions()
 {
     global $cfg, $db, $test_rs, $chpage;
     $htmlString = '<form method="post" action="schema_export.php"' . ' class="disableAjax">' . '<fieldset>' . '<legend>' . PMA_URL_getHiddenInputs($db);
     if (PMA_Util::showIcons('ActionLinksMode')) {
         $htmlString .= PMA_Util::getImage('b_views.png');
     }
     /*
      * TODO: This list should be generated dynamically based on list of
      * available plugins.
      */
     $htmlString .= __('Display relational schema') . ':' . '</legend>' . '<select name="export_type" id="export_type">';
     if (file_exists(TCPDF_INC)) {
         $htmlString .= '<option value="pdf" selected="selected">PDF</option>';
     }
     $htmlString .= '<option value="svg">SVG</option>' . '<option value="dia">DIA</option>' . '<option value="eps">EPS</option>' . '</select>' . '<label>' . __('Select Export Relational Type') . '</label><br />';
     if (isset($test_rs)) {
         $htmlString .= '<label for="pdf_page_number_opt">' . __('Page number:') . '</label>' . '<select name="pdf_page_number" id="pdf_page_number_opt">';
         while ($pages = @$GLOBALS['dbi']->fetchAssoc($test_rs)) {
             $htmlString .= '<option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . htmlspecialchars($pages['page_descr']) . '</option>' . "\n";
         }
         // end while
         $GLOBALS['dbi']->freeResult($test_rs);
         unset($test_rs);
         $htmlString .= '</select><br />';
     } else {
         $htmlString .= '<input type="hidden" name="pdf_page_number"' . ' value="' . htmlspecialchars($this->chosenPage) . '" />';
     }
     $htmlString .= '<input type="hidden" name="do" value="process_export" />' . '<input type="hidden" name="chpage" value="' . $chpage . '" />' . '<input type="checkbox" name="show_grid" id="show_grid_opt" />' . '<label for="show_grid_opt">' . __('Show grid') . '</label><br />' . '<input type="checkbox" name="show_color"' . ' id="show_color_opt" checked="checked" />' . '<label for="show_color_opt">' . __('Show color') . '</label>' . '<br />' . '<input type="checkbox" name="show_table_dimension"' . ' id="show_table_dim_opt" />' . '<label for="show_table_dim_opt">' . __('Show dimension of tables') . '</label><br />' . '<input type="checkbox" name="all_tables_same_width"' . ' id="all_tables_same_width" />' . '<label for="all_tables_same_width">' . __('Same width for all tables') . '</label><br />' . '<input type="checkbox" name="with_doc"' . ' id="with_doc" checked="checked" />' . '<label for="with_doc">' . __('Data Dictionary') . '</label><br />' . '<input type="checkbox" name="show_keys" id="show_keys" />' . '<label for="show_keys">' . __('Only show keys') . '</label><br />' . '<select name="orientation" id="orientation_opt" class="paper-change">' . '<option value="L">' . __('Landscape') . '</option>' . '<option value="P">' . __('Portrait') . '</option>' . '</select>' . '<label for="orientation_opt">' . __('Orientation') . '</label>' . '<br />' . '<select name="paper" id="paper_opt" class="paper-change">';
     foreach ($cfg['PDFPageSizes'] as $val) {
         $htmlString .= '<option value="' . $val . '"';
         if ($val == $cfg['PDFDefaultPageSize']) {
             $htmlString .= ' selected="selected"';
         }
         $htmlString .= ' >' . $val . '</option>' . "\n";
     }
     $htmlString .= '</select>' . '<label for="paper_opt">' . __('Paper size') . '</label>' . '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>';
     echo $htmlString;
 }
 /**
  * Renders a single node or a branch of the tree
  *
  * @param Node     $node      The node to render
  * @param int|bool $recursive Bool: Whether to render a single node or a branch
  *                            Int: How many levels deep to render
  * @param string   $class     An additional class for the list item
  *
  * @return string HTML code for the tree node or branch
  */
 private function _renderNode($node, $recursive = -1, $class = '')
 {
     $retval = '';
     $paths = $node->getPaths();
     if ($node->hasSiblings() || isset($_REQUEST['results']) || $node->realParent() === false) {
         if ($node->type == Node::CONTAINER && count($node->children) == 0 && $GLOBALS['is_ajax_request'] != true) {
             return '';
         }
         $liClass = '';
         if ($class || $node->classes) {
             $liClass = " class='" . trim($class . ' ' . $node->classes) . "'";
         }
         $retval .= "<li{$liClass}>";
         $sterile = array('events', 'triggers', 'functions', 'procedures', 'views', 'columns', 'indexes');
         $parentName = '';
         $parents = $node->parents(false, true);
         if (count($parents)) {
             $parentName = $parents[0]->real_name;
         }
         if ($node->is_group || !in_array($parentName, $sterile) && !$node->isNew) {
             $loaded = '';
             if ($node->is_group) {
                 $loaded = ' loaded';
             }
             $container = '';
             if ($node->type == Node::CONTAINER) {
                 $container = ' container';
             }
             $retval .= "<div class='block'>";
             $iClass = '';
             if ($class == 'first') {
                 $iClass = " class='first'";
             }
             $retval .= "<i{$iClass}></i>";
             if (strpos($class, 'last') === false) {
                 $retval .= "<b></b>";
             }
             $icon = PMA_Util::getImage('b_plus.png', __('Expand/Collapse'));
             $match = 1;
             foreach ($this->_aPath as $path) {
                 $match = 1;
                 foreach ($paths['aPath_clean'] as $key => $part) {
                     if (!isset($path[$key]) || $part != $path[$key]) {
                         $match = 0;
                         break;
                     }
                 }
                 if ($match) {
                     $loaded = ' loaded';
                     if (!$node->is_group) {
                         $icon = PMA_Util::getImage('b_minus.png');
                     }
                     break;
                 }
             }
             foreach ($this->_vPath as $path) {
                 $match = 1;
                 foreach ($paths['vPath_clean'] as $key => $part) {
                     if (!isset($path[$key]) || $part != $path[$key]) {
                         $match = 0;
                         break;
                     }
                 }
                 if ($match) {
                     $loaded = ' loaded';
                     $icon = PMA_Util::getImage('b_minus.png');
                     break;
                 }
             }
             $retval .= "<a class='expander{$loaded}{$container}'";
             $retval .= " href='#'>";
             $retval .= "<span class='hide aPath'>";
             $retval .= $paths['aPath'];
             $retval .= "</span>";
             $retval .= "<span class='hide vPath'>";
             $retval .= $paths['vPath'];
             $retval .= "</span>";
             $retval .= "<span class='hide pos'>";
             $retval .= $this->_pos;
             $retval .= "</span>";
             $retval .= $this->_getPaginationParamsHtml($node);
             $retval .= $icon;
             $retval .= "</a>";
             $retval .= "</div>";
         } else {
             $retval .= "<div class='block'>";
             $iClass = '';
             if ($class == 'first') {
                 $iClass = " class='first'";
             }
             $retval .= "<i{$iClass}></i>";
             $retval .= $this->_getPaginationParamsHtml($node);
             $retval .= "</div>";
         }
         $linkClass = '';
         $haveAjax = array('functions', 'procedures', 'events', 'triggers', 'indexes');
         $parent = $node->parents(false, true);
         $isNewView = $parent[0]->real_name == 'views' && $node->isNew == true;
         if ($parent[0]->type == Node::CONTAINER && (in_array($parent[0]->real_name, $haveAjax) || $isNewView)) {
             $linkClass = ' class="ajax"';
         }
         if ($node->type == Node::CONTAINER) {
             $retval .= "<i>";
         }
         if (PMA_Util::showIcons('TableNavigationLinksMode')) {
             $retval .= "<div class='block'>";
             if (isset($node->links['icon'])) {
                 $args = array();
                 foreach ($node->parents(true) as $parent) {
                     $args[] = urlencode($parent->real_name);
                 }
                 $link = vsprintf($node->links['icon'], $args);
                 $retval .= "<a{$linkClass} href='{$link}'>{$node->icon}</a>";
             } else {
                 $retval .= "<u>{$node->icon}</u>";
             }
             $retval .= "</div>";
         }
         if (isset($node->links['text'])) {
             $args = array();
             foreach ($node->parents(true) as $parent) {
                 $args[] = urlencode($parent->real_name);
             }
             $link = vsprintf($node->links['text'], $args);
             if ($node->type == Node::CONTAINER) {
                 $retval .= "<a href='{$link}'>";
                 $retval .= htmlspecialchars($node->name);
                 $retval .= "</a>";
             } else {
                 $retval .= "<a{$linkClass} href='{$link}'>";
                 $retval .= htmlspecialchars($node->real_name);
                 $retval .= "</a>";
             }
         } else {
             $retval .= "{$node->name}";
         }
         if ($node->type == Node::CONTAINER) {
             $retval .= "</i>";
         }
         $retval .= $node->getHtmlForControlButtons();
         $wrap = true;
     } else {
         $node->visible = true;
         $wrap = false;
         $retval .= $this->_getPaginationParamsHtml($node);
     }
     if ($recursive) {
         $hide = '';
         if ($node->visible == false) {
             $hide = " style='display: none;'";
         }
         $children = $node->children;
         usort($children, array('PMA_NavigationTree', 'sortNode'));
         $buffer = '';
         for ($i = 0; $i < count($children); $i++) {
             if ($i + 1 != count($children)) {
                 $buffer .= $this->_renderNode($children[$i], true, $children[$i]->classes);
             } else {
                 $buffer .= $this->_renderNode($children[$i], true, $children[$i]->classes . ' last');
             }
         }
         if (!empty($buffer)) {
             if ($wrap) {
                 $retval .= "<div{$hide} class='list_container'><ul>";
             }
             $retval .= $this->_fastFilterHtml($node);
             $retval .= $this->_getPageSelector($node);
             $retval .= $buffer;
             if ($wrap) {
                 $retval .= "</ul></div>";
             }
         }
     }
     if ($node->hasSiblings() || isset($_REQUEST['results'])) {
         $retval .= "</li>";
     }
     return $retval;
 }
Beispiel #13
0
/**
 * Get HTML snippet for export relational schema view
 *
 * @param string $url_query Query string for link
 *
 * @return string $html_output
 */
function PMA_getHtmlForExportRelationalSchemaView($url_query)
{
    $html_output = '<div class="operations_full_width">' . '<fieldset><a href="schema_edit.php?' . $url_query . '">';
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $html_output .= PMA_Util::getImage('b_edit.png');
    }
    $html_output .= __('Edit or export relational schema') . '</a></fieldset>' . '</div>';
    return $html_output;
}
Beispiel #14
0
 /**
  * Renders the link to open a new page
  *
  * @param string $url The url of the page
  *
  * @return string
  */
 private function _getSelfLink($url)
 {
     $retval = '';
     $retval .= '<div id="selflink" class="print_ignore">';
     $retval .= '<a href="' . $url . '"' . ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
     if (PMA_Util::showIcons('TabsMode')) {
         $retval .= PMA_Util::getImage('window-new.png', __('Open new phpMyAdmin window'));
     } else {
         $retval .= __('Open new phpMyAdmin window');
     }
     $retval .= '</a>';
     $retval .= '</div>';
     return $retval;
 }
Beispiel #15
0
/**
 * Get HTML snippet for "Add column" feature in structure table
 *
 * @param array $columns_list column list array
 *
 * @return string $html_output
 */
function PMA_getHtmlForAddColumn($columns_list)
{
    $html_output = '<form method="post" action="tbl_addfield.php" ' . 'id="addColumns" name="addColumns" ' . 'onsubmit="return checkFormElementInRange(' . 'this, \'num_fields\', \'' . str_replace('\'', '\\\'', __('You have to add at least one column.')) . '\', 1)' . '">';
    $html_output .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $html_output .= PMA_Util::getImage('b_insrow.png', __('Add column'));
    }
    $num_fields = '<input type="number" name="num_fields" ' . 'value="1" onfocus="this.select()" ' . 'min="1" required />';
    $html_output .= sprintf(__('Add %s column(s)'), $num_fields);
    // I tried displaying the drop-down inside the label but with Firefox
    // the drop-down was blinking
    $column_selector = '<select name="after_field" ' . 'onclick="this.form.field_where[2].checked=true" ' . 'onchange="this.form.field_where[2].checked=true">';
    foreach ($columns_list as $one_column_name) {
        $column_selector .= '<option ' . 'value="' . htmlspecialchars($one_column_name) . '">' . htmlspecialchars($one_column_name) . '</option>';
    }
    $column_selector .= '</select>';
    $choices = array('last' => __('At End of Table'), 'first' => __('At Beginning of Table'), 'after' => sprintf(__('After %s'), ''));
    $html_output .= PMA_Util::getRadioFields('field_where', $choices, 'last', false);
    $html_output .= $column_selector;
    $html_output .= '<input type="submit" value="' . __('Go') . '" />' . '</form>';
    return $html_output;
}
Beispiel #16
0
 /**
  * Get a navigation button
  *
  * @param string  $caption            iconic caption for button
  * @param string  $title              text for button
  * @param integer $pos                position for next query
  * @param string  $html_sql_query     query ready for display
  * @param boolean $back               whether 'begin' or 'previous'
  * @param string  $onsubmit           optional onsubmit clause
  * @param string  $input_for_real_end optional hidden field for special treatment
  * @param string  $onclick            optional onclick clause
  *
  * @return string                     html content
  *
  * @access  private
  *
  * @see     _getMoveBackwardButtonsForTableNavigation(),
  *          _getMoveForwardButtonsForTableNavigation()
  */
 private function _getTableNavigationButton($caption, $title, $pos, $html_sql_query, $back, $onsubmit = '', $input_for_real_end = '', $onclick = '')
 {
     $caption_output = '';
     if ($back) {
         if (PMA_Util::showIcons('TableNavigationLinksMode')) {
             $caption_output .= $caption;
         }
         if (PMA_Util::showText('TableNavigationLinksMode')) {
             $caption_output .= '&nbsp;' . $title;
         }
     } else {
         if (PMA_Util::showText('TableNavigationLinksMode')) {
             $caption_output .= $title;
         }
         if (PMA_Util::showIcons('TableNavigationLinksMode')) {
             $caption_output .= '&nbsp;' . $caption;
         }
     }
     $title_output = ' title="' . $title . '"';
     return '<td>' . '<form action="sql.php" method="post" ' . $onsubmit . '>' . PMA_URL_getHiddenInputs($this->__get('db'), $this->__get('table')) . '<input type="hidden" name="sql_query" value="' . $html_sql_query . '" />' . '<input type="hidden" name="pos" value="' . $pos . '" />' . '<input type="hidden" name="is_browse_distinct" value="' . $this->__get('is_browse_distinct') . '" />' . '<input type="hidden" name="goto" value="' . $this->__get('goto') . '" />' . $input_for_real_end . '<input type="submit" name="navig"' . ' class="ajax" ' . 'value="' . $caption_output . '" ' . $title_output . $onclick . ' />' . '</form>' . '</td>';
 }
Beispiel #17
0
/**
 * Function to get html for tracking report and tracking report export
 *
 * @param string  $url_query        url query
 * @param array   $data             data
 * @param array   $url_params       url params
 * @param boolean $selection_schema selection schema
 * @param boolean $selection_data   selection data
 * @param boolean $selection_both   selection both
 * @param int     $filter_ts_to     filter time stamp from
 * @param int     $filter_ts_from   filter time stamp tp
 * @param array   $filter_users     filter users
 *
 * @return string
 */
function PMA_getHtmlForTrackingReport($url_query, $data, $url_params, $selection_schema, $selection_data, $selection_both, $filter_ts_to, $filter_ts_from, $filter_users)
{
    $html = '<h3>' . __('Tracking report') . '  [<a href="tbl_tracking.php?' . $url_query . '">' . __('Close') . '</a>]</h3>';
    $html .= '<small>' . __('Tracking statements') . ' ' . htmlspecialchars($data['tracking']) . '</small><br/>';
    $html .= '<br/>';
    $html .= '<form method="post" action="tbl_tracking.php' . PMA_URL_getCommon($url_params + array('report' => 'true', 'version' => $_REQUEST['version'])) . '">';
    $str1 = '<select name="logtype">' . '<option value="schema"' . ($selection_schema ? ' selected="selected"' : '') . '>' . __('Structure only') . '</option>' . '<option value="data"' . ($selection_data ? ' selected="selected"' : '') . '>' . __('Data only') . '</option>' . '<option value="schema_and_data"' . ($selection_both ? ' selected="selected"' : '') . '>' . __('Structure and data') . '</option>' . '</select>';
    $str2 = '<input type="text" name="date_from" value="' . htmlspecialchars($_REQUEST['date_from']) . '" size="19" />';
    $str3 = '<input type="text" name="date_to" value="' . htmlspecialchars($_REQUEST['date_to']) . '" size="19" />';
    $str4 = '<input type="text" name="users" value="' . htmlspecialchars($_REQUEST['users']) . '" />';
    $str5 = '<input type="hidden" name="list_report" value="1" />' . '<input type="submit" value="' . __('Go') . '" />';
    $html .= sprintf(__('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'), $str1, $str2, $str3, $str4, $str5);
    // Prepare delete link content here
    $drop_image_or_text = '';
    if (PMA_Util::showIcons('ActionsLinksMode')) {
        $drop_image_or_text .= PMA_Util::getImage('b_drop.png', __('Delete tracking data row from report'));
    }
    if (PMA_Util::showText('ActionLinksMode')) {
        $drop_image_or_text .= __('Delete');
    }
    /*
     *  First, list tracked data definition statements
     */
    if (count($data['ddlog']) == 0 && count($data['dmlog']) == 0) {
        $msg = PMA_Message::notice(__('No data'));
        $msg->display();
    }
    if ($selection_schema || $selection_both && count($data['ddlog']) > 0) {
        list($temp, $ddlog_count) = PMA_getHtmlForDataDefinitionStatements($data, $filter_users, $filter_ts_from, $filter_ts_to, $url_params, $drop_image_or_text);
        $html .= $temp;
        unset($temp);
    }
    //endif
    /*
     *  Secondly, list tracked data manipulation statements
     */
    if (($selection_data || $selection_both) && count($data['dmlog']) > 0) {
        $html .= PMA_getHtmlForDataManipulationStatements($data, $filter_users, $filter_ts_from, $filter_ts_to, $url_params, $ddlog_count, $drop_image_or_text);
    }
    $html .= '</form>';
    $html .= '<form method="post" action="tbl_tracking.php' . PMA_URL_getCommon($url_params + array('report' => 'true', 'version' => $_REQUEST['version'])) . '">';
    $html .= sprintf(__('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'), $str1, $str2, $str3, $str4, $str5);
    $str_export1 = '<select name="export_type">' . '<option value="sqldumpfile">' . __('SQL dump (file download)') . '</option>' . '<option value="sqldump">' . __('SQL dump') . '</option>' . '<option value="execution" onclick="alert(\'' . PMA_escapeJsString(__('This option will replace your table and contained data.')) . '\')">' . __('SQL execution') . '</option>' . '</select>';
    $str_export2 = '<input type="hidden" name="report_export" value="1" />' . '<input type="submit" value="' . __('Go') . '" />';
    $html .= '</form>';
    $html .= '<form class="disableAjax" method="post" action="tbl_tracking.php' . PMA_URL_getCommon($url_params + array('report' => 'true', 'version' => $_REQUEST['version'])) . '">';
    $html .= '<input type="hidden" name="logtype" value="' . htmlspecialchars($_REQUEST['logtype']) . '" />';
    $html .= '<input type="hidden" name="date_from" value="' . htmlspecialchars($_REQUEST['date_from']) . '" />';
    $html .= '<input type="hidden" name="date_to" value="' . htmlspecialchars($_REQUEST['date_to']) . '" />';
    $html .= '<input type="hidden" name="users" value="' . htmlspecialchars($_REQUEST['users']) . '" />';
    $html .= "<br/>" . sprintf(__('Export as %s'), $str_export1) . $str_export2 . "<br/>";
    $html .= '</form>';
    $html .= "<br/><br/><hr/><br/>\n";
    return $html;
}