Esempio n. 1
0
    function setUp()
    {
        require_once '../lib/code.php';
        $this->query = 'select * from test';
        $this->md5 = md5($this->query);
        $this->sqlCode = new SqlCode($this->query);
        $this->db =& new PDO("sqlite:bazdig-test.db");
        SqlCode::set_db($this->db);
        $this->sqlCode2 = new SqlCode("select * from test");
        $this->sqlCode2->id = 'test:001';
        $this->sqlCode2->date = '2008-01-25';
        $this->markkitDB =& new PDO("sqlite2:markkit-test.db");
        $this->markkitQuery3 = new SqlCode("select * from marks where pageUrl like '%x'");
        $this->markkitQuery4 = new SqlCode("create table marks (pageUrl, text)");
        $this->sqlCode3 = new SqlCode('
-- test comment
--
select * from test3
');
    }
Esempio n. 2
0
<?php

define('WARAQ_ROOT', '../..');
require_once WARAQ_ROOT . '/' . 'ini.php';
require "code.php";
$dbFile = $bazdig->getparam("db")->file;
$console = $bazdig->get("/console");
try {
    SqlCode::set_db("sqlite:" . $dbFile);
} catch (Exception $e) {
    $error = "<b>DATABASE ERROR</b> check you have PDO_SQLITE <sub>(" . $e->getMessage() . ")</sub>";
    die("<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>{$error}</div>");
}
if ($_GET['q']) {
    $queries = SqlCode::search($_GET['q'], 'order by date desc');
} else {
    $queries = SqlCode::select('order by date desc limit 10');
}
?>
<title>bazdig history</title>
<link rel="stylesheet" type="text/css" href="../codepress/languages/sql.css" />
<link rel="stylesheet" type="text/css" href="../bazdig.css" />
<div id="nav"><a href="../console/" accesskey="c" title="(c)" class="button">console</a><a href="../bazdig.db" accesskey="s" title="(s)" class="button">save</a>
<form id="search" method="get" action=".">
<input type="text" name="q" value="<?php 
echo $_GET['q'];
?>
"/><input type="submit" value="Search" />
<input type="hidden" name="f" value="7" />
</form>
</div>
Esempio n. 3
0
session_start();
define('WARAQ_ROOT', '../../..');
require_once WARAQ_ROOT . '/' . 'ini.php';
require "code.php";
$db_type = $_GET['dbt'];
$db_name = $_GET['dbn'];
$db_host = $_GET['dbh'];
$db_user = $_SERVER['PHP_AUTH_USER'];
$db_password = $_SERVER['PHP_AUTH_PW'];
if (!$_GET['q']) {
    header('Location: ' . $bazdig->get('/console')->url);
}
try {
    $history_db = new PDO("sqlite:" . $bazdig->getparam('db')->file);
    $work_db = new BDB(array('type' => $db_type, 'name' => $db_name, 'host' => $db_host), $db_user, $db_password);
    SqlCode::set_db($history_db);
} catch (Exception $e) {
    Header("WWW-Authenticate: Basic realm=\"{$db_name}@{$db_host}\"");
    Header("HTTP/1.0 401 Unauthorized");
    $error = "<b>CONNECTION ERROR</b> check your server permissions then check that the PDO_SQLITE and PDO_MYSQL modules are installed";
    die("<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>{$error}</div>");
}
$query = new SqlCode(trim(stripslashes($_GET['q'])));
?>
<html>
<head>
<style type="text/css">

table, tr, td, th {
       margin: 0px;
	   padding: 5px;