Beispiel #1
0
// end bookmarks reading
// Do no run query if we show PHP code
if (isset($GLOBALS['show_as_php'])) {
    $run_query = FALSE;
    $go_sql = TRUE;
}
// Store the query as a bookmark before executing it if bookmarklabel was given
if (!empty($bkm_label) && !empty($import_text)) {
    require_once './libraries/bookmark.lib.php';
    $bfields = array('dbase' => $db, 'user' => $cfg['Bookmark']['user'], 'query' => urlencode($import_text), 'label' => $bkm_label);
    // Should we replace bookmark?
    if (isset($bkm_replace)) {
        $bookmarks = PMA_listBookmarks($db, $cfg['Bookmark']);
        foreach ($bookmarks as $key => $val) {
            if ($val == $bkm_label) {
                PMA_deleteBookmarks($db, $cfg['Bookmark'], $key);
            }
        }
    }
    PMA_addBookmarks($bfields, $cfg['Bookmark'], isset($bkm_all_users));
    $bookmark_created = TRUE;
}
// end store bookmarks
// We can not read all at once, otherwise we can run out of memory
$memory_limit = trim(@ini_get('memory_limit'));
// 2 MB as default
if (empty($memory_limit)) {
    $memory_limit = 2 * 1024 * 1024;
}
// In case no memory limit we work on 10MB chunks
if ($memory_limit = -1) {
Beispiel #2
0
    switch ($action_bookmark) {
        case 0:
            // bookmarked query that have to be run
            $sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark, 'id', isset($action_bookmark_all) ? TRUE : FALSE);
            if (isset($bookmark_variable) && !empty($bookmark_variable)) {
                $sql_query = preg_replace('|/\\*(.*)\\[VARIABLE\\](.*)\\*/|imsU', '${1}' . PMA_sqlAddslashes($bookmark_variable) . '${2}', $sql_query);
            }
            break;
        case 1:
            // bookmarked query that have to be displayed
            $sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark);
            $view_bookmark = 1;
            break;
        case 2:
            // bookmarked query that have to be deleted
            $sql_query = PMA_deleteBookmarks($db, $cfg['Bookmark'], $id_bookmark);
            break;
    }
}
// end if
/**
 * Prepares the sql query
 */
// Gets the query from a file if required
if ($sql_file != 'none') {
    // loic1 : fixed a security issue
    //    if ((file_exists($sql_file) && is_uploaded_file($sql_file))
    //        || file_exists($cfg['UploadDir'] . $sql_localfile)) {
    if (file_exists($sql_file) && (isset($sql_localfile) && $sql_file == $cfg['UploadDir'] . $sql_localfile || is_uploaded_file($sql_file))) {
        $open_basedir = @ini_get('open_basedir');
        if (!isset($sql_file_compression)) {
Beispiel #3
0
 */
if (!empty($id_bookmark)) {
    include 'bookmark.lib.php';
    switch ($action_bookmark) {
        case 0:
            // bookmarked query that have to be run
            $sql_query = PMA_queryBookmarks($db, $cfgBookmark, $id_bookmark);
            break;
        case 1:
            // bookmarked query that have to be displayed
            $sql_query = PMA_queryBookmarks($db, $cfgBookmark, $id_bookmark);
            $view_bookmark = 1;
            break;
        case 2:
            // bookmarked query that have to be deleted
            $sql_query = PMA_deleteBookmarks($db, $cfgBookmark, $id_bookmark);
            break;
    }
}
// end if
/**
 * Prepares the sql query
 */
// Gets the query from a file if required
if ($sql_file != 'none') {
    if (file_exists($sql_file) && is_uploaded_file($sql_file)) {
        $open_basedir = '';
        if (PMA_PHP_INT_VERSION >= 40000) {
            $open_basedir = @ini_get('open_basedir');
        }
        if (empty($open_basedir)) {