function unstripinput($text)
{
    if (QUOTES_GPC) {
        $text = stripslashes($text);
    }
    $search = array("\n", "&", """, "'", "\", """, "'", "<", ">");
    $replace = array("\r\n", "&", "\"", "'", "\\", '\\"', "\\'", "<", ">");
    $text = str_replace($search, $replace, $text);
    return $text;
}
if (isset($_GET['thread_id']) && isnum($_GET['thread_id']) && (isset($_GET['post_id']) && isnum($_GET['post_id'])) && (isset($_GET['code_id']) && isnum($_GET['code_id']))) {
    $result = dbquery("SELECT fp.*, ff.* FROM " . DB_POSTS . " AS fp\r\n\t\tINNER JOIN " . DB_FORUMS . " AS ff ON ff.forum_id=fp.forum_id\r\n\t\tWHERE fp.thread_id='" . $_GET['thread_id'] . "' AND fp.post_id='" . $_GET['post_id'] . "'");
    if (dbrows($result)) {
        $data = dbarray($result);
        if (!checkgroup($data['forum_access']) || !$data['forum_cat']) {
            redirect(BASEDIR . "forum/viewthread.php?thread_id=" . $_GET['thread_id']);
        }
        $text = $data['post_message'];
        preg_match_all("#\\[geshi=(.*?)\\](.*?)\\[/geshi\\]#si", $text, $matches, PREG_PATTERN_ORDER);
        if (isset($matches[1][$_GET['code_id']]) && isset($matches[2][$_GET['code_id']])) {
            $ext = strtolower(str_replace("4strict", "", $matches[1][$_GET['code_id']]));
            $text = unstripinput($matches[2][$_GET['code_id']]);
            $filename = "geshi_" . $_GET['thread_id'] . "_" . $_GET['post_id'] . "_" . $_GET['code_id'] . "." . $ext;
            $object = new httpdownload();
            $object->set_bydata($text);
            $object->use_resume = true;
            $object->set_filename($filename);
            $object->download();
        }
    }
}
예제 #2
0
                }
                $dump .= ");";
                echo $dump . $crlf;
            }
        }
        $contents = ob_get_contents();
        ob_end_clean();
        $file = stripinput($_POST['backup_filename']) . ".sql";
        require_once INCLUDES . "class.httpdownload.php";
        $object = new httpdownload();
        $object->use_resume = false;
        if ($_POST['backup_type'] == ".gz") {
            $object->use_resume = false;
            $object->set_mime("application/x-gzip gz tgz");
            $object->set_bydata(gzencode($contents, 9));
            $object->set_filename($file . ".gz");
        } else {
            $object->use_resume = false;
            $object->set_mime("text/plain");
            $object->set_bydata($contents);
            $object->set_filename($file);
        }
        $object->download();
        exit;
    }
    redirect(FUSION_SELF . $aidlink);
}
require_once THEMES . "templates/admin_header.php";
include LOCALE . LOCALESET . "admin/db-backup.php";
if (isset($_GET['status']) && !isset($message)) {
    if ($_GET['status'] == "pw") {