From 53277913f1f02ac926ec59450f9ce45b4490bff9 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 07 Jul 2012 17:00:25 +0000
Subject: [PATCH] Przeniesienie ustawień skryptu do osobnego pliku (includes/config.php) oraz usunięcie pustych linii w niektórych innych plikach.
---
includes/config.php | 19 +++++++++
CHANGELOG | 3 +
INSTALL | 4 +-
includes/okladki.php | 4 +-
includes/gotowe.php | 2
includes/YAZ.php | 2
includes/MARC21_opisy.php | 2
includes/db2.php | 10 +---
includes/generate_codabar.php | 2
includes/convert.php | 2
includes/validate.php | 2
includes/MARC21.php | 2
includes/checksum.php | 2
includes/ksiazki.php | 4 -
includes/std.php | 2
includes/generate_code39.php | 2
includes/generate_html.php | 2
includes/pozycz.php | 2
18 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 0851cf0..55a2bb9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
System Biblioteczny - CHANGELOG
+1.4 Stable
+- Przeniesienie ustawień skryptu do osobnego pliku (includes/config.php)
+
1.3 Stable
- Poprawienie okładek - getimagesize() zwraca IMAGETYPE_XXX, a nie IMG_XXX
- Zmiana add_search.php w związku z nowym sposobem wywoływania
diff --git a/INSTALL b/INSTALL
index ba04e15..0b27c21 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
1. Rozpakuj archiwum do folderu serwera WWW (najlepiej dostępnego tylko z sieci lokalnej)
2. Utwórz bazę danych biblioteka i odpowiedniego użytkownika
3. Wykonaj plik biblioteka.sql w bazie danych
-4. Ustaw dane logowania w pliku /includes/db2.php
+4. Ustaw dane logowania do bazy w pliku /includes/config.php
5. Folderom /covers i /covers_big nadaj uprawnienia do odczytu i zapisu
6. W przypadku instalacji modułu OPAC foldery /covers i /covers_big powinny linkować do odpowiedników w katalogu głównego modułu
-7. Ustaw klucz API do Library Thing w pliku /includes/ksiazki.php
+7. Ustaw klucz API do Library Thing w pliku /includes/config.php
8. Sprawdź wymagania systemu (otwórz poprzez serwer WWW plik test.php)
diff --git a/includes/MARC21.php b/includes/MARC21.php
index d036f66..3205a64 100644
--- a/includes/MARC21.php
+++ b/includes/MARC21.php
@@ -183,4 +183,4 @@
));
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/MARC21_opisy.php b/includes/MARC21_opisy.php
index 2fc9d5d..6b8843e 100644
--- a/includes/MARC21_opisy.php
+++ b/includes/MARC21_opisy.php
@@ -27,4 +27,4 @@
)
);
-?>
+?>
\ No newline at end of file
diff --git a/includes/YAZ.php b/includes/YAZ.php
index f99f4fd..068945f 100644
--- a/includes/YAZ.php
+++ b/includes/YAZ.php
@@ -80,4 +80,4 @@
}
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/checksum.php b/includes/checksum.php
index d61006a..56d944a 100644
--- a/includes/checksum.php
+++ b/includes/checksum.php
@@ -49,4 +49,4 @@
return $sum;
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/config.php b/includes/config.php
new file mode 100644
index 0000000..3e14cf8
--- /dev/null
+++ b/includes/config.php
@@ -0,0 +1,19 @@
+<?php
+class config {
+ // Nazwa hosta bazy danych
+ static $db_host = '';
+
+ // Nazwa użytkownika bazy
+ static $db_user = '';
+
+ // Hasło użytkownika
+ static $db_pass = '';
+
+ // Nazwa bazy danych
+ static $db_base = '';
+
+
+ // Klucz API LibraryThing
+ static $lt_api = '';
+}
+?>
\ No newline at end of file
diff --git a/includes/convert.php b/includes/convert.php
index 2598bec..6d636d9 100644
--- a/includes/convert.php
+++ b/includes/convert.php
@@ -38,4 +38,4 @@
return $kod . checksum::EAN($kod);
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/db2.php b/includes/db2.php
index 0922cfe..600e8fe 100644
--- a/includes/db2.php
+++ b/includes/db2.php
@@ -8,9 +8,7 @@
static $queries = 0;
static function connect() {
- # !!!
- # TUTAJ USTAW DANE LOGOWANIA DO BAZY:
- self::$db = @mysql_connect('host', 'uzytkownik', 'haslo');
+ self::$db = @mysql_connect(config::$db_host, config::$db_user, config::$db_pass);
if(!self::$db) {
error::add(mysql_error());
}
@@ -20,9 +18,7 @@
self::$queries = 0;
- # !!!
- # TUTAJ USTAW NAZWĘ BAZY
- if(!@mysql_select_db('baza')) {
+ if(!@mysql_select_db(config::$db_base)) {
error::add(mysql_error());
}
}
@@ -441,4 +437,4 @@
return sql::increment_id();
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/generate_codabar.php b/includes/generate_codabar.php
index 6e95cf5..16e2548 100644
--- a/includes/generate_codabar.php
+++ b/includes/generate_codabar.php
@@ -65,4 +65,4 @@
return $img;
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/generate_code39.php b/includes/generate_code39.php
index 68fa612..62c95a6 100644
--- a/includes/generate_code39.php
+++ b/includes/generate_code39.php
@@ -97,4 +97,4 @@
return $img;
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/generate_html.php b/includes/generate_html.php
index 1da09e6..c7cb4b9 100644
--- a/includes/generate_html.php
+++ b/includes/generate_html.php
@@ -64,4 +64,4 @@
break;
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/gotowe.php b/includes/gotowe.php
index d281c14..5b66686 100644
--- a/includes/gotowe.php
+++ b/includes/gotowe.php
@@ -317,4 +317,4 @@
echo '</p>';
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/ksiazki.php b/includes/ksiazki.php
index eef123e..051fb28 100644
--- a/includes/ksiazki.php
+++ b/includes/ksiazki.php
@@ -43,8 +43,6 @@
}
class ksiazki extends ksiazki_cache {
- static $LT_API = '';
-
static function okladka($KOD, $ISBN) {
return okladki::znajdz($KOD, $ISBN, 'covers');
}
@@ -263,4 +261,4 @@
return array($num, $ret, db2::revelance());
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/okladki.php b/includes/okladki.php
index 1761040..f525f5b 100644
--- a/includes/okladki.php
+++ b/includes/okladki.php
@@ -33,7 +33,7 @@
}
static function librarything($ISBN, $dir = 'covers') {
- if(!function_exists('curl_init') || !ksiazki::$LT_API) {
+ if(!function_exists('curl_init') || !config::$lt_api) {
return FALSE;
}
@@ -49,7 +49,7 @@
}
}
- $get = 'http://www.librarything.com/devkey/'.ksiazki::$LT_API.'/'.($dir=='covers_big' ? 'large' : 'small').'/isbn/'.$ISBN10;
+ $get = 'http://www.librarything.com/devkey/'.config::$lt_api.'/'.($dir=='covers_big' ? 'large' : 'small').'/isbn/'.$ISBN10;
$curl = curl_init($get);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
diff --git a/includes/pozycz.php b/includes/pozycz.php
index 53fc2c6..1d9fb30 100644
--- a/includes/pozycz.php
+++ b/includes/pozycz.php
@@ -29,4 +29,4 @@
}
}
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/std.php b/includes/std.php
index 22ae52e..9d4a8b9 100644
--- a/includes/std.php
+++ b/includes/std.php
@@ -22,4 +22,4 @@
}
require_once('./includes/'.$class.'.php');
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/validate.php b/includes/validate.php
index c826105..a6a0630 100644
--- a/includes/validate.php
+++ b/includes/validate.php
@@ -124,4 +124,4 @@
error::add('Nieznany typ kodu');
}
}
-?>
+?>
\ No newline at end of file
--
Gitblit v1.9.1