forked from mkucej/i-librarian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvertstyles.php
40 lines (36 loc) · 1.37 KB
/
convertstyles.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// this is a utility script to compress styles to an SQLite database
include_once 'data.php';
include_once 'functions.php';
session_write_close();
// create and populate styles.sq3
//$dbHandle = database_connect(__DIR__, 'styles');
//$dbHandle->exec('PRAGMA journal_mode = DELETE');
//$dbHandle->exec("CREATE TABLE IF NOT EXISTS styles"
// . " (style_id INTEGER PRIMARY KEY,"
// . " title TEXT NOT NULL DEFAULT '',"
// . " style BLOB NOT NULL DEFAULT '')");
//$styles = glob('C:/Users/martin/Documents/i-librarian/styles-master/*.csl');
//$stmt = $dbHandle->prepare("INSERT INTO styles (title,style) VALUES (:title,:style)");
//$title = '';
//$filename = '';
//$blob = '';
//$dbHandle->beginTransaction();
//foreach ($styles as $style) {
// $stmt->bindValue(':title', $title, PDO::PARAM_STR);
// $stmt->bindValue(':style', $blob, PDO::PARAM_LOB);
// $xml = simplexml_load_file($style);
// $title = strtolower((string) $xml->info->title);
// $blob = gzcompress(file_get_contents($style), 9);
// $stmt->execute();
//}
//$dbHandle->commit();
// select a style
//$title_q = $dbHandle->quote(strtolower($_GET['title']));
//$result = $dbHandle->query('SELECT style FROM styles WHERE title=' . $title_q);
//print_r($dbHandle->errorInfo());
//$style = $result->fetchColumn();
//$a = gzuncompress($style);
//
//var_dump(htmlspecialchars($a));
$dbHandle = null;