32 changed files with 3743 additions and 0 deletions
-
87bilder.pot
-
12components/personAdmin.php
-
35config.php
-
20css/background-colors.css
-
58css/displays.css
-
33css/fonts.css
-
BINimg/circDblArrDownBlk.png
-
BINimg/circDblArrLeftBlk.png
-
BINimg/circDblArrRightBlk.png
-
BINimg/circDblArrUpBlk.png
-
BINimg/patterns1.xcf
-
48js/fittingStrings.js
-
52js/levenshtein.js
-
70js/personAdmin/person.js
-
209js/personAdmin/personInUp.js
-
179js/personAdmin/personSearch1.js
-
81js/transPngBg.js
-
595libs/c_SavantSmall.php
-
226libs/c_mysqlDb.php
-
42libs/c_person.php
-
114libs/c_personAdmin.php
-
27libs/c_picToolSavant.php
-
249libs/c_xmlify.php
-
67libs/errException.php
-
55libs/gd_bgMerge.php
-
62libs/initLocale.php
-
BINlocale/de/LC_MESSAGES/bilder.mo
-
88po/de.po
-
1053sql/create.sql
-
43templates/personAdmin/personAdmin.tpl.php
-
173templates/personAdmin/personInUp.tpl.php
-
65templates/personAdmin/personSearch1.tpl.php
@ -0,0 +1,87 @@ |
|||
# SOME DESCRIPTIVE TITLE. |
|||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
|||
# This file is distributed under the same license as the PACKAGE package. |
|||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
|||
# |
|||
#, fuzzy |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: PACKAGE VERSION\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2007-10-08 03:09+0200\n" |
|||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|||
"Language-Team: LANGUAGE <LL@li.org>\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=CHARSET\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
|
|||
#: templates/personAdmin/personSearch1.tpl.php:37 |
|||
msgid "search" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personSearch1.tpl.php:45 |
|||
#: templates/personAdmin/personInUp.tpl.php:86 |
|||
msgid "surname" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personSearch1.tpl.php:56 |
|||
#: templates/personAdmin/personInUp.tpl.php:80 |
|||
msgid "firstname" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:47 |
|||
msgid "update" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:54 |
|||
msgid "insert" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:57 |
|||
msgid "submit" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:63 |
|||
msgid "personal data" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:92 |
|||
msgid "company" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:98 |
|||
msgid "email" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:104 |
|||
msgid "url" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:117 |
|||
msgid "photographer" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:124 |
|||
msgid "cameraId" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:137 |
|||
msgid "owner" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:144 |
|||
msgid "watermark width" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:150 |
|||
msgid "watermark height" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:156 |
|||
msgid "watermark xPos" |
|||
msgstr "" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:162 |
|||
msgid "watermark yPos" |
|||
msgstr "" |
|||
@ -0,0 +1,12 @@ |
|||
<?php |
|||
|
|||
require_once dirname(__FILE__) . '/../config.php'; |
|||
require_once LIBDIR . 'initLocale.php'; |
|||
require_once LIBDIR . 'c_personAdmin.php'; |
|||
|
|||
$personAdmin = new c_personAdmin ($locale); |
|||
|
|||
ob_start ('ob_gzhandler'); |
|||
$personAdmin->show (); |
|||
|
|||
?>
|
|||
@ -0,0 +1,35 @@ |
|||
<? |
|||
/* Pfadkonstanten */ |
|||
define ('HOME', dirname (__FILE__) . '/'); |
|||
define ('DATADIR', HOME . 'data/'); |
|||
define ('IMGDIR', HOME . 'img/'); |
|||
define ('LIBDIR', HOME . 'libs/'); |
|||
define ('TPLDIR', HOME . 'templates/'); |
|||
define ('JSDIR', HOME . 'js/'); |
|||
define ('CSSDIR', HOME . 'css/'); |
|||
define ('FONTDIR', HOME . 'fonts/'); |
|||
define ('CACHEDIR', HOME . 'cache/'); |
|||
define ('LOCALEDIR', HOME . 'locale/'); |
|||
|
|||
/* diese Pfade als URLS */ |
|||
// Evolver
|
|||
define ('BASEURL', "http://localhost/~georg/bilder/"); |
|||
|
|||
define ('IMGURL', BASEURL . 'img/'); |
|||
define ('LIBURL', BASEURL . 'libs/'); |
|||
define ('TPLURL', BASEURL . 'templates/'); |
|||
define ('DATAURL', BASEURL . 'data/'); |
|||
define ('CSSURL', BASEURL . 'css/'); |
|||
define ('JSURL', BASEURL . 'js/'); |
|||
define ('CSSDIR', BASEURL . 'css/'); |
|||
define ('FONTURL', BASEURL . 'fonts/'); |
|||
define ('CACHEURL', BASEURL . 'cache/'); |
|||
|
|||
define ('BASESURL', "https://localhost/~georg/bilder/"); |
|||
define ('IMGSURL', BASESURL . 'img/'); |
|||
|
|||
/* Basisklassen & Funktionen */ |
|||
define ('SAVANT_SMALL', LIBDIR . 'c_SavantSmall.php'); |
|||
define ('PICTOOL_SAVANT', LIBDIR . 'c_picToolSavant.php'); |
|||
define ('UTILS', LIBDIR . 'utils.php'); |
|||
?>
|
|||
@ -0,0 +1,20 @@ |
|||
/* ======================================================================= |
|||
* Styles for components |
|||
* ======================================================================= */ |
|||
.bgc-bg1 { background-color: #888888 } |
|||
/* ======================================================================= */ |
|||
|
|||
/* ======================================================================= |
|||
* Styles for logical groups. A group is defined by a bounding box "grp*" |
|||
* containing one or more header lines "head*" and content-boxes "box*" |
|||
* ======================================================================= */ |
|||
.bgc-grp1 { background-color: #aaaaaa } |
|||
.bgc-box1 { background-color: #ffb400 } |
|||
.bgc-head1 { background-color: #e5a200 } |
|||
/* ======================================================================= */ |
|||
|
|||
/* ======================================================================= |
|||
* Styles for tooltips |
|||
* ======================================================================= */ |
|||
.bgc-tt1 { background-color: #eeeeee } |
|||
/* ======================================================================= */ |
|||
@ -0,0 +1,58 @@ |
|||
/* ======================================================================= |
|||
* Styles for components |
|||
* ======================================================================= */ |
|||
.d-bg1 { |
|||
padding: 2px |
|||
} |
|||
/* ======================================================================= */ |
|||
|
|||
/* ======================================================================= |
|||
* Styles for logical groups. A group is defined by a bounding box "grp*" |
|||
* containing one or more header lines "head*" and content-boxes "box*" |
|||
* ======================================================================= */ |
|||
.d-grp1 { |
|||
padding: 2px; |
|||
padding-top: 1px; |
|||
padding-bottom: 1px |
|||
} |
|||
.d-box1 { |
|||
padding: 3px; |
|||
margin-top: 1px; |
|||
margin-bottom: 1px |
|||
} |
|||
.d-head1 { |
|||
padding: 3px; |
|||
margin-top: 1px; |
|||
margin-bottom: 1px |
|||
} |
|||
/* ======================================================================= */ |
|||
|
|||
/* ======================================================================= |
|||
* Styles for tooltips |
|||
* ======================================================================= */ |
|||
div.d-tt1 { |
|||
border: 1px solid black; |
|||
padding: 2px; |
|||
visibility: hidden; |
|||
z-index: 100 |
|||
} |
|||
ul.d-tt1 { |
|||
list-style-type: none; |
|||
margin: 0px; |
|||
padding: 0px |
|||
} |
|||
/* ======================================================================= */ |
|||
|
|||
/* ======================================================================= |
|||
* common changes to tag defaults |
|||
* ======================================================================= */ |
|||
form { |
|||
padding: 0px; |
|||
margin: 0px; |
|||
} |
|||
|
|||
td { |
|||
padding: 0px; |
|||
margin: 0px; |
|||
} |
|||
/* ======================================================================= */ |
|||
@ -0,0 +1,33 @@ |
|||
/* ======================================================================= |
|||
* Styles for components |
|||
* ======================================================================= */ |
|||
.f-bg1 { |
|||
font-family: verdana, sans-serif; |
|||
font-size: 8pt; |
|||
font-weight: normal; |
|||
color: #000000 |
|||
} |
|||
/* ======================================================================= */ |
|||
|
|||
/* ======================================================================= |
|||
* Styles for logical groups. A group is defined by a bounding box "grp*" |
|||
* containing one or more header lines "head*" and content-boxes "box*" |
|||
* ======================================================================= */ |
|||
.f-box1 { |
|||
font-family: verdana, sans-serif; |
|||
font-size: 8pt; |
|||
font-weight: normal; |
|||
color: #000000 |
|||
} |
|||
.f-head1 { |
|||
font-family: verdana, sans-serif; |
|||
font-size: 10pt; |
|||
font-weight: bold; |
|||
color: #000000 |
|||
} |
|||
/* ======================================================================= */ |
|||
|
|||
/* ======================================================================= |
|||
* Styles for tooltips |
|||
* ======================================================================= */ |
|||
/* ======================================================================= */ |
|||
|
After Width: 14 | Height: 14 | Size: 339 B |
|
After Width: 14 | Height: 14 | Size: 331 B |
|
After Width: 14 | Height: 14 | Size: 329 B |
|
After Width: 14 | Height: 14 | Size: 343 B |
@ -0,0 +1,48 @@ |
|||
/* |
|||
* requires levenshtein.js to be loaded first |
|||
*/ |
|||
|
|||
function distsort (_a, _b) |
|||
{ |
|||
var a = _a.substring (0, _a.indexOf('::')); |
|||
var b = _b.substring (0, _b.indexOf('::')); |
|||
|
|||
return a - b; |
|||
} |
|||
|
|||
function fittingStrings (search, strings, cs) |
|||
{ |
|||
var dists = new Array (); |
|||
|
|||
if (search.length <= 0) |
|||
return dists; |
|||
|
|||
if (cs == false) |
|||
_search = search.toUpperCase (); |
|||
else |
|||
_search = search; |
|||
|
|||
/* |
|||
* hier suche ich die zur Eingabe am besten passenden Eintraege |
|||
* in der Datenbank. Neben der eigentlichen distance ermittle ich noch |
|||
* einen Wert distance - Ueberhang(Datenbankstring zu Suchstring) |
|||
* Zweiter eignet sich besser zum Vergleich der Ergebnisse untereinander. |
|||
*/ |
|||
for (str in strings) |
|||
{ |
|||
if (cs == false) |
|||
_str = strings[str].toUpperCase (); |
|||
else |
|||
_str = strings[str]; |
|||
|
|||
var dist = levenshtein (_search, _str); |
|||
var delta = _str.length - _search.length; |
|||
var subDist = (delta > 0)? dist - delta: dist; |
|||
|
|||
dists.push (subDist + '::' + dist + '::' + strings[str]); |
|||
} |
|||
|
|||
dists.sort(distsort); |
|||
|
|||
return dists; |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
/* |
|||
Copyright (c) 2006. All Rights reserved. |
|||
|
|||
If you use this script, please email me and let me know, thanks! |
|||
Andrew Hedges |
|||
andrew (at) hedges (dot) name |
|||
If you want to hire me to write JavaScript for you, see my resume. |
|||
|
|||
http://andrew.hedges.name/resume/
|
|||
*/ |
|||
|
|||
// return the smallest of the three values passed in
|
|||
function minimum (x, y, z) |
|||
{ |
|||
if (x < y && x < z) return x; |
|||
if (y < x && y < z) return y; |
|||
return z; |
|||
} |
|||
|
|||
// calculate the Levenshtein distance between a and b,
|
|||
function levenshtein (a, b) |
|||
{ |
|||
var cost; |
|||
var m = a.length; |
|||
var n = b.length; |
|||
|
|||
// make sure a.length >= b.length to use O(min(n,m)) space
|
|||
if (m < n) |
|||
{ |
|||
var c=a; a=b; b=c; |
|||
var o=m; m=n; n=o; |
|||
} |
|||
|
|||
var r = new Array(); |
|||
r[0] = new Array(); |
|||
for (var c = 0; c < n+1; c++) |
|||
r[0][c] = c; |
|||
|
|||
for (var i = 1; i < m+1; i++) |
|||
{ |
|||
r[i] = new Array(); |
|||
r[i][0] = i; |
|||
|
|||
for (var j = 1; j < n+1; j++) |
|||
{ |
|||
cost = (a.charAt(i-1) == b.charAt(j-1))? 0: 1; |
|||
r[i][j] = minimum (r[i-1][j]+1, r[i][j-1]+1, r[i-1][j-1]+cost); |
|||
} |
|||
} |
|||
|
|||
return r[r.length-1][r[r.length-1].length-1]; |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
function c_person (personId, photographerId, ownerId, firstname, surname, |
|||
company, email, url, cameraId, wmWidth, wmHeight, wmXPos, wmYPos) |
|||
{ |
|||
this.personId = personId; |
|||
this.photographerId = photographerId; |
|||
this.ownerId = ownerId; |
|||
this.firstname = firstname; |
|||
this.surname = surname; |
|||
this.company = company; |
|||
this.email = email; |
|||
this.url = url; |
|||
this.cameraId = cameraId; |
|||
this.wmWidth = wmWidth; |
|||
this.wmHeight = wmHeight; |
|||
this.wmXPos = wmXPos; |
|||
this.wmYPos = wmYPos; |
|||
|
|||
this.personForm = null; |
|||
|
|||
this.connect = function (personForm) |
|||
{ |
|||
this.personForm = personForm; |
|||
} |
|||
|
|||
this.reset = function () |
|||
{ |
|||
if (this.personId != -1) |
|||
{ |
|||
this.personId = -1; |
|||
this.photographerId = -1; |
|||
this.ownerId = -1; |
|||
this.firstname = ''; |
|||
this.surname = ''; |
|||
this.company = ''; |
|||
this.email = ''; |
|||
this.url = ''; |
|||
this.cameraId = -1; |
|||
this.wmWidth = ''; |
|||
this.wmHeight = ''; |
|||
this.wmXPos = ''; |
|||
this.wmYPos = ''; |
|||
|
|||
if (this.personForm != null) |
|||
this.personForm.updateForm (); |
|||
} |
|||
} |
|||
|
|||
this.update = function (p) |
|||
{ |
|||
if (this.personId != p.personId) |
|||
{ |
|||
this.personId = p.personId; |
|||
this.photographerId = p.photographerId; |
|||
this.ownerId = p.ownerId; |
|||
this.firstname = p.firstname; |
|||
this.surname = p.surname; |
|||
this.company = p.company; |
|||
this.email = p.email; |
|||
this.url = p.url; |
|||
this.cameraId = p.cameraId; |
|||
this.wmWidth = p.wmWidth; |
|||
this.wmHeight = p.wmHeight; |
|||
this.wmXPos = p.wmXPos; |
|||
this.wmYPos = p.wmYPos; |
|||
|
|||
if (this.personForm != null) |
|||
this.personForm.updateForm (); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,209 @@ |
|||
/* |
|||
* requires fittingStrings.js to be loaded first |
|||
*/ |
|||
|
|||
|
|||
/* |
|||
* controls input/update formular for person insert |
|||
* |
|||
* Arguments: |
|||
* upId / ID of the insert checkbox |
|||
* inId / ID of the update checkbox |
|||
* persons / Array containing all persons already existant in DB |
|||
* |
|||
* Methods: |
|||
* de_activate / de/activate the formular fields for input |
|||
* updateForm / calls de_activate and controls the checkboxes |
|||
*/ |
|||
function personInUp ( |
|||
upId, inId, submitId, person, newPerson, arrRight, arrDown) |
|||
{ |
|||
this.updBox = upId; |
|||
this.insBox = inId; |
|||
this.submitButton = submitId; |
|||
this.arrRight = arrRight; |
|||
this.arrDown = arrDown; |
|||
this.person = person; |
|||
this.newPerson = newPerson; |
|||
|
|||
person.connect (this); |
|||
|
|||
this.de_activate = function (field) |
|||
{ |
|||
var updBox = document.getElementById (this.updBox); |
|||
var insBox = document.getElementById (this.insBox); |
|||
|
|||
if (updBox.checked == true || insBox.checked == true) |
|||
field.disabled = false; |
|||
else |
|||
field.disabled = true; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
this.un_fold = function (id, element) |
|||
{ |
|||
title = element.parentNode.getElementsByTagName ('div')[0]; |
|||
img = title.getElementsByTagName ('img')[0]; |
|||
|
|||
if (id != -1) |
|||
{ |
|||
element.style.display = 'block'; |
|||
img.src = this.arrDown.getImgUrl (title); |
|||
} |
|||
else |
|||
{ |
|||
element.style.display = 'none'; |
|||
img.src = this.arrRight.getImgUrl (title); |
|||
} |
|||
} |
|||
|
|||
this.updateFields = function (person) |
|||
{ |
|||
for (p in person) |
|||
{ |
|||
if (p == 'personForm') |
|||
break; |
|||
|
|||
var field = document.getElementById (p); |
|||
|
|||
if (field != null) |
|||
{ |
|||
field.value = person[p]; |
|||
this.de_activate (field); |
|||
} |
|||
|
|||
switch (p) |
|||
{ |
|||
case 'photographerId': |
|||
this.un_fold (person[p], |
|||
document.getElementById ('cameraId').parentNode.parentNode); |
|||
break; |
|||
case 'ownerId': |
|||
this.un_fold (person[p], |
|||
document.getElementById ('wmWidth').parentNode.parentNode); |
|||
} |
|||
} |
|||
} |
|||
|
|||
this.updateForm = function () |
|||
{ |
|||
var updBox = document.getElementById (this.updBox); |
|||
var insBox = document.getElementById (this.insBox); |
|||
var submitButton = document.getElementById (this.submitButton); |
|||
var person; |
|||
|
|||
if (this.person.personId != -1) |
|||
{ |
|||
if (insBox.checked == false) |
|||
{ |
|||
person = this.person; |
|||
updBox.disabled = false; |
|||
} |
|||
else |
|||
{ |
|||
person = this.newPerson; |
|||
updBox.checked = false; |
|||
updBox.disabled = true; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
person = this.newPerson; |
|||
updBox.checked = false; |
|||
updBox.disabled = true; |
|||
} |
|||
|
|||
if (updBox.checked == true || insBox.checked == true) |
|||
submitButton.disabled = false; |
|||
else |
|||
submitButton.disabled = true; |
|||
|
|||
this.updateFields (person); |
|||
|
|||
return false; |
|||
} |
|||
|
|||
this.selectPerson = function () |
|||
{ |
|||
var insBox = document.getElementById (this.insBox); |
|||
var person; |
|||
|
|||
if (insBox.checked == true) |
|||
person = this.newPerson; |
|||
else |
|||
person = this.person; |
|||
|
|||
return person; |
|||
} |
|||
|
|||
this.setFirstname = function (value) |
|||
{ |
|||
this.selectPerson ().firstname = value; |
|||
} |
|||
|
|||
this.setSurname = function (value) |
|||
{ |
|||
this.selectPerson ().surname = value; |
|||
} |
|||
|
|||
this.setCompany = function (value) |
|||
{ |
|||
this.selectPerson ().company = value; |
|||
} |
|||
|
|||
this.setEmail = function (value) |
|||
{ |
|||
this.selectPerson ().email = value; |
|||
} |
|||
|
|||
this.setUrl = function (value) |
|||
{ |
|||
this.selectPerson ().url = value; |
|||
} |
|||
|
|||
this.setCameraId = function (value) |
|||
{ |
|||
var person = this.selectPerson (); |
|||
|
|||
person.cameraId = value; |
|||
if (person == this.newPerson) |
|||
person.photographerId = 0; |
|||
} |
|||
|
|||
this.setWmWidth = function (value) |
|||
{ |
|||
var person = this.selectPerson (); |
|||
|
|||
person.wmWidth = value; |
|||
if (person == this.newPerson) |
|||
person.ownerId = 0; |
|||
} |
|||
|
|||
this.setWmHeight = function (value) |
|||
{ |
|||
var person = this.selectPerson (); |
|||
|
|||
person.wmHeight = value; |
|||
if (person == this.newPerson) |
|||
person.ownerId = 0; |
|||
} |
|||
|
|||
this.setWmXPos = function (value) |
|||
{ |
|||
var person = this.selectPerson (); |
|||
|
|||
person.wmXPos = value; |
|||
if (person == this.newPerson) |
|||
person.ownerId = 0; |
|||
} |
|||
|
|||
this.setWmYPos = function (value) |
|||
{ |
|||
var person = this.selectPerson (); |
|||
|
|||
person.wmYPos = value; |
|||
if (person == this.newPerson) |
|||
person.ownerId = 0; |
|||
} |
|||
} |
|||
@ -0,0 +1,179 @@ |
|||
/* |
|||
* requires fittingStrings.js to be loaded first |
|||
*/ |
|||
|
|||
|
|||
/* |
|||
* provide alternative Names already existent in DB to given names in |
|||
* input text fields: |
|||
* |
|||
* Arguments: |
|||
* fname / ID of the input text field with firstname |
|||
* sname / ID of the input text field with surname |
|||
* fnameAlt / ID of the list that recieves the alternative firstnames |
|||
* snameAlt / ID of the list that receives the alternative surnames |
|||
* names / Array containing the already existing names and persons. |
|||
* |
|||
* Methods: |
|||
* updField / exact match(no-case) found => update input field |
|||
* genAlternativesList / generate List of alternative Strings |
|||
* altSurnames / fill the list of alternative surnames |
|||
* altFirstnames / fill the list of alternative firstnames |
|||
*/ |
|||
function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|||
{ |
|||
this.firstname = fname; |
|||
this.surname = sname; |
|||
this.fNameAlt = fnameAlt; |
|||
this.sNameAlt = snameAlt; |
|||
|
|||
this.surnames = new Array (); |
|||
this.firstnames = new Array (); |
|||
this.persons = new Array (); |
|||
for (sn in names) |
|||
{ |
|||
this.surnames.push (sn); |
|||
this.firstnames[sn] = new Array (); |
|||
this.persons[sn] = new Array (); |
|||
for (d in names[sn]) |
|||
{ |
|||
this.firstnames[sn].push (names[sn][d][0]); |
|||
this.persons[sn][names[sn][d][0]] = names[sn][d][1]; |
|||
} |
|||
} |
|||
this.person = person; |
|||
|
|||
this.sNameBest = new Array (-1, -1, null); |
|||
this.fNameBest = new Array (-1, -1, null); |
|||
|
|||
this.show = function (id) |
|||
{ |
|||
var node = document.getElementById (id); |
|||
node.parentNode.style.visibility = 'visible'; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
this.hide = function (id) |
|||
{ |
|||
var node = document.getElementById (id); |
|||
node.parentNode.style.visibility = 'hidden'; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
this.updField = function (field, alternative, altId) |
|||
{ |
|||
if (alternative[1] == 0) |
|||
field.value = alternative[2]; |
|||
else |
|||
if (alternative[1] >= 0) |
|||
return this.show (altId); |
|||
|
|||
return this.hide (altId); |
|||
} |
|||
|
|||
this.genAlternativesList = function (bestFit, dists) |
|||
{ |
|||
if (dists.length > 0) |
|||
// there are caculated distances for surnames
|
|||
{ |
|||
var i = 0; |
|||
var bestMatch = dists[0].split ('::'); // infos for best match
|
|||
|
|||
// reset matches select
|
|||
while ((child = bestFit.firstChild) != null) |
|||
bestFit.removeChild (child); |
|||
|
|||
for (match in dists) |
|||
// walk through all matches
|
|||
{ |
|||
// get infos for match
|
|||
var sMatch = dists[match].split ('::'); |
|||
|
|||
// create list entries
|
|||
newLi = document.createElement ('li'); |
|||
liTxt = document.createTextNode (sMatch[2]); |
|||
newLi.appendChild (liTxt); |
|||
bestFit.appendChild (newLi); |
|||
i=i+1; |
|||
|
|||
if (i >= bestMatch[1]) |
|||
// dont show more than best match distance matches.
|
|||
break; |
|||
} |
|||
} |
|||
else |
|||
// there are no caculated distances for surnames
|
|||
{ |
|||
// reset matches select
|
|||
while ((child = bestFit.firstChild) != null) |
|||
bestFit.removeChild (child); |
|||
return new Array (-1, -1, ''); |
|||
} |
|||
|
|||
return bestMatch; |
|||
} |
|||
|
|||
this.altSurnames = function () |
|||
{ |
|||
var surname = document.getElementById (this.surname); |
|||
var sNameAlt = document.getElementById (this.sNameAlt); |
|||
var dists = fittingStrings (surname.value, this.surnames, false); |
|||
|
|||
this.sNameBest = this.genAlternativesList (sNameAlt, dists); |
|||
this.updField (surname, this.sNameBest, this.sNameAlt) |
|||
|
|||
if (this.sNameBest[1] == 0) |
|||
{ |
|||
var firstname = document.getElementById (this.firstname); |
|||
var dists = fittingStrings ( |
|||
firstname.value, this.firstnames[this.sNameBest[2]], false); |
|||
|
|||
if (dists.length > 0) |
|||
this.fNameBest = dists[0].split ('::'); |
|||
|
|||
if (this.person != null) |
|||
if (this.fNameBest[1] == 0) |
|||
this.person.update ( |
|||
this.persons[this.sNameBest[2]][this.fNameBest[2]]); |
|||
else |
|||
this.person.reset (); |
|||
} |
|||
else |
|||
{ |
|||
this.fNameBest = new Array (-1, -1, null); |
|||
if (this.person != null) |
|||
this.person.reset (); |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
this.altFirstnames = function (person) |
|||
{ |
|||
var firstname = document.getElementById (this.firstname); |
|||
var fNameAlt = document.getElementById (this.fNameAlt); |
|||
|
|||
if (this.sNameBest[1] == 0) |
|||
{ |
|||
var surname = document.getElementById (this.surname); |
|||
var dists = fittingStrings ( |
|||
firstname.value, this.firstnames[this.sNameBest[2]], false); |
|||
} |
|||
else |
|||
dists = new Array (); |
|||
|
|||
this.fNameBest = this.genAlternativesList (fNameAlt, dists); |
|||
this.updField (firstname, this.fNameBest, this.fNameAlt) |
|||
|
|||
if (this.person != null) |
|||
if (this.sNameBest[1] == 0 && this.fNameBest[1] == 0) |
|||
this.person.update ( |
|||
this.persons[this.sNameBest[2]][this.fNameBest[2]]); |
|||
else |
|||
this.person.reset (); |
|||
|
|||
return false; |
|||
} |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
function transPngBg (img, libUrl) |
|||
{ |
|||
this.img = img; |
|||
this.libUrl = libUrl; |
|||
|
|||
this.RGBtoHex = function (color) |
|||
{ |
|||
color = color.replace (/^rgb\((.*)\)$/, '$1'); |
|||
color = color.replace (/ /g, '').split (','); |
|||
|
|||
return this.toHex (color[0]) + |
|||
this.toHex (color[1]) + |
|||
this.toHex(color[2]); |
|||
} |
|||
|
|||
this.toHex = function (N) |
|||
{ |
|||
if (N == null) |
|||
return "00"; |
|||
|
|||
N = parseInt(N); |
|||
if (N == 0 || isNaN(N)) |
|||
return "00"; |
|||
|
|||
N = Math.max (0, N); |
|||
N = Math.min (N, 255); |
|||
N = Math.round(N); |
|||
|
|||
return "0123456789ABCDEF".charAt ((N-N % 16) / 16) + |
|||
"0123456789ABCDEF".charAt (N % 16); |
|||
} |
|||
|
|||
this.getImgUrl = function (posElement) |
|||
{ |
|||
var cNames = posElement.className.split (' '); |
|||
var color = posElement.style.backgroundImage; |
|||
|
|||
// try to get the background color of the given element from class
|
|||
// ----------------------------------------------------------------
|
|||
if (color == '') |
|||
{ |
|||
var cName; |
|||
|
|||
for (var cN in cNames) |
|||
{ |
|||
if (cNames[cN].indexOf ('bgc') != -1) |
|||
{ |
|||
cName = cNames[cN]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
loop: for (var i=0; i<document.styleSheets.length; i++) |
|||
{ |
|||
var rules = document.styleSheets[i].cssRules; |
|||
if (rules == null) |
|||
rules = document.styleSheets[i].rules; |
|||
|
|||
for (var j=0; j<rules.length; j++) |
|||
{ |
|||
var selector = rules[j].selectorText; |
|||
|
|||
if (selector.indexOf (cName) != -1) |
|||
{ |
|||
color = rules[j].style.backgroundColor; |
|||
|
|||
if (color.indexOf ('#') != -1) |
|||
color = color.substr (1); |
|||
else |
|||
color = this.RGBtoHex (color); |
|||
|
|||
break loop; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
// ----------------------------------------------------------------
|
|||
|
|||
return this.libUrl + 'gd_bgMerge.php?col=' + color + '&img=' + this.img; |
|||
} |
|||
} |
|||
@ -0,0 +1,595 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* |
|||
* Error constants. |
|||
* |
|||
*/ |
|||
|
|||
define('SAVANT2_ERROR_ASSIGN', -1); |
|||
define('SAVANT2_ERROR_ASSIGNREF', -2); |
|||
define('SAVANT2_ERROR_COMPILER', -3); |
|||
define('SAVANT2_ERROR_NOFILTER', -4); |
|||
define('SAVANT2_ERROR_NOPLUGIN', -5); |
|||
define('SAVANT2_ERROR_NOSCRIPT', -6); |
|||
define('SAVANT2_ERROR_NOTEMPLATE', -7); |
|||
define('SAVANT2_ERROR_COMPILE_FAIL', -8); |
|||
|
|||
|
|||
/** |
|||
* |
|||
* Error messages. |
|||
* |
|||
*/ |
|||
|
|||
if (! isset($GLOBALS['_SAVANT2']['error'])) { |
|||
$GLOBALS['_SAVANT2']['error'] = array( |
|||
SAVANT2_ERROR_ASSIGN => 'assign() parameters not correct', |
|||
SAVANT2_ERROR_ASSIGNREF => 'assignRef() parameters not correct', |
|||
SAVANT2_ERROR_COMPILER => 'compiler not an object or has no compile() method', |
|||
SAVANT2_ERROR_NOFILTER => 'filter file not found', |
|||
SAVANT2_ERROR_NOPLUGIN => 'plugin file not found', |
|||
SAVANT2_ERROR_NOSCRIPT => 'compiled template script file not found', |
|||
SAVANT2_ERROR_NOTEMPLATE => 'template source file not found', |
|||
SAVANT2_ERROR_COMPILE_FAIL => 'template source failed to compile' |
|||
); |
|||
} |
|||
|
|||
class Savant2_Error { |
|||
|
|||
var $code = null; |
|||
var $info = array(); |
|||
var $text = null; |
|||
var $backtrace = null; |
|||
|
|||
function Savant2_Error($conf = array()) |
|||
{ |
|||
// set public properties
|
|||
foreach ($conf as $key => $val) { |
|||
$this->$key = $val; |
|||
} |
|||
|
|||
// generate a backtrace
|
|||
if (function_exists('debug_backtrace')) { |
|||
$this->backtrace = debug_backtrace(); |
|||
} |
|||
|
|||
// extended behaviors
|
|||
$this->_genError(); |
|||
} |
|||
|
|||
function _genError() |
|||
{ |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* |
|||
* This is totally based on Savent by Paul M. Jones <pmjones@ciaweb.net>. |
|||
* But is made much smaller... |
|||
*/ |
|||
|
|||
class SavantSmall { |
|||
|
|||
var $_error = null; |
|||
var $_escape = array('htmlspecialchars'); |
|||
var $_output = null; |
|||
|
|||
var $_path = array( |
|||
'resource' => array(), |
|||
'template' => array() |
|||
); |
|||
|
|||
var $_restrict = false; |
|||
|
|||
var $_template = null; |
|||
|
|||
|
|||
// -----------------------------------------------------------------
|
|||
//
|
|||
// Constructor and general property setters
|
|||
//
|
|||
// -----------------------------------------------------------------
|
|||
|
|||
|
|||
function __construct($conf = array()) |
|||
{ |
|||
// set the default template search dirs
|
|||
if (isset($conf['template_path'])) { |
|||
// user-defined dirs
|
|||
$this->setPath('template', $conf['template_path']); |
|||
} else { |
|||
// default directory only
|
|||
$this->setPath('template', null); |
|||
} |
|||
|
|||
// set the error class
|
|||
if (isset($conf['error'])) { |
|||
$this->setError($conf['error']); |
|||
} |
|||
|
|||
// set the restrict flag
|
|||
if (isset($conf['restrict'])) { |
|||
$this->setRestrict($conf['restrict']); |
|||
} |
|||
|
|||
// set the default template
|
|||
if (isset($conf['template'])) { |
|||
$this->setTemplate($conf['template']); |
|||
} |
|||
|
|||
// set the output escaping callbacks
|
|||
if (isset($config['escape'])) { |
|||
call_user_func_array( |
|||
array($this, 'setEscape'), |
|||
(array) $config['escape'] |
|||
); |
|||
} |
|||
} |
|||
|
|||
function setError($error) |
|||
{ |
|||
if (! $error) { |
|||
$this->_error = null; |
|||
} else { |
|||
$this->_error = $error; |
|||
} |
|||
} |
|||
|
|||
function setRestrict($flag = false) |
|||
{ |
|||
if ($flag) { |
|||
$this->_restrict = true; |
|||
} else { |
|||
$this->_restrict = false; |
|||
} |
|||
} |
|||
|
|||
function setTemplate($template) |
|||
{ |
|||
$this->_template = $template; |
|||
} |
|||
|
|||
|
|||
// -----------------------------------------------------------------
|
|||
//
|
|||
// Output escaping and management.
|
|||
//
|
|||
// -----------------------------------------------------------------
|
|||
|
|||
function setEscape() |
|||
{ |
|||
$this->_escape = func_get_args(); |
|||
} |
|||
|
|||
function addEscape() |
|||
{ |
|||
$args = func_get_args(); |
|||
$this->_escape = array_merge($this->_escape, $args); |
|||
} |
|||
|
|||
function getEscape() |
|||
{ |
|||
return $this->_escape; |
|||
} |
|||
|
|||
function escape($value) |
|||
{ |
|||
// if value is not set return
|
|||
if (! isset ($value)) |
|||
return $value; |
|||
|
|||
// were custom callbacks passed?
|
|||
if (func_num_args() == 1) { |
|||
|
|||
// no, only a value was passed.
|
|||
// loop through the predefined callbacks.
|
|||
foreach ($this->_escape as $func) { |
|||
$value = call_user_func($func, $value); |
|||
} |
|||
|
|||
} else { |
|||
|
|||
// yes, use the custom callbacks instead.
|
|||
$callbacks = func_get_args(); |
|||
|
|||
// drop $value
|
|||
array_shift($callbacks); |
|||
|
|||
// loop through custom callbacks.
|
|||
foreach ($callbacks as $func) { |
|||
$value = call_user_func($func, $value); |
|||
} |
|||
|
|||
} |
|||
|
|||
return $value; |
|||
} |
|||
|
|||
function eprint($value) |
|||
{ |
|||
$args = func_get_args(); |
|||
echo call_user_func_array( |
|||
array($this, 'escape'), |
|||
$args |
|||
); |
|||
} |
|||
|
|||
function _($value) |
|||
{ |
|||
$args = func_get_args(); |
|||
return call_user_func_array( |
|||
array($this, 'eprint'), |
|||
$args |
|||
); |
|||
} |
|||
|
|||
|
|||
|
|||
// -----------------------------------------------------------------
|
|||
//
|
|||
// Path management and file finding
|
|||
//
|
|||
// -----------------------------------------------------------------
|
|||
|
|||
function setPath($type, $new) |
|||
{ |
|||
// clear out the prior search dirs
|
|||
$this->_path[$type] = array(); |
|||
|
|||
// convert from string to path
|
|||
if (is_string($new) && ! strpos('://', $new)) { |
|||
// the search config is a string, and it's not a stream
|
|||
// identifier (the "://" piece), add it as a path
|
|||
// string.
|
|||
$new = explode(PATH_SEPARATOR, $new); |
|||
} else { |
|||
// force to array
|
|||
settype($new, 'array'); |
|||
} |
|||
|
|||
// always add the fallback directories as last resort
|
|||
switch (strtolower($type)) { |
|||
case 'template': |
|||
$this->addPath($type, '.'); |
|||
break; |
|||
case 'resource': |
|||
$this->addPath($type, dirname(__FILE__) . '/Savant2/'); |
|||
break; |
|||
} |
|||
|
|||
// actually add the user-specified directories
|
|||
foreach ($new as $dir) { |
|||
$this->addPath($type, $dir); |
|||
} |
|||
} |
|||
|
|||
function addPath($type, $dir) |
|||
{ |
|||
// no surrounding spaces allowed!
|
|||
$dir = trim($dir); |
|||
|
|||
// add trailing separators as needed
|
|||
if (strpos($dir, '://') && substr($dir, -1) != '/') { |
|||
// stream
|
|||
$dir .= '/'; |
|||
} elseif (substr($dir, -1) != DIRECTORY_SEPARATOR) { |
|||
// directory
|
|||
$dir .= DIRECTORY_SEPARATOR; |
|||
} |
|||
|
|||
// add to the top of the search dirs
|
|||
array_unshift($this->_path[$type], $dir); |
|||
} |
|||
|
|||
function getPath($type = null) |
|||
{ |
|||
if (! $type) { |
|||
return $this->_path; |
|||
} else { |
|||
return $this->_path[$type]; |
|||
} |
|||
} |
|||
|
|||
function findFile($type, $file) |
|||
{ |
|||
// get the set of paths
|
|||
$set = $this->getPath($type); |
|||
|
|||
// start looping through them
|
|||
foreach ($set as $path) { |
|||
|
|||
// get the path to the file
|
|||
$fullname = $path . $file; |
|||
|
|||
// are we doing path checks?
|
|||
if (! $this->_restrict) { |
|||
|
|||
// no. this is faster but less secure.
|
|||
if (file_exists($fullname) && is_readable($fullname)) { |
|||
return $fullname; |
|||
} |
|||
|
|||
} else { |
|||
|
|||
// yes. this is slower, but attempts to restrict
|
|||
// access only to defined paths.
|
|||
|
|||
// is the path based on a stream?
|
|||
if (strpos('://', $path) === false) { |
|||
// not a stream, so do a realpath() to avoid
|
|||
// directory traversal attempts on the local file
|
|||
// system. Suggested by Ian Eure, initially
|
|||
// rejected, but then adopted when the secure
|
|||
// compiler was added.
|
|||
$path = realpath($path); // needed for substr() later
|
|||
$fullname = realpath($fullname); |
|||
} |
|||
|
|||
// the substr() check added by Ian Eure to make sure
|
|||
// that the realpath() results in a directory registered
|
|||
// with Savant so that non-registered directores are not
|
|||
// accessible via directory traversal attempts.
|
|||
if (file_exists($fullname) && is_readable($fullname) && |
|||
substr($fullname, 0, strlen($path)) == $path) { |
|||
return $fullname; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// could not find the file in the set of paths
|
|||
return false; |
|||
} |
|||
|
|||
|
|||
// -----------------------------------------------------------------
|
|||
//
|
|||
// Variable and reference assignment
|
|||
//
|
|||
// -----------------------------------------------------------------
|
|||
|
|||
function assign() |
|||
{ |
|||
// this method is overloaded.
|
|||
$arg = func_get_args(); |
|||
|
|||
// must have at least one argument. no error, just do nothing.
|
|||
if (! isset($arg[0])) { |
|||
return; |
|||
} |
|||
|
|||
// assign by object
|
|||
if (is_object($arg[0])) { |
|||
// assign public properties
|
|||
foreach (get_object_vars($arg[0]) as $key => $val) { |
|||
if (substr($key, 0, 1) != '_') { |
|||
$this->$key = $val; |
|||
} |
|||
} |
|||
return; |
|||
} |
|||
|
|||
// assign by associative array
|
|||
if (is_array($arg[0])) { |
|||
foreach ($arg[0] as $key => $val) { |
|||
if (substr($key, 0, 1) != '_') { |
|||
$this->$key = $val; |
|||
} |
|||
} |
|||
return; |
|||
} |
|||
|
|||
// assign by string name and mixed value.
|
|||
//
|
|||
// we use array_key_exists() instead of isset() becuase isset()
|
|||
// fails if the value is set to null.
|
|||
if (is_string($arg[0]) && |
|||
substr($arg[0], 0, 1) != '_' && |
|||
array_key_exists(1, $arg)) { |
|||
$this->$arg[0] = $arg[1]; |
|||
} else { |
|||
return $this->_genError(SAVANT2_ERROR_ASSIGN, $arg); |
|||
} |
|||
} |
|||
|
|||
function assignRef($key, &$val) |
|||
{ |
|||
if (is_string($key) && substr($key, 0, 1) != '_') { |
|||
$this->$key =& $val; |
|||
} else { |
|||
return $this->_genError( |
|||
SAVANT2_ERROR_ASSIGNREF, |
|||
array('key' => $key, 'val' => $val) |
|||
); |
|||
} |
|||
} |
|||
|
|||
function clear($var = null) |
|||
{ |
|||
if (is_null($var)) { |
|||
// clear all variables
|
|||
$var = array_keys(get_object_vars($this)); |
|||
} else { |
|||
// clear specific variables
|
|||
settype($var, 'array'); |
|||
} |
|||
|
|||
// clear out the selected variables
|
|||
foreach ($var as $name) { |
|||
if (substr($name, 0, 1) != '_' && isset($this->$name)) { |
|||
unset($this->$name); |
|||
} |
|||
} |
|||
} |
|||
|
|||
function getVars($key = null) |
|||
{ |
|||
if (is_null($key)) { |
|||
$key = array_keys(get_object_vars($this)); |
|||
} |
|||
|
|||
if (is_array($key)) { |
|||
// return a series of vars
|
|||
$tmp = array(); |
|||
foreach ($key as $var) { |
|||
if (substr($var, 0, 1) != '_' && isset($this->$var)) { |
|||
$tmp[$var] = $this->$var; |
|||
} |
|||
} |
|||
return $tmp; |
|||
} else { |
|||
// return a single var
|
|||
if (substr($key, 0, 1) != '_' && isset($this->$key)) { |
|||
return $this->$key; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
// -----------------------------------------------------------------
|
|||
//
|
|||
// Template processing
|
|||
//
|
|||
// -----------------------------------------------------------------
|
|||
|
|||
function loadTemplate($tpl = null, $setScript = false) |
|||
{ |
|||
// set to default template if none specified.
|
|||
if (is_null($tpl)) { |
|||
$tpl = $this->_template; |
|||
} |
|||
|
|||
// find the template source.
|
|||
$file = $this->findFile('template', $tpl); |
|||
if (! $file) { |
|||
return $this->_genError( |
|||
SAVANT2_ERROR_NOTEMPLATE, |
|||
array('template' => $tpl) |
|||
); |
|||
} |
|||
|
|||
// no compiling requested, return the source path
|
|||
$this->_script = $file; |
|||
return $file; |
|||
} |
|||
|
|||
function findTemplate($tpl = null) |
|||
{ |
|||
return $this->loadTemplate($tpl, false); |
|||
} |
|||
|
|||
function fetch($_tpl = null) |
|||
{ |
|||
// clear prior output
|
|||
$this->_output = null; |
|||
|
|||
// load the template script
|
|||
$_result = $this->loadTemplate($_tpl, true); |
|||
|
|||
// is there a template script to be processed?
|
|||
if ($this->isError($_result)) { |
|||
return $_result; |
|||
} |
|||
|
|||
// unset so as not to introduce into template scope
|
|||
unset($_tpl); |
|||
unset($_result); |
|||
|
|||
// never allow a 'this' property
|
|||
if (isset($this->this)) { |
|||
unset($this->this); |
|||
} |
|||
|
|||
// start capturing output into a buffer
|
|||
ob_start(); |
|||
|
|||
// include the requested template filename in the local scope
|
|||
// (this will execute the view logic).
|
|||
include $this->_script; |
|||
|
|||
// done with the requested template; get the buffer and
|
|||
// clear it.
|
|||
$this->_output = ob_get_contents(); |
|||
ob_end_clean(); |
|||
|
|||
// done!
|
|||
return $this->_output; |
|||
} |
|||
|
|||
function display($tpl = null) |
|||
{ |
|||
$result = $this->fetch($tpl); |
|||
if ($this->isError($result)) { |
|||
return $result; |
|||
} else { |
|||
echo $result; |
|||
} |
|||
} |
|||
|
|||
// -----------------------------------------------------------------
|
|||
//
|
|||
// Error handling
|
|||
//
|
|||
// -----------------------------------------------------------------
|
|||
|
|||
function &_genError($code, $info = array()) |
|||
{ |
|||
// the error config array
|
|||
$conf = array( |
|||
'code' => $code, |
|||
'text' => 'Savant2: ', |
|||
'info' => (array) $info |
|||
); |
|||
|
|||
// set an error message from the globals
|
|||
if (isset($GLOBALS['_SAVANT2']['error'][$code])) { |
|||
$conf['text'] .= $GLOBALS['_SAVANT2']['error'][$code]; |
|||
} else { |
|||
$conf['text'] .= '???'; |
|||
} |
|||
|
|||
// set up the error class name
|
|||
if ($this->_error) { |
|||
$class = 'Savant2_Error_' . $this->_error; |
|||
} else { |
|||
$class = 'Savant2_Error'; |
|||
} |
|||
|
|||
// set up the error class file name
|
|||
$file = $class . '.php'; |
|||
|
|||
// is it loaded?
|
|||
if (! class_exists($class)) { |
|||
|
|||
// find the error class
|
|||
$result = $this->findFile('resource', $file); |
|||
if (! $result) { |
|||
// could not find the custom error class, revert to
|
|||
// Savant_Error base class.
|
|||
$class = 'Savant2_Error'; |
|||
$result = dirname(__FILE__) . '/Savant2/Error.php'; |
|||
} |
|||
|
|||
// include the error class
|
|||
include_once $result; |
|||
} |
|||
|
|||
// instantiate and return the error class
|
|||
$err = new $class($conf); |
|||
return $err; |
|||
} |
|||
|
|||
function isError(&$obj) |
|||
{ |
|||
if (is_object($obj)) { |
|||
if ($obj instanceof Savant2_Error || |
|||
is_subclass_of($obj, 'Savant2_Error')) { |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
} |
|||
?>
|
|||
@ -0,0 +1,226 @@ |
|||
<?php |
|||
|
|||
require_once LIBDIR . 'errException.php'; |
|||
|
|||
class mysqlQueryException extends errException |
|||
{ |
|||
private $query; |
|||
|
|||
function __construct ($msg, $no, $file, $line, $context, $query) |
|||
{ |
|||
parent::__construct ($msg, $no, $file, $line, $context); |
|||
|
|||
$this->query = $query; |
|||
} |
|||
|
|||
function __toString () |
|||
{ |
|||
$retStr = "Fehler in Query: \n"; |
|||
$retStr .= $this->query . "\n\n"; |
|||
$retStr .= $this->message . "\n\n"; |
|||
$retStr .= 'Datei: ' . $this->file . "\n"; |
|||
$retStr .= 'Zeile: ' . $this->line . "\n\n"; |
|||
|
|||
if ($this->errContext != NULL) |
|||
{ |
|||
$retStr .= "Fehler Context: \n"; |
|||
$retStr .= print_r ($this->errContext, TRUE) . "\n"; |
|||
} |
|||
|
|||
$retStr .= "Aufruf Stack: \n"; |
|||
$retStr .= $this->getTraceAsString () . "\n"; |
|||
|
|||
return $retStr; |
|||
} |
|||
} |
|||
|
|||
/*** |
|||
* This class depends on errException.php, as it does not handle any |
|||
* error at all, except it catches exceptions. |
|||
*/ |
|||
class c_mysqlDb |
|||
{ |
|||
private $connectRes; |
|||
private $host; |
|||
private $user; |
|||
private $pass; |
|||
private $database; |
|||
|
|||
private $result = array (); |
|||
private $resCount = 0; |
|||
|
|||
private function getAllData ($resId, $method, $class = NULL, $parm = NULL) |
|||
{ |
|||
$ret = array (); |
|||
|
|||
if (isset ($this->result[$resId]) && $this->result[$resId] != FALSE) |
|||
{ |
|||
try |
|||
{ |
|||
mysql_data_seek ($this->result[$resId], 0); |
|||
} |
|||
catch (Exception $e) |
|||
{ |
|||
if ($e->getCode () != 2) |
|||
throw ($e); |
|||
// wenn der Fehlercode gleich 2 ist war das resultset nur leer
|
|||
// und ich mache weiter.
|
|||
} |
|||
|
|||
if ($class === NULL) |
|||
$row = $method ($this->result[$resId]); |
|||
else |
|||
$row = $method ($this->result[$resId], $class, $parm); |
|||
|
|||
while ($row != FALSE) |
|||
{ |
|||
$ret[] = $row; |
|||
if ($class === NULL) |
|||
$row = $method ($this->result[$resId]); |
|||
else |
|||
$row = $method ($this->result[$resId], $class, $parm); |
|||
} |
|||
} |
|||
|
|||
return $ret; |
|||
} |
|||
|
|||
function __construct ($host, $user, $pass, $db) |
|||
{ |
|||
/* init member */ |
|||
$this->host = $host; |
|||
$this->user = $user; |
|||
$this->pass = $pass; |
|||
$this->database = $db; |
|||
|
|||
/* connect and select db */ |
|||
$this->connectRes = mysql_pconnect ( |
|||
$this->host, |
|||
$this->user, |
|||
$this->pass); |
|||
mysql_select_db ($this->database); |
|||
mysql_query ('set character set utf8'); |
|||
} |
|||
|
|||
function __destruct () |
|||
{ |
|||
/* close connection */ |
|||
mysql_close ($this->connectRes); |
|||
} |
|||
|
|||
function query ($query) |
|||
{ |
|||
try |
|||
{ |
|||
for ($i = 0; $i < $this->resCount; $i++) |
|||
if (! isset ($this->result[$i])) |
|||
break; |
|||
|
|||
if ($i == $this->resCount) |
|||
$i = $this->resCount = $this->resCount + 1; |
|||
|
|||
$this->result[$i] = mysql_query ($query); |
|||
|
|||
if ($this->result[$i] === FALSE) |
|||
throw new Exception (mysql_error (), mysql_errno ()); |
|||
|
|||
return $i; |
|||
} |
|||
catch (errException $e) |
|||
{ |
|||
throw new mysqlQueryException ( |
|||
$e->getMessage (), |
|||
$e->getCode (), |
|||
$e->getFile (), |
|||
$e->getLine (), |
|||
$e->getErrContext (), |
|||
$query); |
|||
} |
|||
catch (Exception $e) |
|||
{ |
|||
throw new mysqlQueryException ( |
|||
$e->getMessage (), |
|||
$e->getCode (), |
|||
$e->getFile (), |
|||
$e->getLine (), |
|||
NULL, |
|||
$query); |
|||
} |
|||
} |
|||
|
|||
function freeResult ($resId) |
|||
{ |
|||
if (is_resource ($this->result[$resId])) |
|||
mysql_free_result ($this->result[$resId]); |
|||
unset ($this->result[$resId]); |
|||
} |
|||
|
|||
function resetResult ($resId) |
|||
{ |
|||
mysql_data_seek ($this->result[$resId], 0); |
|||
} |
|||
|
|||
function getResult ($resId) |
|||
{ |
|||
return $this->result[$resId]; |
|||
} |
|||
|
|||
function getAssoc ($resId) |
|||
{ |
|||
return $this->getAllData ($resId, 'mysql_fetch_assoc'); |
|||
} |
|||
|
|||
function getArray ($resId) |
|||
{ |
|||
return $this->getAllData ($resId, 'mysql_fetch_row'); |
|||
} |
|||
|
|||
function getObject ($resId, $class, $parm = NULL) |
|||
{ |
|||
return $this->getAllData ($resId, 'mysql_fetch_object', $class, $parm); |
|||
} |
|||
|
|||
function rows ($resId) |
|||
{ |
|||
return mysql_num_rows ($this->result[$resId]); |
|||
} |
|||
|
|||
function get ($resId, $row, $col) |
|||
{ |
|||
if ($row > mysql_num_rows ($this->result[$resId])) |
|||
return NULL; |
|||
|
|||
mysql_data_seek ($this->result[$resId], $row); |
|||
|
|||
if (is_int ($col) && $col > mysql_num_fields ($this->result[$resId])) |
|||
return NULL; |
|||
|
|||
if (is_string ($col)) |
|||
{ |
|||
$rowData = mysql_fetch_assoc ($this->result[$resId]); |
|||
|
|||
if (! array_key_exists ($col, $rowData)) |
|||
return NULL; |
|||
} |
|||
|
|||
return mysql_result ($this->result[$resId], $row, $col); |
|||
} |
|||
|
|||
// === einige nuetzlich Sachen ========================================
|
|||
function setLocale ($locale) |
|||
{ |
|||
$resId = $this->query ('set @LANG=\'' . $locale . '\''); |
|||
$this->freeResult ($resId); |
|||
} |
|||
}; |
|||
|
|||
/* quote string (und pack ' herum) */ |
|||
function quoteS ($var) |
|||
{ |
|||
if ($var === NULL) |
|||
return 'NULL'; |
|||
|
|||
return "'" . addslashes ($var) . "'"; |
|||
} |
|||
|
|||
?>
|
|||
@ -0,0 +1,42 @@ |
|||
<?php |
|||
|
|||
require_once LIBDIR . 'c_xmlify.php'; |
|||
|
|||
class c_person extends c_xmlify |
|||
{ |
|||
protected $personId; |
|||
protected $photographerId; |
|||
protected $ownerId; |
|||
protected $firstname; |
|||
protected $surname; |
|||
protected $company; |
|||
protected $email; |
|||
protected $url; |
|||
protected $cameraId; |
|||
protected $wmWidth; |
|||
protected $wmHeight; |
|||
protected $wmXPos; |
|||
protected $wmYPos; |
|||
|
|||
function __construct ($xr) |
|||
{ |
|||
if (NULL !== $xr) |
|||
parent::__construct ($xr); |
|||
} |
|||
|
|||
function get_personId () { return $this->personId; } |
|||
function get_photographerId () { return $this->photographerId; } |
|||
function get_ownerId () { return $this->ownerId; } |
|||
function get_firstname () { return $this->firstname; } |
|||
function get_surname () { return $this->surname; } |
|||
function get_company () { return $this->company; } |
|||
function get_email () { return $this->email; } |
|||
function get_url () { return $this->url; } |
|||
function get_cameraId () { return $this->cameraId; } |
|||
function get_wmWidth () { return $this->wmWidth; } |
|||
function get_wmHeight () { return $this->wmHeight; } |
|||
function get_wmXPos () { return $this->wmXPos; } |
|||
function get_wmYPos () { return $this->wmYPos; } |
|||
}; |
|||
|
|||
?>
|
|||
@ -0,0 +1,114 @@ |
|||
<?php |
|||
|
|||
require_once PICTOOL_SAVANT; |
|||
require_once LIBDIR . 'c_mysqlDb.php'; |
|||
require_once LIBDIR . 'errException.php'; |
|||
require_once LIBDIR . 'c_person.php'; |
|||
|
|||
class c_personAdmin extends c_picToolSavant |
|||
{ |
|||
private $dbHandle = NULL; |
|||
private $_persons; |
|||
|
|||
function __construct ($locale = NULL) |
|||
{ |
|||
parent::__construct (); |
|||
|
|||
setErrExceptionMapping (); |
|||
|
|||
try |
|||
{ |
|||
$this->dbHandle = new c_mysqlDb ( |
|||
self::DBHOST, self::DBUSER, self::DBPASS, self::DBNAME); |
|||
|
|||
if (is_string ($locale)) |
|||
$this->dbHandle->setLocale ($locale); |
|||
} |
|||
catch (Exception $e) |
|||
{ |
|||
if ($this->dbHandle !== NULL) |
|||
unset ($this->dbHandle); |
|||
|
|||
print "<pre>\n"; |
|||
print "Konnte Datenbank nicht initialisieren!\n"; |
|||
print $e; |
|||
print "</pre>\n"; |
|||
exit (1); |
|||
} |
|||
|
|||
resetErrExceptionMapping (); |
|||
|
|||
$this->_persons = $this->getPersons (); |
|||
} |
|||
|
|||
function __destruct () |
|||
{ |
|||
if (isset ($this->persons)) |
|||
unset ($this->persons); |
|||
|
|||
if ($this->dbHandle !== NULL) |
|||
unset ($this->dbHandle); |
|||
} |
|||
|
|||
private function getPersons () |
|||
{ |
|||
$result = NULL; |
|||
|
|||
setErrExceptionMapping (); |
|||
try |
|||
{ |
|||
$resId = $this->dbHandle->query ( |
|||
'SELECT * from personsView ORDER BY surname, firstname'); |
|||
$_result = $this->dbHandle->getObject ( |
|||
$resId, 'c_person', array (NULL)); |
|||
$this->dbHandle->freeResult ($resId); |
|||
} |
|||
catch (Exception $e) |
|||
{ |
|||
print "jokus<br/>"; |
|||
if (isset ($_result)) |
|||
unset ($_result); |
|||
if (isset ($resId)) |
|||
$this->dbHandle->freeResult ($resId); |
|||
|
|||
print "<pre>"; |
|||
print $e; |
|||
print "</pre>"; |
|||
} |
|||
resetErrExceptionMapping (); |
|||
|
|||
foreach ($_result as $res) |
|||
$result[$res->get_personId ()] = $res; |
|||
unset ($_result); |
|||
|
|||
return $result; |
|||
} |
|||
|
|||
function personSearch1 () |
|||
{ |
|||
$names = array (); |
|||
|
|||
foreach ($this->_persons as $person) |
|||
$names[$person->get_surname ()][] = |
|||
array ($person->get_firstname (), $person); |
|||
|
|||
$this->assign ('names', $names); |
|||
|
|||
return $this->fetch ('personAdmin/personSearch1.tpl.php'); |
|||
} |
|||
|
|||
function personInUp () |
|||
{ |
|||
return $this->fetch ('personAdmin/personInUp.tpl.php'); |
|||
} |
|||
|
|||
function show () |
|||
{ |
|||
$this->assign ('personSearch1', $this->personSearch1 ()); |
|||
$this->assign ('personInUp', $this->personInUp ()); |
|||
|
|||
$this->display ('personAdmin/personAdmin.tpl.php'); |
|||
} |
|||
}; |
|||
|
|||
?>
|
|||
@ -0,0 +1,27 @@ |
|||
<?php |
|||
|
|||
require_once SAVANT_SMALL; |
|||
|
|||
class c_picToolSavant extends SavantSmall |
|||
{ |
|||
const DBHOST = 'localhost'; |
|||
const DBUSER = 'picadmin'; |
|||
const DBPASS = '1Rz3ftb.'; |
|||
const DBNAME = 'bilder_new'; |
|||
|
|||
function __construct() |
|||
{ |
|||
parent::__construct (); |
|||
|
|||
$this->addPath ('template', TPLDIR); |
|||
} |
|||
|
|||
function is_set($varname) |
|||
{ |
|||
if ($this->getVars($varname)) |
|||
return true; |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
?>
|
|||
@ -0,0 +1,249 @@ |
|||
<?php |
|||
|
|||
/* |
|||
* xml stream to native vars |
|||
*/ |
|||
function xmlToVar ($xr) |
|||
{ |
|||
if ($xr->isEmptyElement == TRUE) |
|||
return NULL; |
|||
|
|||
$ret = NULL; |
|||
|
|||
while ($xr->read () && |
|||
! ($xr->nodeType == 15 && |
|||
$xr->name == 'variable')) |
|||
{ |
|||
if ($xr->nodeType == 3 && $xr->hasValue == TRUE) |
|||
// der iconv is nur drin weil evolver ihre Seiten dummer weise
|
|||
// als latin1 verschicken, aus der Datenbank aber utf-8 kommt.
|
|||
$ret = iconv ("UTF-8", "ISO-8859-1", $xr->value); |
|||
} |
|||
|
|||
return $ret; |
|||
} |
|||
|
|||
function xmlToArray ($xr) |
|||
{ |
|||
$ret = array (); |
|||
|
|||
if ($xr->isEmptyElement == TRUE) |
|||
return $ret; |
|||
|
|||
while ($xr->read () && |
|||
! ($xr->nodeType == 15 && |
|||
$xr->name == 'array')) |
|||
{ |
|||
if ($xr->nodeType == 1 && |
|||
$xr->name == 'item') |
|||
{ |
|||
$key = $xr->getAttribute ('key'); |
|||
|
|||
while ($xr->read () && |
|||
! ($xr->nodeType == 15 && |
|||
$xr->name == 'item')) |
|||
{ |
|||
if ($xr->nodeType == 1) |
|||
{ |
|||
switch ($xr->name) |
|||
{ |
|||
case 'variable': |
|||
$ret[$key] = xmlToVar ($xr); |
|||
$type = $xr->getAttribute ('type'); |
|||
settype ($ret[$key], $type); |
|||
break; |
|||
|
|||
case 'array': |
|||
$ret[$key] = xmlToArray ($xr); |
|||
break; |
|||
|
|||
case 'class': |
|||
$class = $xr->getAttribute ('class'); |
|||
$ret[$key] = new $class ($xr); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
return $ret; |
|||
} |
|||
|
|||
/* |
|||
* native vars to xml stream |
|||
*/ |
|||
function varToXml ($xw, $name, $val) |
|||
{ |
|||
$xw->startElement ('variable'); |
|||
|
|||
if ($name !== NULL) |
|||
$xw->writeAttribute ('name', $name); |
|||
|
|||
$xw->writeAttribute ('type', gettype ($val)); |
|||
|
|||
$xw->text ($val); |
|||
|
|||
$xw->endElement (); |
|||
} |
|||
|
|||
function arrayToXml ($xw, $name, $arr) |
|||
{ |
|||
$xw->startElement ('array'); |
|||
|
|||
if ($name !== NULL) |
|||
$xw->writeAttribute ('name', $name); |
|||
|
|||
foreach ($arr as $key => $val) |
|||
{ |
|||
$xw->startElement ('item'); |
|||
$xw->writeAttribute ('key', $key); |
|||
|
|||
if (is_array ($val)) |
|||
{ |
|||
arrayToXml ($xw, NULL, $val); |
|||
} |
|||
else if (is_object ($val)) |
|||
{ |
|||
if (in_array ('toXml', get_class_methods ($val)) == TRUE) |
|||
{ |
|||
$val->toXml ($xw); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
varToXml ($xw, NULL, $val); |
|||
} |
|||
|
|||
$xw->endElement (); |
|||
} |
|||
|
|||
$xw->endElement (); |
|||
} |
|||
|
|||
function xmlify ($val) |
|||
{ |
|||
$xw = new xmlWriter (); |
|||
$xw->openMemory (); |
|||
$xw->setIndent (TRUE); |
|||
$xw->startDocument ('1.0', 'UTF-8'); |
|||
|
|||
if (is_array ($val)) |
|||
{ |
|||
arrayToXml ($xw, NULL, $val); |
|||
} |
|||
else if (is_object ($val)) |
|||
{ |
|||
if (in_array ('toXml', get_class_methods ($val)) == TRUE) |
|||
{ |
|||
$val->toXml ($xw); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
varToXml ($xw, NULL, $val); |
|||
} |
|||
|
|||
$res = $xw->outputMemory(TRUE); |
|||
unset ($xw); |
|||
|
|||
return $res; |
|||
} |
|||
|
|||
function deXmlify ($xmldata) |
|||
{ |
|||
$ret = NULL; |
|||
|
|||
// print "<pre>";
|
|||
// var_dump (str_replace (
|
|||
// array ("<", ">"), array ("<", ">") , $xmldata));
|
|||
// print "</pre>";
|
|||
// exit (1);
|
|||
|
|||
$xr = new XMLReader (); |
|||
$xr->XML ($xmldata); |
|||
|
|||
$xr->read (); |
|||
|
|||
switch ($xr->name) |
|||
{ |
|||
case 'variable': $ret = xmlToVar ($xr); break; |
|||
case 'array': $ret = xmlToArray ($xr); break; |
|||
case 'class': |
|||
$class = $xr->getAttribute ('class'); |
|||
$ret = new $class ($xr); |
|||
} |
|||
|
|||
$xr->close (); |
|||
|
|||
return $ret; |
|||
} |
|||
|
|||
class c_xmlify |
|||
{ |
|||
function __construct ($xr) |
|||
{ |
|||
if ($xr->isEmptyElement == TRUE) |
|||
return; |
|||
|
|||
while ($xr->read () && |
|||
! ($xr->nodeType == 15 && |
|||
$xr->name == 'class')) |
|||
{ |
|||
if ($xr->nodeType == 1) |
|||
{ |
|||
$name = $xr->getAttribute ('name'); |
|||
|
|||
switch ($xr->name) |
|||
{ |
|||
case 'variable': |
|||
$this->$name = xmlToVar ($xr); |
|||
$type = $xr->getAttribute ('type'); |
|||
settype ($this->$name, $type); |
|||
break; |
|||
|
|||
case 'array': |
|||
$this->$name = xmlToArray ($xr); |
|||
break; |
|||
|
|||
case 'class': |
|||
$class = $xr->getAttribute ('class'); |
|||
$this->$name = new $class ($xr); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
function toXml ($xw, $name = NULL) |
|||
{ |
|||
$xw->startElement ('class'); |
|||
|
|||
if ($name !== NULL) |
|||
$xw->writeAttribute ('name', $name); |
|||
|
|||
$xw->writeAttribute ('class', get_class ($this)); |
|||
|
|||
foreach (get_object_vars ($this) as $var => $val) |
|||
{ |
|||
if (is_array ($val)) |
|||
{ |
|||
arrayToXml ($xw, $var, $val); |
|||
continue; |
|||
} |
|||
|
|||
if (is_object ($val)) |
|||
{ |
|||
if (in_array ('toXml', get_class_methods ($val)) == TRUE) |
|||
{ |
|||
$val->toXml ($xw, $var); |
|||
} |
|||
continue; |
|||
} |
|||
|
|||
varToXml ($xw, $var, $val); |
|||
} |
|||
|
|||
$xw->endElement(); |
|||
} |
|||
}; |
|||
|
|||
?>
|
|||
@ -0,0 +1,67 @@ |
|||
<?php |
|||
|
|||
static $oldErrHandler = NULL; |
|||
|
|||
class errException extends Exception |
|||
{ |
|||
protected $errContext; |
|||
|
|||
function __construct ($msg, $no, $file, $line, $context) |
|||
{ |
|||
parent::__construct ($msg, $no); |
|||
|
|||
$this->file = $file; |
|||
$this->line = $line; |
|||
$this->errContext = $context; |
|||
} |
|||
|
|||
function __toString () |
|||
{ |
|||
$retStr = "Laufzeitfehler (" . $this->code . "): \n"; |
|||
$retStr .= $this->message . "\n\n"; |
|||
$retStr .= 'Datei: ' . $this->file . "\n"; |
|||
$retStr .= 'Zeile: ' . $this->line . "\n"; |
|||
|
|||
if ($this->errContext != NULL) |
|||
{ |
|||
$retStr .= "Fehler Context: \n"; |
|||
$retStr .= print_r ($this->errContext, TRUE) . "\n"; |
|||
} |
|||
|
|||
$retStr .= "Aufruf Stack: \n"; |
|||
$retStr .= $this->getTraceAsString () . "\n"; |
|||
|
|||
return $retStr; |
|||
} |
|||
|
|||
function getErrContext () |
|||
{ |
|||
return $this->errContext; |
|||
} |
|||
} |
|||
|
|||
function mapErrToExc ($no, $msg, $file, $line, $con) |
|||
{ |
|||
throw new errException ($msg, $no, $file, $line, $con); |
|||
} |
|||
|
|||
function setErrExceptionMapping () |
|||
{ |
|||
global $oldErrHandler; |
|||
|
|||
if ($oldErrHandler == NULL) |
|||
$oldErrHandler = set_error_handler ('mapErrToExc'); |
|||
} |
|||
|
|||
function resetErrExceptionMapping () |
|||
{ |
|||
global $oldErrHandler; |
|||
|
|||
if ($oldErrHandler != NULL) |
|||
{ |
|||
set_error_handler ($oldErrHandler); |
|||
$oldErrHandler = NULL; |
|||
} |
|||
} |
|||
|
|||
?>
|
|||
@ -0,0 +1,55 @@ |
|||
<?php |
|||
|
|||
require_once dirname (__FILE__) . "/../config.php"; |
|||
require_once LIBDIR . "errException.php"; |
|||
|
|||
setErrExceptionMapping (); |
|||
|
|||
// --- Data ----------------------------------
|
|||
if (isset ($_REQUEST['img'])) |
|||
$img = $_REQUEST['img']; |
|||
else |
|||
$img = -1; |
|||
|
|||
if (isset ($_REQUEST['col'])) |
|||
$col = $_REQUEST['col']; |
|||
else |
|||
$col = 'aaaaaa'; |
|||
// -------------------------------------------
|
|||
|
|||
// Load Image and get it's size
|
|||
if ($img !== -1) |
|||
{ |
|||
$size = getimagesize(IMGDIR . $img); |
|||
$width = $size[0]; |
|||
$height = $size[1]; |
|||
unset ($size); |
|||
$loadIm = imagecreatefrompng (IMGDIR . $img); |
|||
} |
|||
else |
|||
{ |
|||
$width = 1; |
|||
$height = 1; |
|||
$loadIm = imagecreatetruecolor ($width, $height); |
|||
$color = imagecolorallocatealpha ($loadIm, 0, 0, 0, 127); |
|||
imagefill ($loadIm, 0, 0, $color); |
|||
unset ($color); |
|||
} |
|||
imagealphablending ($loadIm, TRUE); |
|||
|
|||
$bgImg = imagecreatetruecolor ($width, $height); |
|||
preg_match_all ('/[A-Za-z0-9]{2,2}/', $col, $rgb); |
|||
$color = imagecolorallocate ( |
|||
$bgImg, hexdec ($rgb[0][0]), hexdec ($rgb[0][1]), hexdec ($rgb[0][2])); |
|||
imagefill ($bgImg, 0, 0, $color); |
|||
unset ($color); |
|||
|
|||
imagecopy ($bgImg, $loadIm, 0, 0, 0, 0, $width, $height); |
|||
imagedestroy($loadIm); |
|||
|
|||
resetErrExceptionMapping (); |
|||
|
|||
header ("Content-Type: image/png"); |
|||
imagepng ($bgImg); |
|||
|
|||
?>
|
|||
@ -0,0 +1,62 @@ |
|||
<?php |
|||
|
|||
exec ('locale -a | sort -u', $locales); |
|||
$locale = 'C'; |
|||
|
|||
/* |
|||
* First find the browser encoding and try to create a valid locale |
|||
* from one of the supported browser encodings. Start with the most |
|||
* preferred encoding. |
|||
*/ |
|||
$langs = explode (",", $_SERVER[HTTP_ACCEPT_LANGUAGE]); |
|||
|
|||
foreach ($langs as $lang) |
|||
{ |
|||
preg_match("/^([a-z]{2})(-([a-zA-Z]{2})){0,1}(;q=([0-9].[0-9])){0,1}$/", |
|||
$lang, $lng_pref); |
|||
|
|||
$la = $lng_pref[1]; |
|||
if (isset ($lng_pref[3]) && $lng_pref[3] !== "") |
|||
$co = '_' . strtoupper ($lng_pref[3]); |
|||
else |
|||
$co = ''; |
|||
if (isset ($lng_pref[5]) && $lng_pref[5] !== "") |
|||
$pr = $lng_pref[5]; |
|||
else |
|||
$pr = 1.0; |
|||
|
|||
if ($co != "US") |
|||
$la_specs[$la . $co] = $pr; |
|||
else |
|||
$la_specs["POSIX"]=$pr; |
|||
} |
|||
array_multisort ($la_specs, SORT_DESC, SORT_NUMERIC); |
|||
|
|||
/* |
|||
* Set locale and initialize gettext catalogs |
|||
*/ |
|||
foreach ($la_specs as $key => $value) |
|||
{ |
|||
foreach ($locales as $l) |
|||
{ |
|||
if (isset ($key) && "" !== $key && strpos ($l, $key) !== FALSE) |
|||
{ |
|||
$locale = $l; |
|||
break; |
|||
} |
|||
} |
|||
if ('C' !== $locale) break; |
|||
} |
|||
|
|||
$l = setlocale (LC_MESSAGES, $locale); |
|||
if ($l !== $locale) |
|||
{ |
|||
$locale = 'C'; |
|||
setlocale (LC_MESSAGES, $locale); |
|||
} |
|||
setlocale (LC_TIME, $locale); |
|||
bindtextdomain ("bilder", LOCALEDIR); |
|||
bind_textdomain_codeset ("bilder", "UTF-8"); |
|||
textdomain ("bilder"); |
|||
|
|||
?>
|
|||
@ -0,0 +1,88 @@ |
|||
# German translations for PACKAGE package |
|||
# German messages for PACKAGE. |
|||
# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER |
|||
# This file is distributed under the same license as the PACKAGE package. |
|||
# <georg@steffers.org>, 2007. |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: PACKAGE VERSION\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2007-10-08 03:09+0200\n" |
|||
"PO-Revision-Date: 2007-10-07 15:45+0200\n" |
|||
"Last-Translator: <georg@steffers.org>\n" |
|||
"Language-Team: German\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
|||
|
|||
#: templates/personAdmin/personSearch1.tpl.php:37 |
|||
msgid "search" |
|||
msgstr "Suche" |
|||
|
|||
#: templates/personAdmin/personSearch1.tpl.php:45 |
|||
#: templates/personAdmin/personInUp.tpl.php:86 |
|||
msgid "surname" |
|||
msgstr "Vorname" |
|||
|
|||
#: templates/personAdmin/personSearch1.tpl.php:56 |
|||
#: templates/personAdmin/personInUp.tpl.php:80 |
|||
msgid "firstname" |
|||
msgstr "Nachname" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:47 |
|||
msgid "update" |
|||
msgstr "aktualisieren" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:54 |
|||
msgid "insert" |
|||
msgstr "einfügen" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:57 |
|||
msgid "submit" |
|||
msgstr "abschicken" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:63 |
|||
msgid "personal data" |
|||
msgstr "Perönliche Daten" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:92 |
|||
msgid "company" |
|||
msgstr "Firma" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:98 |
|||
msgid "email" |
|||
msgstr "eMail" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:104 |
|||
msgid "url" |
|||
msgstr "Homepage" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:117 |
|||
msgid "photographer" |
|||
msgstr "Fotograf" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:124 |
|||
msgid "cameraId" |
|||
msgstr "Kamera ID" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:137 |
|||
msgid "owner" |
|||
msgstr "Besitzer" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:144 |
|||
msgid "watermark width" |
|||
msgstr "Wasserzeichen Breite" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:150 |
|||
msgid "watermark height" |
|||
msgstr "Wasserzeichen Höhe" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:156 |
|||
msgid "watermark xPos" |
|||
msgstr "Wasserzeichen X" |
|||
|
|||
#: templates/personAdmin/personInUp.tpl.php:162 |
|||
msgid "watermark yPos" |
|||
msgstr "Wasserzeichen Y" |
|||
1053
sql/create.sql
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,43 @@ |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html> |
|||
<head> |
|||
<title>Nur zum testen</title> |
|||
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
|||
|
|||
<link rel="stylesheet" type="text/css" |
|||
href="<?=CSSURL?>background-colors.css" /> |
|||
<link rel="stylesheet" type="text/css" href="<?=CSSURL?>fonts.css" /> |
|||
<link rel="stylesheet" type="text/css" href="<?=CSSURL?>displays.css" /> |
|||
|
|||
<script src="<?=JSURL?>levenshtein.js" type="text/javascript"></script> |
|||
<script src="<?=JSURL?>fittingStrings.js" type="text/javascript"></script> |
|||
<script src="<?=JSURL?>transPngBg.js" type="text/javascript"></script> |
|||
<script src="<?=JSURL?>personAdmin/personSearch1.js" |
|||
type="text/javascript"></script> |
|||
<script src="<?=JSURL?>personAdmin/personInUp.js" |
|||
type="text/javascript"></script> |
|||
<script src="<?=JSURL?>personAdmin/person.js" |
|||
type="text/javascript"></script> |
|||
|
|||
<script language="javascript"> |
|||
//<![CDATA[
|
|||
arrDown = new transPngBg ('circDblArrDownBlk.png', '<?=LIBURL?>'); |
|||
arrRight = new transPngBg ('circDblArrRightBlk.png', '<?=LIBURL?>'); |
|||
|
|||
newPerson = new c_person ( |
|||
-1, -1, -1, '', '', '', '', '', -1, '', '', '', ''); |
|||
person = new c_person ( |
|||
-1, -1, -1, '', '', '', '', '', -1, '', '', '', ''); |
|||
//]]>
|
|||
</script> |
|||
</head> |
|||
|
|||
<body> |
|||
<div style="width: 350px"> |
|||
<?=$this->personSearch1?>
|
|||
<div style="height: 5px; line-height: 5px"> </div> |
|||
<?=$this->personInUp?>
|
|||
</div> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,173 @@ |
|||
<script language="javascript"> |
|||
//<![CDATA[
|
|||
pInUp = new personInUp ( |
|||
'update', 'insert', 'submit', person, newPerson, arrRight, arrDown); |
|||
|
|||
function showHideBlock (titleId) |
|||
{ |
|||
var titleElement = document.getElementById (titleId); |
|||
var imgElement = titleElement.getElementsByTagName ('img')[0]; |
|||
var blockElement = titleElement.parentNode; |
|||
var dataElement = blockElement.getElementsByTagName ('div')[1]; |
|||
|
|||
if (dataElement.style.display == 'none') |
|||
{ |
|||
dataElement.style.display = 'block'; |
|||
imgElement.src = arrDown.getImgUrl (titleElement); |
|||
} |
|||
else |
|||
{ |
|||
dataElement.style.display = 'none'; |
|||
imgElement.src = arrRight.getImgUrl (titleElement); |
|||
} |
|||
} |
|||
|
|||
function personInUpInit () |
|||
{ |
|||
var tCam = document.getElementById ('_title_camera'); |
|||
var tCamImg = tCam.getElementsByTagName ('img')[0]; |
|||
var tWat = document.getElementById ('_title_watermark'); |
|||
var tWatImg = tWat.getElementsByTagName ('img')[0]; |
|||
|
|||
tCamImg.src = arrRight.getImgUrl (tCam); |
|||
tWatImg.src = arrRight.getImgUrl (tWat); |
|||
} |
|||
//]]>
|
|||
</script> |
|||
|
|||
<div class="bgc-bg1 d-bg1 f-bg1"> |
|||
<form id="pForm" onSubmit="return false"> |
|||
<div> |
|||
<table width="100%"><tr> |
|||
<td style="vertical-align: middle"> |
|||
<input type="checkbox" id="update" name="action" |
|||
value="update" disabled="true" |
|||
onClick="pInUp.updateForm ()" /> |
|||
</td> |
|||
<td style="vertical-align: middle"><?=_('update')?></td>
|
|||
<td style="vertical-align: middle"> </td> |
|||
<td style="vertical-align: middle"> |
|||
<input type="checkbox" id="insert" name="action" |
|||
value="insert" |
|||
onClick="pInUp.updateForm ()" /> |
|||
</td> |
|||
<td style="vertical-align: middle"><?=_('insert')?></td>
|
|||
<td align="right" width="100%"> |
|||
<input type="button" id="submit" |
|||
value="<?=_('submit')?>" disabled="true" /> |
|||
</td> |
|||
</tr></table> |
|||
</div> |
|||
<div class="bgc-grp1 d-grp1" style="margin-top: 2px"> |
|||
<div class="bgc-head1 f-head1 d-head1"> |
|||
<?=_('personal data')?>
|
|||
</div> |
|||
<div class="bgc-box1 f-box1 d-box1"> |
|||
<div> |
|||
<input type="hidden" id="personId" value="-1" disabled="true" /> |
|||
</div> |
|||
<div> |
|||
<input type="hidden" id="photographerId" value="-1" |
|||
disabled="true" /> |
|||
</div> |
|||
<div> |
|||
<input type="hidden" id="ownerId" value="-1" disabled="true" /> |
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="firstname" value="" disabled="true" |
|||
onChange="pInUp.setFirstname (this.value)" /> |
|||
<?=_('firstname')?>
|
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="surname" value="" disabled="true" |
|||
onChange="pInUp.setSurname (this.value)" /> |
|||
<?=_('surname')?>
|
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="company" value="" disabled="true" |
|||
onChange="pInUp.setCompany (this.value)" /> |
|||
<?=_('company')?>
|
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="email" value="" disabled="true" |
|||
onChange="pInUp.setEmail (this.value)" /> |
|||
<?=_('email')?>
|
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="url" value="" disabled="true" |
|||
onChange="pInUp.setUrl (this.value)" /> |
|||
<?=_('url')?>
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="bgc-grp1 d-grp1" style="margin-top: 2px"> |
|||
<div class="bgc-head1 f-head1 d-head1" id="_title_camera"> |
|||
<img style="
|
|||
position: relative; |
|||
float: right; |
|||
margin-right: 3px; |
|||
cursor: pointer"
|
|||
onClick="showHideBlock ('_title_camera')" /> |
|||
<?=_('photographer')?>
|
|||
</div> |
|||
<div class="bgc-box1 f-box1 d-box1" style="display: none"> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="cameraId" value="-1" disabled="true" |
|||
onChange="pInUp.setCameraId (this.value)" /> |
|||
<?=_('cameraId')?>
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="bgc-grp1 d-grp1" style="margin-top: 2px"> |
|||
<div class="bgc-head1 f-head1 d-head1" id="_title_watermark"> |
|||
<img style="
|
|||
position: relative; |
|||
float: right; |
|||
margin-right: 3px; |
|||
cursor: pointer"
|
|||
onClick="showHideBlock ('_title_watermark')" /> |
|||
<?=_('owner')?>
|
|||
</div> |
|||
<div class="bgc-box1 f-box1 d-box1" style="display: none"> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="wmWidth" value="" disabled="true" |
|||
onChange="pInUp.setWmWidth (this.value)" /> |
|||
<?=_('watermark width')?>
|
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="wmHeight" value="" disabled="true" |
|||
onChange="pInUp.setWmHeight (this.value)" /> |
|||
<?=_('watermark height')?>
|
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="wmXPos" value="" disabled="true" |
|||
onChange="pInUp.setWmXPos (this.value)" /> |
|||
<?=_('watermark xPos')?>
|
|||
</div> |
|||
<div> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="wmYPos" value="" disabled="true" |
|||
onChange="pInUp.setWmYPos (this.value)" /> |
|||
<?=_('watermark yPos')?>
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
<script language="javascript"> |
|||
//<![CDATA[
|
|||
personInUpInit (); |
|||
//]]>
|
|||
</script> |
|||
@ -0,0 +1,65 @@ |
|||
<script language="javascript"> |
|||
//<![CDATA[
|
|||
var names = new Array (); |
|||
|
|||
<? foreach ($this->names as $surname => $data): ?>
|
|||
names['<?=$surname?>'] = new Array (); |
|||
<? foreach ($data as $d): ?>
|
|||
names['<?=$surname?>'].push ( |
|||
new Array ('<?=$d[0]?>', |
|||
new c_person ( |
|||
<?=$d[1]->get_personId ()?>,
|
|||
<?=(($val=$d[1]->get_photographerId ()) !== NULL)?$val:-1?>,
|
|||
<?=(($val=$d[1]->get_ownerId ()) !== NULL)?$val:-1?>,
|
|||
'<?=$d[1]->get_firstname ()?>', |
|||
'<?=$d[1]->get_surname ()?>', |
|||
'<?=$d[1]->get_company ()?>', |
|||
'<?=$d[1]->get_email ()?>', |
|||
'<?=$d[1]->get_url ()?>', |
|||
<?=(($val=$d[1]->get_cameraId ()) !== NULL)?$val:-1?>,
|
|||
'<?=(($val=$d[1]->get_wmWidth ()) !== NULL)?$val:''?>', |
|||
'<?=(($val=$d[1]->get_wmHeight ()) !== NULL)?$val:''?>', |
|||
'<?=(($val=$d[1]->get_wmXPos ()) !== NULL)?$val:''?>', |
|||
'<?=(($val=$d[1]->get_wmYPos ()) !== NULL)?$val:''?>'))); |
|||
<? endforeach ?>
|
|||
<? endforeach ?>
|
|||
|
|||
pSearch1 = new c_personSearch1 ( |
|||
'personSearch1_fname', 'personSearch1_sname', |
|||
'personSearch1_fBestFit', 'personSearch1_sBestFit', names, person); |
|||
//]]>
|
|||
</script> |
|||
|
|||
<div class="bgc-bg1 d-bg1"> |
|||
<div class="bgc-grp1 d-grp1"> |
|||
<form id="personForm" onSubmit="return false"> |
|||
<div class="bgc-head1 f-head1 d-head1"> |
|||
<?=_('search')?>
|
|||
</div> |
|||
<div class="bgc-box1 f-box1 d-box1"> |
|||
<div style="position: relative; z-index: 1"> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="personSearch1_sname" value="" |
|||
onKeyUp="return pSearch1.altSurnames ()" |
|||
onBlur="return pSearch1.hide ('personSearch1_sBestFit')" /> |
|||
<?=_('surname')?>
|
|||
<div class="bgc-tt1 d-tt1" |
|||
style="position: absolute; top: 20px; left: 0px"> |
|||
<ul id="personSearch1_sBestFit" class="d-tt1" /> |
|||
</div> |
|||
</div> |
|||
<div style="position: relative; z-index: 0"> |
|||
<input type="text" style="width: 200px" maxlength="255" |
|||
id="personSearch1_fname" value="" |
|||
onKeyUp="return pSearch1.altFirstnames ()" |
|||
onBlur="return pSearch1.hide ('personSearch1_fBestFit')" /> |
|||
<?=_('firstname')?>
|
|||
<div class="bgc-tt1 d-tt1" |
|||
style="position: absolute; top: 20px; left: 0px"> |
|||
<ul id="personSearch1_fBestFit" class="d-tt1" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue