Esempio n. 1
0
            $_inserted = PMA_Message::notice(__('Inserted row id: %1$d'));
            $_inserted->addParam($insert_id + $num_rows - 1);
            $message->addMessage($_inserted);
        }
    } elseif ($is_affected) {
        $message = PMA_Message::affected_rows($num_rows);

        // Ok, here is an explanation for the !$is_select.
        // The form generated by sql_query_form.lib.php
        // and db_sql.php has many submit buttons
        // on the same form, and some confusion arises from the
        // fact that $message_to_show is sent for every case.
        // The $message_to_show containing a success message and sent with
        // the form should not have priority over errors
    } elseif (! empty($message_to_show) && ! $is_select) {
        $message = PMA_Message::rawSuccess(htmlspecialchars($message_to_show));
    } elseif (! empty($GLOBALS['show_as_php'])) {
        $message = PMA_Message::success(__('Showing as PHP code'));
    } elseif (isset($GLOBALS['show_as_php'])) {
        /* User disable showing as PHP, query is only displayed */
        $message = PMA_Message::notice(__('Showing SQL query'));
    } elseif (! empty($GLOBALS['validatequery'])) {
        $message = PMA_Message::notice(__('Validated SQL'));
    } else {
        $message = PMA_Message::success(__('MySQL returned an empty result set (i.e. zero rows).'));
    }

    if (isset($GLOBALS['querytime'])) {
        $_querytime = PMA_Message::notice(__('Query took %01.4f sec'));
        $_querytime->addParam($GLOBALS['querytime']);
        $message->addMessage('(');
Esempio n. 2
0
/**
 * Function to get the message for the no rows returned case
 *
 * @param string $message_to_show      message to show
 * @param array  $analyzed_sql_results analyzed sql results
 * @param int    $num_rows             number of rows
 *
 * @return string $message
 */
function PMA_getMessageForNoRowsReturned($message_to_show, $analyzed_sql_results, $num_rows)
{
    if ($analyzed_sql_results['is_delete']) {
        $message = PMA_Message::getMessageForDeletedRows($num_rows);
    } elseif ($analyzed_sql_results['is_insert']) {
        if ($analyzed_sql_results['is_replace']) {
            // For replace we get DELETED + INSERTED row count,
            // so we have to call it affected
            $message = PMA_Message::getMessageForAffectedRows($num_rows);
        } else {
            $message = PMA_Message::getMessageForInsertedRows($num_rows);
        }
        $insert_id = $GLOBALS['dbi']->insertId();
        if ($insert_id != 0) {
            // insert_id is id of FIRST record inserted in one insert,
            // so if we inserted multiple rows, we had to increment this
            $message->addMessage('[br]');
            // need to use a temporary because the Message class
            // currently supports adding parameters only to the first
            // message
            $_inserted = PMA_Message::notice(__('Inserted row id: %1$d'));
            $_inserted->addParam($insert_id + $num_rows - 1);
            $message->addMessage($_inserted);
        }
    } elseif ($analyzed_sql_results['is_affected']) {
        $message = PMA_Message::getMessageForAffectedRows($num_rows);
        // Ok, here is an explanation for the !$is_select.
        // The form generated by sql_query_form.lib.php
        // and db_sql.php has many submit buttons
        // on the same form, and some confusion arises from the
        // fact that $message_to_show is sent for every case.
        // The $message_to_show containing a success message and sent with
        // the form should not have priority over errors
    } elseif (!empty($message_to_show) && !$analyzed_sql_results['is_select']) {
        $message = PMA_Message::rawSuccess(htmlspecialchars($message_to_show));
    } elseif (!empty($GLOBALS['show_as_php'])) {
        $message = PMA_Message::success(__('Showing as PHP code'));
    } elseif (isset($GLOBALS['show_as_php'])) {
        /* User disable showing as PHP, query is only displayed */
        $message = PMA_Message::notice(__('Showing SQL query'));
    } else {
        $message = PMA_Message::success(__('MySQL returned an empty result set (i.e. zero rows).'));
    }
    if (isset($GLOBALS['querytime'])) {
        $_querytime = PMA_Message::notice('(' . __('Query took %01.4f seconds.') . ')');
        $_querytime->addParam($GLOBALS['querytime']);
        $message->addMessage($_querytime);
    }
    // In case of ROLLBACK, notify the user.
    if (isset($_REQUEST['rollback_query'])) {
        $message->addMessage(__('[ROLLBACK occurred.]'));
    }
    return $message;
}
Esempio n. 3
0
         $_inserted->addParam($insert_id + $num_rows - 1);
         $message->addMessage($_inserted);
     }
 } elseif ($is_affected) {
     $message = PMA_Message::success('strRowsAffected');
     $message->addParam($num_rows);
     // Ok, here is an explanation for the !$is_select.
     // The form generated by sql_query_form.lib.php
     // and db_sql.php has many submit buttons
     // on the same form, and some confusion arises from the
     // fact that $zero_rows is sent for every case.
     // The $zero_rows containing $strSuccess and sent with
     // the form should not have priority over
     // errors like $strEmptyResultSet
 } elseif (!empty($zero_rows) && !$is_select) {
     $message = PMA_Message::rawSuccess(htmlspecialchars($zero_rows));
 } elseif (!empty($GLOBALS['show_as_php'])) {
     $message = PMA_Message::success('strShowingPhp');
 } elseif (isset($GLOBALS['show_as_php'])) {
     /* User disable showing as PHP, query is only displayed */
     $message = PMA_Message::notice('strShowingSQL');
 } elseif (!empty($GLOBALS['validatequery'])) {
     $message = PMA_Message::notice('strValidateSQL');
 } else {
     $message = PMA_Message::success('strEmptyResultSet');
 }
 if (isset($GLOBALS['querytime'])) {
     $_querytime = PMA_Message::notice('strQueryTime');
     $_querytime->addParam($GLOBALS['querytime']);
     $message->addMessage('(');
     $message->addMessage($_querytime);
Esempio n. 4
0
    ?>
            </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 
PMA_Message::rawSuccess(__('Configuration has been saved'))->display();
?>
            </div>
            <form class="group-cnt prefs-form disableAjax" name="prefs_export" action="prefs_manage.php" method="post">
            <?php 
echo PMA_generate_common_hidden_inputs() . "\n";
?>
                <div style="padding-bottom:0.5em">
                    <input type="radio" id="export_text_file" name="export_type" value="text_file" checked="checked" />
                    <label for="export_text_file"><?php 
echo __('Save as file');
?>
</label>
                    <br />
                    <input type="radio" id="export_local_storage" name="export_type" value="local_storage" disabled="disabled" />
                    <label for="export_local_storage"><?php 
    ?>
            </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 
$message = PMA_Message::rawSuccess(__('Configuration has been saved'));
$message->display();
?>
            </div>
            <form class="group-cnt prefs-form" name="prefs_export" action="prefs_manage.php" method="post">
            <?php 
echo PMA_generate_common_hidden_inputs() . "\n";
?>
                <div style="padding-bottom:0.5em">
                    <input type="radio" id="export_text_file" name="export_type" value="text_file" checked="checked" />
                    <label for="export_text_file"><?php 
echo __('Save as file');
?>
</label>
                    <br />
                    <input type="radio" id="export_local_storage" name="export_type" value="local_storage" disabled="disabled" />
 /**
  * test rawSuccess method
  *
  * @return void
  */
 public function testRawSuccess()
 {
     $this->object = new PMA_Message('', PMA_Message::SUCCESS);
     $this->object->setMessage('test<&>');
     $this->assertEquals($this->object, PMA_Message::rawSuccess('test<&>'));
 }
Esempio n. 7
0
         $_inserted->addParam($insert_id + $num_rows - 1);
         $message->addMessage($_inserted);
     }
 } elseif ($is_affected) {
     $message = PMA_Message::success('strRowsAffected');
     $message->addParam($num_rows);
     // Ok, here is an explanation for the !$is_select.
     // The form generated by sql_query_form.lib.php
     // and db_sql.php has many submit buttons
     // on the same form, and some confusion arises from the
     // fact that $zero_rows is sent for every case.
     // The $zero_rows containing $strSuccess and sent with
     // the form should not have priority over
     // errors like $strEmptyResultSet
 } elseif (!empty($zero_rows) && !$is_select) {
     $message = PMA_Message::rawSuccess($zero_rows);
 } elseif (!empty($GLOBALS['show_as_php'])) {
     $message = PMA_Message::success('strShowingPhp');
 } elseif (isset($GLOBALS['show_as_php'])) {
     /* User disable showing as PHP, query is only displayed */
     $message = PMA_Message::notice('strShowingSQL');
 } elseif (!empty($GLOBALS['validatequery'])) {
     $message = PMA_Message::notice('strValidateSQL');
 } else {
     $message = PMA_Message::success('strEmptyResultSet');
 }
 if (isset($GLOBALS['querytime'])) {
     $_querytime = PMA_Message::notice('strQueryTime');
     $_querytime->addParam($GLOBALS['querytime']);
     $message->addMessage('(');
     $message->addMessage($_querytime);