Commit a59033430fa5503088080aaf69db6ea199507f0b
1 parent
b71bd5c3
Erster import der aktuellen Arbitskopie des neuen Bildertools
Showing
32 changed files
with
3743 additions
and
0 deletions
bilder.pot
0 → 100644
| 1 | +# SOME DESCRIPTIVE TITLE. | ||
| 2 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | ||
| 3 | +# This file is distributed under the same license as the PACKAGE package. | ||
| 4 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
| 5 | +# | ||
| 6 | +#, fuzzy | ||
| 7 | +msgid "" | ||
| 8 | +msgstr "" | ||
| 9 | +"Project-Id-Version: PACKAGE VERSION\n" | ||
| 10 | +"Report-Msgid-Bugs-To: \n" | ||
| 11 | +"POT-Creation-Date: 2007-10-08 03:09+0200\n" | ||
| 12 | +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
| 13 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| 14 | +"Language-Team: LANGUAGE <LL@li.org>\n" | ||
| 15 | +"MIME-Version: 1.0\n" | ||
| 16 | +"Content-Type: text/plain; charset=CHARSET\n" | ||
| 17 | +"Content-Transfer-Encoding: 8bit\n" | ||
| 18 | + | ||
| 19 | +#: templates/personAdmin/personSearch1.tpl.php:37 | ||
| 20 | +msgid "search" | ||
| 21 | +msgstr "" | ||
| 22 | + | ||
| 23 | +#: templates/personAdmin/personSearch1.tpl.php:45 | ||
| 24 | +#: templates/personAdmin/personInUp.tpl.php:86 | ||
| 25 | +msgid "surname" | ||
| 26 | +msgstr "" | ||
| 27 | + | ||
| 28 | +#: templates/personAdmin/personSearch1.tpl.php:56 | ||
| 29 | +#: templates/personAdmin/personInUp.tpl.php:80 | ||
| 30 | +msgid "firstname" | ||
| 31 | +msgstr "" | ||
| 32 | + | ||
| 33 | +#: templates/personAdmin/personInUp.tpl.php:47 | ||
| 34 | +msgid "update" | ||
| 35 | +msgstr "" | ||
| 36 | + | ||
| 37 | +#: templates/personAdmin/personInUp.tpl.php:54 | ||
| 38 | +msgid "insert" | ||
| 39 | +msgstr "" | ||
| 40 | + | ||
| 41 | +#: templates/personAdmin/personInUp.tpl.php:57 | ||
| 42 | +msgid "submit" | ||
| 43 | +msgstr "" | ||
| 44 | + | ||
| 45 | +#: templates/personAdmin/personInUp.tpl.php:63 | ||
| 46 | +msgid "personal data" | ||
| 47 | +msgstr "" | ||
| 48 | + | ||
| 49 | +#: templates/personAdmin/personInUp.tpl.php:92 | ||
| 50 | +msgid "company" | ||
| 51 | +msgstr "" | ||
| 52 | + | ||
| 53 | +#: templates/personAdmin/personInUp.tpl.php:98 | ||
| 54 | +msgid "email" | ||
| 55 | +msgstr "" | ||
| 56 | + | ||
| 57 | +#: templates/personAdmin/personInUp.tpl.php:104 | ||
| 58 | +msgid "url" | ||
| 59 | +msgstr "" | ||
| 60 | + | ||
| 61 | +#: templates/personAdmin/personInUp.tpl.php:117 | ||
| 62 | +msgid "photographer" | ||
| 63 | +msgstr "" | ||
| 64 | + | ||
| 65 | +#: templates/personAdmin/personInUp.tpl.php:124 | ||
| 66 | +msgid "cameraId" | ||
| 67 | +msgstr "" | ||
| 68 | + | ||
| 69 | +#: templates/personAdmin/personInUp.tpl.php:137 | ||
| 70 | +msgid "owner" | ||
| 71 | +msgstr "" | ||
| 72 | + | ||
| 73 | +#: templates/personAdmin/personInUp.tpl.php:144 | ||
| 74 | +msgid "watermark width" | ||
| 75 | +msgstr "" | ||
| 76 | + | ||
| 77 | +#: templates/personAdmin/personInUp.tpl.php:150 | ||
| 78 | +msgid "watermark height" | ||
| 79 | +msgstr "" | ||
| 80 | + | ||
| 81 | +#: templates/personAdmin/personInUp.tpl.php:156 | ||
| 82 | +msgid "watermark xPos" | ||
| 83 | +msgstr "" | ||
| 84 | + | ||
| 85 | +#: templates/personAdmin/personInUp.tpl.php:162 | ||
| 86 | +msgid "watermark yPos" | ||
| 87 | +msgstr "" |
components/personAdmin.php
0 → 100644
config.php
0 → 100644
| 1 | +<? | ||
| 2 | +/* Pfadkonstanten */ | ||
| 3 | +define ('HOME', dirname (__FILE__) . '/'); | ||
| 4 | +define ('DATADIR', HOME . 'data/'); | ||
| 5 | +define ('IMGDIR', HOME . 'img/'); | ||
| 6 | +define ('LIBDIR', HOME . 'libs/'); | ||
| 7 | +define ('TPLDIR', HOME . 'templates/'); | ||
| 8 | +define ('JSDIR', HOME . 'js/'); | ||
| 9 | +define ('CSSDIR', HOME . 'css/'); | ||
| 10 | +define ('FONTDIR', HOME . 'fonts/'); | ||
| 11 | +define ('CACHEDIR', HOME . 'cache/'); | ||
| 12 | +define ('LOCALEDIR', HOME . 'locale/'); | ||
| 13 | + | ||
| 14 | +/* diese Pfade als URLS */ | ||
| 15 | +// Evolver | ||
| 16 | +define ('BASEURL', "http://localhost/~georg/bilder/"); | ||
| 17 | + | ||
| 18 | +define ('IMGURL', BASEURL . 'img/'); | ||
| 19 | +define ('LIBURL', BASEURL . 'libs/'); | ||
| 20 | +define ('TPLURL', BASEURL . 'templates/'); | ||
| 21 | +define ('DATAURL', BASEURL . 'data/'); | ||
| 22 | +define ('CSSURL', BASEURL . 'css/'); | ||
| 23 | +define ('JSURL', BASEURL . 'js/'); | ||
| 24 | +define ('CSSDIR', BASEURL . 'css/'); | ||
| 25 | +define ('FONTURL', BASEURL . 'fonts/'); | ||
| 26 | +define ('CACHEURL', BASEURL . 'cache/'); | ||
| 27 | + | ||
| 28 | +define ('BASESURL', "https://localhost/~georg/bilder/"); | ||
| 29 | +define ('IMGSURL', BASESURL . 'img/'); | ||
| 30 | + | ||
| 31 | +/* Basisklassen & Funktionen */ | ||
| 32 | +define ('SAVANT_SMALL', LIBDIR . 'c_SavantSmall.php'); | ||
| 33 | +define ('PICTOOL_SAVANT', LIBDIR . 'c_picToolSavant.php'); | ||
| 34 | +define ('UTILS', LIBDIR . 'utils.php'); | ||
| 35 | +?> |
css/background-colors.css
0 → 100644
| 1 | +/* ======================================================================= | ||
| 2 | + * Styles for components | ||
| 3 | + * ======================================================================= */ | ||
| 4 | +.bgc-bg1 { background-color: #888888 } | ||
| 5 | +/* ======================================================================= */ | ||
| 6 | + | ||
| 7 | +/* ======================================================================= | ||
| 8 | + * Styles for logical groups. A group is defined by a bounding box "grp*" | ||
| 9 | + * containing one or more header lines "head*" and content-boxes "box*" | ||
| 10 | + * ======================================================================= */ | ||
| 11 | +.bgc-grp1 { background-color: #aaaaaa } | ||
| 12 | +.bgc-box1 { background-color: #ffb400 } | ||
| 13 | +.bgc-head1 { background-color: #e5a200 } | ||
| 14 | +/* ======================================================================= */ | ||
| 15 | + | ||
| 16 | +/* ======================================================================= | ||
| 17 | + * Styles for tooltips | ||
| 18 | + * ======================================================================= */ | ||
| 19 | +.bgc-tt1 { background-color: #eeeeee } | ||
| 20 | +/* ======================================================================= */ |
css/displays.css
0 → 100644
| 1 | +/* ======================================================================= | ||
| 2 | + * Styles for components | ||
| 3 | + * ======================================================================= */ | ||
| 4 | +.d-bg1 { | ||
| 5 | + padding: 2px | ||
| 6 | +} | ||
| 7 | +/* ======================================================================= */ | ||
| 8 | + | ||
| 9 | +/* ======================================================================= | ||
| 10 | + * Styles for logical groups. A group is defined by a bounding box "grp*" | ||
| 11 | + * containing one or more header lines "head*" and content-boxes "box*" | ||
| 12 | + * ======================================================================= */ | ||
| 13 | +.d-grp1 { | ||
| 14 | + padding: 2px; | ||
| 15 | + padding-top: 1px; | ||
| 16 | + padding-bottom: 1px | ||
| 17 | +} | ||
| 18 | +.d-box1 { | ||
| 19 | + padding: 3px; | ||
| 20 | + margin-top: 1px; | ||
| 21 | + margin-bottom: 1px | ||
| 22 | +} | ||
| 23 | +.d-head1 { | ||
| 24 | + padding: 3px; | ||
| 25 | + margin-top: 1px; | ||
| 26 | + margin-bottom: 1px | ||
| 27 | +} | ||
| 28 | +/* ======================================================================= */ | ||
| 29 | + | ||
| 30 | +/* ======================================================================= | ||
| 31 | + * Styles for tooltips | ||
| 32 | + * ======================================================================= */ | ||
| 33 | +div.d-tt1 { | ||
| 34 | + border: 1px solid black; | ||
| 35 | + padding: 2px; | ||
| 36 | + visibility: hidden; | ||
| 37 | + z-index: 100 | ||
| 38 | +} | ||
| 39 | +ul.d-tt1 { | ||
| 40 | + list-style-type: none; | ||
| 41 | + margin: 0px; | ||
| 42 | + padding: 0px | ||
| 43 | +} | ||
| 44 | +/* ======================================================================= */ | ||
| 45 | + | ||
| 46 | +/* ======================================================================= | ||
| 47 | + * common changes to tag defaults | ||
| 48 | + * ======================================================================= */ | ||
| 49 | +form { | ||
| 50 | + padding: 0px; | ||
| 51 | + margin: 0px; | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +td { | ||
| 55 | + padding: 0px; | ||
| 56 | + margin: 0px; | ||
| 57 | +} | ||
| 58 | +/* ======================================================================= */ |
css/fonts.css
0 → 100644
| 1 | +/* ======================================================================= | ||
| 2 | + * Styles for components | ||
| 3 | + * ======================================================================= */ | ||
| 4 | +.f-bg1 { | ||
| 5 | + font-family: verdana, sans-serif; | ||
| 6 | + font-size: 8pt; | ||
| 7 | + font-weight: normal; | ||
| 8 | + color: #000000 | ||
| 9 | +} | ||
| 10 | +/* ======================================================================= */ | ||
| 11 | + | ||
| 12 | +/* ======================================================================= | ||
| 13 | + * Styles for logical groups. A group is defined by a bounding box "grp*" | ||
| 14 | + * containing one or more header lines "head*" and content-boxes "box*" | ||
| 15 | + * ======================================================================= */ | ||
| 16 | +.f-box1 { | ||
| 17 | + font-family: verdana, sans-serif; | ||
| 18 | + font-size: 8pt; | ||
| 19 | + font-weight: normal; | ||
| 20 | + color: #000000 | ||
| 21 | +} | ||
| 22 | +.f-head1 { | ||
| 23 | + font-family: verdana, sans-serif; | ||
| 24 | + font-size: 10pt; | ||
| 25 | + font-weight: bold; | ||
| 26 | + color: #000000 | ||
| 27 | +} | ||
| 28 | +/* ======================================================================= */ | ||
| 29 | + | ||
| 30 | +/* ======================================================================= | ||
| 31 | + * Styles for tooltips | ||
| 32 | + * ======================================================================= */ | ||
| 33 | +/* ======================================================================= */ |
img/circDblArrDownBlk.png
0 → 100644
339 Bytes
img/circDblArrLeftBlk.png
0 → 100644
331 Bytes
img/circDblArrRightBlk.png
0 → 100644
329 Bytes
img/circDblArrUpBlk.png
0 → 100644
343 Bytes
img/patterns1.xcf
0 → 100644
No preview for this file type
js/fittingStrings.js
0 → 100644
| 1 | +/* | ||
| 2 | + * requires levenshtein.js to be loaded first | ||
| 3 | + */ | ||
| 4 | + | ||
| 5 | +function distsort (_a, _b) | ||
| 6 | +{ | ||
| 7 | + var a = _a.substring (0, _a.indexOf('::')); | ||
| 8 | + var b = _b.substring (0, _b.indexOf('::')); | ||
| 9 | + | ||
| 10 | + return a - b; | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +function fittingStrings (search, strings, cs) | ||
| 14 | +{ | ||
| 15 | + var dists = new Array (); | ||
| 16 | + | ||
| 17 | + if (search.length <= 0) | ||
| 18 | + return dists; | ||
| 19 | + | ||
| 20 | + if (cs == false) | ||
| 21 | + _search = search.toUpperCase (); | ||
| 22 | + else | ||
| 23 | + _search = search; | ||
| 24 | + | ||
| 25 | + /* | ||
| 26 | + * hier suche ich die zur Eingabe am besten passenden Eintraege | ||
| 27 | + * in der Datenbank. Neben der eigentlichen distance ermittle ich noch | ||
| 28 | + * einen Wert distance - Ueberhang(Datenbankstring zu Suchstring) | ||
| 29 | + * Zweiter eignet sich besser zum Vergleich der Ergebnisse untereinander. | ||
| 30 | + */ | ||
| 31 | + for (str in strings) | ||
| 32 | + { | ||
| 33 | + if (cs == false) | ||
| 34 | + _str = strings[str].toUpperCase (); | ||
| 35 | + else | ||
| 36 | + _str = strings[str]; | ||
| 37 | + | ||
| 38 | + var dist = levenshtein (_search, _str); | ||
| 39 | + var delta = _str.length - _search.length; | ||
| 40 | + var subDist = (delta > 0)? dist - delta: dist; | ||
| 41 | + | ||
| 42 | + dists.push (subDist + '::' + dist + '::' + strings[str]); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + dists.sort(distsort); | ||
| 46 | + | ||
| 47 | + return dists; | ||
| 48 | +} |
js/levenshtein.js
0 → 100644
| 1 | +/* | ||
| 2 | + Copyright (c) 2006. All Rights reserved. | ||
| 3 | + | ||
| 4 | + If you use this script, please email me and let me know, thanks! | ||
| 5 | + Andrew Hedges | ||
| 6 | + andrew (at) hedges (dot) name | ||
| 7 | + If you want to hire me to write JavaScript for you, see my resume. | ||
| 8 | + | ||
| 9 | + http://andrew.hedges.name/resume/ | ||
| 10 | +*/ | ||
| 11 | + | ||
| 12 | +// return the smallest of the three values passed in | ||
| 13 | +function minimum (x, y, z) | ||
| 14 | +{ | ||
| 15 | + if (x < y && x < z) return x; | ||
| 16 | + if (y < x && y < z) return y; | ||
| 17 | + return z; | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +// calculate the Levenshtein distance between a and b, | ||
| 21 | +function levenshtein (a, b) | ||
| 22 | +{ | ||
| 23 | + var cost; | ||
| 24 | + var m = a.length; | ||
| 25 | + var n = b.length; | ||
| 26 | + | ||
| 27 | + // make sure a.length >= b.length to use O(min(n,m)) space | ||
| 28 | + if (m < n) | ||
| 29 | + { | ||
| 30 | + var c=a; a=b; b=c; | ||
| 31 | + var o=m; m=n; n=o; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + var r = new Array(); | ||
| 35 | + r[0] = new Array(); | ||
| 36 | + for (var c = 0; c < n+1; c++) | ||
| 37 | + r[0][c] = c; | ||
| 38 | + | ||
| 39 | + for (var i = 1; i < m+1; i++) | ||
| 40 | + { | ||
| 41 | + r[i] = new Array(); | ||
| 42 | + r[i][0] = i; | ||
| 43 | + | ||
| 44 | + for (var j = 1; j < n+1; j++) | ||
| 45 | + { | ||
| 46 | + cost = (a.charAt(i-1) == b.charAt(j-1))? 0: 1; | ||
| 47 | + r[i][j] = minimum (r[i-1][j]+1, r[i][j-1]+1, r[i-1][j-1]+cost); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + return r[r.length-1][r[r.length-1].length-1]; | ||
| 52 | +} |
js/personAdmin/person.js
0 → 100644
| 1 | +function c_person (personId, photographerId, ownerId, firstname, surname, | ||
| 2 | + company, email, url, cameraId, wmWidth, wmHeight, wmXPos, wmYPos) | ||
| 3 | +{ | ||
| 4 | + this.personId = personId; | ||
| 5 | + this.photographerId = photographerId; | ||
| 6 | + this.ownerId = ownerId; | ||
| 7 | + this.firstname = firstname; | ||
| 8 | + this.surname = surname; | ||
| 9 | + this.company = company; | ||
| 10 | + this.email = email; | ||
| 11 | + this.url = url; | ||
| 12 | + this.cameraId = cameraId; | ||
| 13 | + this.wmWidth = wmWidth; | ||
| 14 | + this.wmHeight = wmHeight; | ||
| 15 | + this.wmXPos = wmXPos; | ||
| 16 | + this.wmYPos = wmYPos; | ||
| 17 | + | ||
| 18 | + this.personForm = null; | ||
| 19 | + | ||
| 20 | + this.connect = function (personForm) | ||
| 21 | + { | ||
| 22 | + this.personForm = personForm; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + this.reset = function () | ||
| 26 | + { | ||
| 27 | + if (this.personId != -1) | ||
| 28 | + { | ||
| 29 | + this.personId = -1; | ||
| 30 | + this.photographerId = -1; | ||
| 31 | + this.ownerId = -1; | ||
| 32 | + this.firstname = ''; | ||
| 33 | + this.surname = ''; | ||
| 34 | + this.company = ''; | ||
| 35 | + this.email = ''; | ||
| 36 | + this.url = ''; | ||
| 37 | + this.cameraId = -1; | ||
| 38 | + this.wmWidth = ''; | ||
| 39 | + this.wmHeight = ''; | ||
| 40 | + this.wmXPos = ''; | ||
| 41 | + this.wmYPos = ''; | ||
| 42 | + | ||
| 43 | + if (this.personForm != null) | ||
| 44 | + this.personForm.updateForm (); | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + this.update = function (p) | ||
| 49 | + { | ||
| 50 | + if (this.personId != p.personId) | ||
| 51 | + { | ||
| 52 | + this.personId = p.personId; | ||
| 53 | + this.photographerId = p.photographerId; | ||
| 54 | + this.ownerId = p.ownerId; | ||
| 55 | + this.firstname = p.firstname; | ||
| 56 | + this.surname = p.surname; | ||
| 57 | + this.company = p.company; | ||
| 58 | + this.email = p.email; | ||
| 59 | + this.url = p.url; | ||
| 60 | + this.cameraId = p.cameraId; | ||
| 61 | + this.wmWidth = p.wmWidth; | ||
| 62 | + this.wmHeight = p.wmHeight; | ||
| 63 | + this.wmXPos = p.wmXPos; | ||
| 64 | + this.wmYPos = p.wmYPos; | ||
| 65 | + | ||
| 66 | + if (this.personForm != null) | ||
| 67 | + this.personForm.updateForm (); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | +} |
js/personAdmin/personInUp.js
0 → 100644
| 1 | +/* | ||
| 2 | + * requires fittingStrings.js to be loaded first | ||
| 3 | + */ | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +/* | ||
| 7 | + * controls input/update formular for person insert | ||
| 8 | + * | ||
| 9 | + * Arguments: | ||
| 10 | + * upId / ID of the insert checkbox | ||
| 11 | + * inId / ID of the update checkbox | ||
| 12 | + * persons / Array containing all persons already existant in DB | ||
| 13 | + * | ||
| 14 | + * Methods: | ||
| 15 | + * de_activate / de/activate the formular fields for input | ||
| 16 | + * updateForm / calls de_activate and controls the checkboxes | ||
| 17 | + */ | ||
| 18 | +function personInUp ( | ||
| 19 | + upId, inId, submitId, person, newPerson, arrRight, arrDown) | ||
| 20 | +{ | ||
| 21 | + this.updBox = upId; | ||
| 22 | + this.insBox = inId; | ||
| 23 | + this.submitButton = submitId; | ||
| 24 | + this.arrRight = arrRight; | ||
| 25 | + this.arrDown = arrDown; | ||
| 26 | + this.person = person; | ||
| 27 | + this.newPerson = newPerson; | ||
| 28 | + | ||
| 29 | + person.connect (this); | ||
| 30 | + | ||
| 31 | + this.de_activate = function (field) | ||
| 32 | + { | ||
| 33 | + var updBox = document.getElementById (this.updBox); | ||
| 34 | + var insBox = document.getElementById (this.insBox); | ||
| 35 | + | ||
| 36 | + if (updBox.checked == true || insBox.checked == true) | ||
| 37 | + field.disabled = false; | ||
| 38 | + else | ||
| 39 | + field.disabled = true; | ||
| 40 | + | ||
| 41 | + return false; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + this.un_fold = function (id, element) | ||
| 45 | + { | ||
| 46 | + title = element.parentNode.getElementsByTagName ('div')[0]; | ||
| 47 | + img = title.getElementsByTagName ('img')[0]; | ||
| 48 | + | ||
| 49 | + if (id != -1) | ||
| 50 | + { | ||
| 51 | + element.style.display = 'block'; | ||
| 52 | + img.src = this.arrDown.getImgUrl (title); | ||
| 53 | + } | ||
| 54 | + else | ||
| 55 | + { | ||
| 56 | + element.style.display = 'none'; | ||
| 57 | + img.src = this.arrRight.getImgUrl (title); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + this.updateFields = function (person) | ||
| 62 | + { | ||
| 63 | + for (p in person) | ||
| 64 | + { | ||
| 65 | + if (p == 'personForm') | ||
| 66 | + break; | ||
| 67 | + | ||
| 68 | + var field = document.getElementById (p); | ||
| 69 | + | ||
| 70 | + if (field != null) | ||
| 71 | + { | ||
| 72 | + field.value = person[p]; | ||
| 73 | + this.de_activate (field); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + switch (p) | ||
| 77 | + { | ||
| 78 | + case 'photographerId': | ||
| 79 | + this.un_fold (person[p], | ||
| 80 | + document.getElementById ('cameraId').parentNode.parentNode); | ||
| 81 | + break; | ||
| 82 | + case 'ownerId': | ||
| 83 | + this.un_fold (person[p], | ||
| 84 | + document.getElementById ('wmWidth').parentNode.parentNode); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + this.updateForm = function () | ||
| 90 | + { | ||
| 91 | + var updBox = document.getElementById (this.updBox); | ||
| 92 | + var insBox = document.getElementById (this.insBox); | ||
| 93 | + var submitButton = document.getElementById (this.submitButton); | ||
| 94 | + var person; | ||
| 95 | + | ||
| 96 | + if (this.person.personId != -1) | ||
| 97 | + { | ||
| 98 | + if (insBox.checked == false) | ||
| 99 | + { | ||
| 100 | + person = this.person; | ||
| 101 | + updBox.disabled = false; | ||
| 102 | + } | ||
| 103 | + else | ||
| 104 | + { | ||
| 105 | + person = this.newPerson; | ||
| 106 | + updBox.checked = false; | ||
| 107 | + updBox.disabled = true; | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + else | ||
| 111 | + { | ||
| 112 | + person = this.newPerson; | ||
| 113 | + updBox.checked = false; | ||
| 114 | + updBox.disabled = true; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + if (updBox.checked == true || insBox.checked == true) | ||
| 118 | + submitButton.disabled = false; | ||
| 119 | + else | ||
| 120 | + submitButton.disabled = true; | ||
| 121 | + | ||
| 122 | + this.updateFields (person); | ||
| 123 | + | ||
| 124 | + return false; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + this.selectPerson = function () | ||
| 128 | + { | ||
| 129 | + var insBox = document.getElementById (this.insBox); | ||
| 130 | + var person; | ||
| 131 | + | ||
| 132 | + if (insBox.checked == true) | ||
| 133 | + person = this.newPerson; | ||
| 134 | + else | ||
| 135 | + person = this.person; | ||
| 136 | + | ||
| 137 | + return person; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + this.setFirstname = function (value) | ||
| 141 | + { | ||
| 142 | + this.selectPerson ().firstname = value; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + this.setSurname = function (value) | ||
| 146 | + { | ||
| 147 | + this.selectPerson ().surname = value; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + this.setCompany = function (value) | ||
| 151 | + { | ||
| 152 | + this.selectPerson ().company = value; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + this.setEmail = function (value) | ||
| 156 | + { | ||
| 157 | + this.selectPerson ().email = value; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + this.setUrl = function (value) | ||
| 161 | + { | ||
| 162 | + this.selectPerson ().url = value; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + this.setCameraId = function (value) | ||
| 166 | + { | ||
| 167 | + var person = this.selectPerson (); | ||
| 168 | + | ||
| 169 | + person.cameraId = value; | ||
| 170 | + if (person == this.newPerson) | ||
| 171 | + person.photographerId = 0; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + this.setWmWidth = function (value) | ||
| 175 | + { | ||
| 176 | + var person = this.selectPerson (); | ||
| 177 | + | ||
| 178 | + person.wmWidth = value; | ||
| 179 | + if (person == this.newPerson) | ||
| 180 | + person.ownerId = 0; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + this.setWmHeight = function (value) | ||
| 184 | + { | ||
| 185 | + var person = this.selectPerson (); | ||
| 186 | + | ||
| 187 | + person.wmHeight = value; | ||
| 188 | + if (person == this.newPerson) | ||
| 189 | + person.ownerId = 0; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + this.setWmXPos = function (value) | ||
| 193 | + { | ||
| 194 | + var person = this.selectPerson (); | ||
| 195 | + | ||
| 196 | + person.wmXPos = value; | ||
| 197 | + if (person == this.newPerson) | ||
| 198 | + person.ownerId = 0; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + this.setWmYPos = function (value) | ||
| 202 | + { | ||
| 203 | + var person = this.selectPerson (); | ||
| 204 | + | ||
| 205 | + person.wmYPos = value; | ||
| 206 | + if (person == this.newPerson) | ||
| 207 | + person.ownerId = 0; | ||
| 208 | + } | ||
| 209 | +} |
js/personAdmin/personSearch1.js
0 → 100644
| 1 | +/* | ||
| 2 | + * requires fittingStrings.js to be loaded first | ||
| 3 | + */ | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +/* | ||
| 7 | + * provide alternative Names already existent in DB to given names in | ||
| 8 | + * input text fields: | ||
| 9 | + * | ||
| 10 | + * Arguments: | ||
| 11 | + * fname / ID of the input text field with firstname | ||
| 12 | + * sname / ID of the input text field with surname | ||
| 13 | + * fnameAlt / ID of the list that recieves the alternative firstnames | ||
| 14 | + * snameAlt / ID of the list that receives the alternative surnames | ||
| 15 | + * names / Array containing the already existing names and persons. | ||
| 16 | + * | ||
| 17 | + * Methods: | ||
| 18 | + * updField / exact match(no-case) found => update input field | ||
| 19 | + * genAlternativesList / generate List of alternative Strings | ||
| 20 | + * altSurnames / fill the list of alternative surnames | ||
| 21 | + * altFirstnames / fill the list of alternative firstnames | ||
| 22 | + */ | ||
| 23 | +function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) | ||
| 24 | +{ | ||
| 25 | + this.firstname = fname; | ||
| 26 | + this.surname = sname; | ||
| 27 | + this.fNameAlt = fnameAlt; | ||
| 28 | + this.sNameAlt = snameAlt; | ||
| 29 | + | ||
| 30 | + this.surnames = new Array (); | ||
| 31 | + this.firstnames = new Array (); | ||
| 32 | + this.persons = new Array (); | ||
| 33 | + for (sn in names) | ||
| 34 | + { | ||
| 35 | + this.surnames.push (sn); | ||
| 36 | + this.firstnames[sn] = new Array (); | ||
| 37 | + this.persons[sn] = new Array (); | ||
| 38 | + for (d in names[sn]) | ||
| 39 | + { | ||
| 40 | + this.firstnames[sn].push (names[sn][d][0]); | ||
| 41 | + this.persons[sn][names[sn][d][0]] = names[sn][d][1]; | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + this.person = person; | ||
| 45 | + | ||
| 46 | + this.sNameBest = new Array (-1, -1, null); | ||
| 47 | + this.fNameBest = new Array (-1, -1, null); | ||
| 48 | + | ||
| 49 | + this.show = function (id) | ||
| 50 | + { | ||
| 51 | + var node = document.getElementById (id); | ||
| 52 | + node.parentNode.style.visibility = 'visible'; | ||
| 53 | + | ||
| 54 | + return false; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + this.hide = function (id) | ||
| 58 | + { | ||
| 59 | + var node = document.getElementById (id); | ||
| 60 | + node.parentNode.style.visibility = 'hidden'; | ||
| 61 | + | ||
| 62 | + return false; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + this.updField = function (field, alternative, altId) | ||
| 66 | + { | ||
| 67 | + if (alternative[1] == 0) | ||
| 68 | + field.value = alternative[2]; | ||
| 69 | + else | ||
| 70 | + if (alternative[1] >= 0) | ||
| 71 | + return this.show (altId); | ||
| 72 | + | ||
| 73 | + return this.hide (altId); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + this.genAlternativesList = function (bestFit, dists) | ||
| 77 | + { | ||
| 78 | + if (dists.length > 0) | ||
| 79 | + // there are caculated distances for surnames | ||
| 80 | + { | ||
| 81 | + var i = 0; | ||
| 82 | + var bestMatch = dists[0].split ('::'); // infos for best match | ||
| 83 | + | ||
| 84 | + // reset matches select | ||
| 85 | + while ((child = bestFit.firstChild) != null) | ||
| 86 | + bestFit.removeChild (child); | ||
| 87 | + | ||
| 88 | + for (match in dists) | ||
| 89 | + // walk through all matches | ||
| 90 | + { | ||
| 91 | + // get infos for match | ||
| 92 | + var sMatch = dists[match].split ('::'); | ||
| 93 | + | ||
| 94 | + // create list entries | ||
| 95 | + newLi = document.createElement ('li'); | ||
| 96 | + liTxt = document.createTextNode (sMatch[2]); | ||
| 97 | + newLi.appendChild (liTxt); | ||
| 98 | + bestFit.appendChild (newLi); | ||
| 99 | + i=i+1; | ||
| 100 | + | ||
| 101 | + if (i >= bestMatch[1]) | ||
| 102 | + // dont show more than best match distance matches. | ||
| 103 | + break; | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + else | ||
| 107 | + // there are no caculated distances for surnames | ||
| 108 | + { | ||
| 109 | + // reset matches select | ||
| 110 | + while ((child = bestFit.firstChild) != null) | ||
| 111 | + bestFit.removeChild (child); | ||
| 112 | + return new Array (-1, -1, ''); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + return bestMatch; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + this.altSurnames = function () | ||
| 119 | + { | ||
| 120 | + var surname = document.getElementById (this.surname); | ||
| 121 | + var sNameAlt = document.getElementById (this.sNameAlt); | ||
| 122 | + var dists = fittingStrings (surname.value, this.surnames, false); | ||
| 123 | + | ||
| 124 | + this.sNameBest = this.genAlternativesList (sNameAlt, dists); | ||
| 125 | + this.updField (surname, this.sNameBest, this.sNameAlt) | ||
| 126 | + | ||
| 127 | + if (this.sNameBest[1] == 0) | ||
| 128 | + { | ||
| 129 | + var firstname = document.getElementById (this.firstname); | ||
| 130 | + var dists = fittingStrings ( | ||
| 131 | + firstname.value, this.firstnames[this.sNameBest[2]], false); | ||
| 132 | + | ||
| 133 | + if (dists.length > 0) | ||
| 134 | + this.fNameBest = dists[0].split ('::'); | ||
| 135 | + | ||
| 136 | + if (this.person != null) | ||
| 137 | + if (this.fNameBest[1] == 0) | ||
| 138 | + this.person.update ( | ||
| 139 | + this.persons[this.sNameBest[2]][this.fNameBest[2]]); | ||
| 140 | + else | ||
| 141 | + this.person.reset (); | ||
| 142 | + } | ||
| 143 | + else | ||
| 144 | + { | ||
| 145 | + this.fNameBest = new Array (-1, -1, null); | ||
| 146 | + if (this.person != null) | ||
| 147 | + this.person.reset (); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + return false; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + this.altFirstnames = function (person) | ||
| 154 | + { | ||
| 155 | + var firstname = document.getElementById (this.firstname); | ||
| 156 | + var fNameAlt = document.getElementById (this.fNameAlt); | ||
| 157 | + | ||
| 158 | + if (this.sNameBest[1] == 0) | ||
| 159 | + { | ||
| 160 | + var surname = document.getElementById (this.surname); | ||
| 161 | + var dists = fittingStrings ( | ||
| 162 | + firstname.value, this.firstnames[this.sNameBest[2]], false); | ||
| 163 | + } | ||
| 164 | + else | ||
| 165 | + dists = new Array (); | ||
| 166 | + | ||
| 167 | + this.fNameBest = this.genAlternativesList (fNameAlt, dists); | ||
| 168 | + this.updField (firstname, this.fNameBest, this.fNameAlt) | ||
| 169 | + | ||
| 170 | + if (this.person != null) | ||
| 171 | + if (this.sNameBest[1] == 0 && this.fNameBest[1] == 0) | ||
| 172 | + this.person.update ( | ||
| 173 | + this.persons[this.sNameBest[2]][this.fNameBest[2]]); | ||
| 174 | + else | ||
| 175 | + this.person.reset (); | ||
| 176 | + | ||
| 177 | + return false; | ||
| 178 | + } | ||
| 179 | +} |
js/transPngBg.js
0 → 100644
| 1 | +function transPngBg (img, libUrl) | ||
| 2 | +{ | ||
| 3 | + this.img = img; | ||
| 4 | + this.libUrl = libUrl; | ||
| 5 | + | ||
| 6 | + this.RGBtoHex = function (color) | ||
| 7 | + { | ||
| 8 | + color = color.replace (/^rgb\((.*)\)$/, '$1'); | ||
| 9 | + color = color.replace (/ /g, '').split (','); | ||
| 10 | + | ||
| 11 | + return this.toHex (color[0]) + | ||
| 12 | + this.toHex (color[1]) + | ||
| 13 | + this.toHex(color[2]); | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + this.toHex = function (N) | ||
| 17 | + { | ||
| 18 | + if (N == null) | ||
| 19 | + return "00"; | ||
| 20 | + | ||
| 21 | + N = parseInt(N); | ||
| 22 | + if (N == 0 || isNaN(N)) | ||
| 23 | + return "00"; | ||
| 24 | + | ||
| 25 | + N = Math.max (0, N); | ||
| 26 | + N = Math.min (N, 255); | ||
| 27 | + N = Math.round(N); | ||
| 28 | + | ||
| 29 | + return "0123456789ABCDEF".charAt ((N-N % 16) / 16) + | ||
| 30 | + "0123456789ABCDEF".charAt (N % 16); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + this.getImgUrl = function (posElement) | ||
| 34 | + { | ||
| 35 | + var cNames = posElement.className.split (' '); | ||
| 36 | + var color = posElement.style.backgroundImage; | ||
| 37 | + | ||
| 38 | + // try to get the background color of the given element from class | ||
| 39 | + // ---------------------------------------------------------------- | ||
| 40 | + if (color == '') | ||
| 41 | + { | ||
| 42 | + var cName; | ||
| 43 | + | ||
| 44 | + for (var cN in cNames) | ||
| 45 | + { | ||
| 46 | + if (cNames[cN].indexOf ('bgc') != -1) | ||
| 47 | + { | ||
| 48 | + cName = cNames[cN]; | ||
| 49 | + break; | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + loop: for (var i=0; i<document.styleSheets.length; i++) | ||
| 54 | + { | ||
| 55 | + var rules = document.styleSheets[i].cssRules; | ||
| 56 | + if (rules == null) | ||
| 57 | + rules = document.styleSheets[i].rules; | ||
| 58 | + | ||
| 59 | + for (var j=0; j<rules.length; j++) | ||
| 60 | + { | ||
| 61 | + var selector = rules[j].selectorText; | ||
| 62 | + | ||
| 63 | + if (selector.indexOf (cName) != -1) | ||
| 64 | + { | ||
| 65 | + color = rules[j].style.backgroundColor; | ||
| 66 | + | ||
| 67 | + if (color.indexOf ('#') != -1) | ||
| 68 | + color = color.substr (1); | ||
| 69 | + else | ||
| 70 | + color = this.RGBtoHex (color); | ||
| 71 | + | ||
| 72 | + break loop; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + // ---------------------------------------------------------------- | ||
| 78 | + | ||
| 79 | + return this.libUrl + 'gd_bgMerge.php?col=' + color + '&img=' + this.img; | ||
| 80 | + } | ||
| 81 | +} |
libs/c_SavantSmall.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | +* | ||
| 5 | +* Error constants. | ||
| 6 | +* | ||
| 7 | +*/ | ||
| 8 | + | ||
| 9 | +define('SAVANT2_ERROR_ASSIGN', -1); | ||
| 10 | +define('SAVANT2_ERROR_ASSIGNREF', -2); | ||
| 11 | +define('SAVANT2_ERROR_COMPILER', -3); | ||
| 12 | +define('SAVANT2_ERROR_NOFILTER', -4); | ||
| 13 | +define('SAVANT2_ERROR_NOPLUGIN', -5); | ||
| 14 | +define('SAVANT2_ERROR_NOSCRIPT', -6); | ||
| 15 | +define('SAVANT2_ERROR_NOTEMPLATE', -7); | ||
| 16 | +define('SAVANT2_ERROR_COMPILE_FAIL', -8); | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | +* | ||
| 21 | +* Error messages. | ||
| 22 | +* | ||
| 23 | +*/ | ||
| 24 | + | ||
| 25 | +if (! isset($GLOBALS['_SAVANT2']['error'])) { | ||
| 26 | + $GLOBALS['_SAVANT2']['error'] = array( | ||
| 27 | + SAVANT2_ERROR_ASSIGN => 'assign() parameters not correct', | ||
| 28 | + SAVANT2_ERROR_ASSIGNREF => 'assignRef() parameters not correct', | ||
| 29 | + SAVANT2_ERROR_COMPILER => 'compiler not an object or has no compile() method', | ||
| 30 | + SAVANT2_ERROR_NOFILTER => 'filter file not found', | ||
| 31 | + SAVANT2_ERROR_NOPLUGIN => 'plugin file not found', | ||
| 32 | + SAVANT2_ERROR_NOSCRIPT => 'compiled template script file not found', | ||
| 33 | + SAVANT2_ERROR_NOTEMPLATE => 'template source file not found', | ||
| 34 | + SAVANT2_ERROR_COMPILE_FAIL => 'template source failed to compile' | ||
| 35 | + ); | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +class Savant2_Error { | ||
| 39 | + | ||
| 40 | + var $code = null; | ||
| 41 | + var $info = array(); | ||
| 42 | + var $text = null; | ||
| 43 | + var $backtrace = null; | ||
| 44 | + | ||
| 45 | + function Savant2_Error($conf = array()) | ||
| 46 | + { | ||
| 47 | + // set public properties | ||
| 48 | + foreach ($conf as $key => $val) { | ||
| 49 | + $this->$key = $val; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + // generate a backtrace | ||
| 53 | + if (function_exists('debug_backtrace')) { | ||
| 54 | + $this->backtrace = debug_backtrace(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + // extended behaviors | ||
| 58 | + $this->_genError(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + function _genError() | ||
| 62 | + { | ||
| 63 | + } | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | + | ||
| 67 | +/** | ||
| 68 | +* | ||
| 69 | +* This is totally based on Savent by Paul M. Jones <pmjones@ciaweb.net>. | ||
| 70 | +* But is made much smaller... | ||
| 71 | +*/ | ||
| 72 | + | ||
| 73 | +class SavantSmall { | ||
| 74 | + | ||
| 75 | + var $_error = null; | ||
| 76 | + var $_escape = array('htmlspecialchars'); | ||
| 77 | + var $_output = null; | ||
| 78 | + | ||
| 79 | + var $_path = array( | ||
| 80 | + 'resource' => array(), | ||
| 81 | + 'template' => array() | ||
| 82 | + ); | ||
| 83 | + | ||
| 84 | + var $_restrict = false; | ||
| 85 | + | ||
| 86 | + var $_template = null; | ||
| 87 | + | ||
| 88 | + | ||
| 89 | + // ----------------------------------------------------------------- | ||
| 90 | + // | ||
| 91 | + // Constructor and general property setters | ||
| 92 | + // | ||
| 93 | + // ----------------------------------------------------------------- | ||
| 94 | + | ||
| 95 | + | ||
| 96 | + function __construct($conf = array()) | ||
| 97 | + { | ||
| 98 | + // set the default template search dirs | ||
| 99 | + if (isset($conf['template_path'])) { | ||
| 100 | + // user-defined dirs | ||
| 101 | + $this->setPath('template', $conf['template_path']); | ||
| 102 | + } else { | ||
| 103 | + // default directory only | ||
| 104 | + $this->setPath('template', null); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + // set the error class | ||
| 108 | + if (isset($conf['error'])) { | ||
| 109 | + $this->setError($conf['error']); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + // set the restrict flag | ||
| 113 | + if (isset($conf['restrict'])) { | ||
| 114 | + $this->setRestrict($conf['restrict']); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + // set the default template | ||
| 118 | + if (isset($conf['template'])) { | ||
| 119 | + $this->setTemplate($conf['template']); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + // set the output escaping callbacks | ||
| 123 | + if (isset($config['escape'])) { | ||
| 124 | + call_user_func_array( | ||
| 125 | + array($this, 'setEscape'), | ||
| 126 | + (array) $config['escape'] | ||
| 127 | + ); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + function setError($error) | ||
| 132 | + { | ||
| 133 | + if (! $error) { | ||
| 134 | + $this->_error = null; | ||
| 135 | + } else { | ||
| 136 | + $this->_error = $error; | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + function setRestrict($flag = false) | ||
| 141 | + { | ||
| 142 | + if ($flag) { | ||
| 143 | + $this->_restrict = true; | ||
| 144 | + } else { | ||
| 145 | + $this->_restrict = false; | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + function setTemplate($template) | ||
| 150 | + { | ||
| 151 | + $this->_template = $template; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + | ||
| 155 | + // ----------------------------------------------------------------- | ||
| 156 | + // | ||
| 157 | + // Output escaping and management. | ||
| 158 | + // | ||
| 159 | + // ----------------------------------------------------------------- | ||
| 160 | + | ||
| 161 | + function setEscape() | ||
| 162 | + { | ||
| 163 | + $this->_escape = func_get_args(); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + function addEscape() | ||
| 167 | + { | ||
| 168 | + $args = func_get_args(); | ||
| 169 | + $this->_escape = array_merge($this->_escape, $args); | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + function getEscape() | ||
| 173 | + { | ||
| 174 | + return $this->_escape; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + function escape($value) | ||
| 178 | + { | ||
| 179 | + // if value is not set return | ||
| 180 | + if (! isset ($value)) | ||
| 181 | + return $value; | ||
| 182 | + | ||
| 183 | + // were custom callbacks passed? | ||
| 184 | + if (func_num_args() == 1) { | ||
| 185 | + | ||
| 186 | + // no, only a value was passed. | ||
| 187 | + // loop through the predefined callbacks. | ||
| 188 | + foreach ($this->_escape as $func) { | ||
| 189 | + $value = call_user_func($func, $value); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + } else { | ||
| 193 | + | ||
| 194 | + // yes, use the custom callbacks instead. | ||
| 195 | + $callbacks = func_get_args(); | ||
| 196 | + | ||
| 197 | + // drop $value | ||
| 198 | + array_shift($callbacks); | ||
| 199 | + | ||
| 200 | + // loop through custom callbacks. | ||
| 201 | + foreach ($callbacks as $func) { | ||
| 202 | + $value = call_user_func($func, $value); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + return $value; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + function eprint($value) | ||
| 211 | + { | ||
| 212 | + $args = func_get_args(); | ||
| 213 | + echo call_user_func_array( | ||
| 214 | + array($this, 'escape'), | ||
| 215 | + $args | ||
| 216 | + ); | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + function _($value) | ||
| 220 | + { | ||
| 221 | + $args = func_get_args(); | ||
| 222 | + return call_user_func_array( | ||
| 223 | + array($this, 'eprint'), | ||
| 224 | + $args | ||
| 225 | + ); | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + | ||
| 229 | + | ||
| 230 | + // ----------------------------------------------------------------- | ||
| 231 | + // | ||
| 232 | + // Path management and file finding | ||
| 233 | + // | ||
| 234 | + // ----------------------------------------------------------------- | ||
| 235 | + | ||
| 236 | + function setPath($type, $new) | ||
| 237 | + { | ||
| 238 | + // clear out the prior search dirs | ||
| 239 | + $this->_path[$type] = array(); | ||
| 240 | + | ||
| 241 | + // convert from string to path | ||
| 242 | + if (is_string($new) && ! strpos('://', $new)) { | ||
| 243 | + // the search config is a string, and it's not a stream | ||
| 244 | + // identifier (the "://" piece), add it as a path | ||
| 245 | + // string. | ||
| 246 | + $new = explode(PATH_SEPARATOR, $new); | ||
| 247 | + } else { | ||
| 248 | + // force to array | ||
| 249 | + settype($new, 'array'); | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + // always add the fallback directories as last resort | ||
| 253 | + switch (strtolower($type)) { | ||
| 254 | + case 'template': | ||
| 255 | + $this->addPath($type, '.'); | ||
| 256 | + break; | ||
| 257 | + case 'resource': | ||
| 258 | + $this->addPath($type, dirname(__FILE__) . '/Savant2/'); | ||
| 259 | + break; | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + // actually add the user-specified directories | ||
| 263 | + foreach ($new as $dir) { | ||
| 264 | + $this->addPath($type, $dir); | ||
| 265 | + } | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + function addPath($type, $dir) | ||
| 269 | + { | ||
| 270 | + // no surrounding spaces allowed! | ||
| 271 | + $dir = trim($dir); | ||
| 272 | + | ||
| 273 | + // add trailing separators as needed | ||
| 274 | + if (strpos($dir, '://') && substr($dir, -1) != '/') { | ||
| 275 | + // stream | ||
| 276 | + $dir .= '/'; | ||
| 277 | + } elseif (substr($dir, -1) != DIRECTORY_SEPARATOR) { | ||
| 278 | + // directory | ||
| 279 | + $dir .= DIRECTORY_SEPARATOR; | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + // add to the top of the search dirs | ||
| 283 | + array_unshift($this->_path[$type], $dir); | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + function getPath($type = null) | ||
| 287 | + { | ||
| 288 | + if (! $type) { | ||
| 289 | + return $this->_path; | ||
| 290 | + } else { | ||
| 291 | + return $this->_path[$type]; | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + function findFile($type, $file) | ||
| 296 | + { | ||
| 297 | + // get the set of paths | ||
| 298 | + $set = $this->getPath($type); | ||
| 299 | + | ||
| 300 | + // start looping through them | ||
| 301 | + foreach ($set as $path) { | ||
| 302 | + | ||
| 303 | + // get the path to the file | ||
| 304 | + $fullname = $path . $file; | ||
| 305 | + | ||
| 306 | + // are we doing path checks? | ||
| 307 | + if (! $this->_restrict) { | ||
| 308 | + | ||
| 309 | + // no. this is faster but less secure. | ||
| 310 | + if (file_exists($fullname) && is_readable($fullname)) { | ||
| 311 | + return $fullname; | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + } else { | ||
| 315 | + | ||
| 316 | + // yes. this is slower, but attempts to restrict | ||
| 317 | + // access only to defined paths. | ||
| 318 | + | ||
| 319 | + // is the path based on a stream? | ||
| 320 | + if (strpos('://', $path) === false) { | ||
| 321 | + // not a stream, so do a realpath() to avoid | ||
| 322 | + // directory traversal attempts on the local file | ||
| 323 | + // system. Suggested by Ian Eure, initially | ||
| 324 | + // rejected, but then adopted when the secure | ||
| 325 | + // compiler was added. | ||
| 326 | + $path = realpath($path); // needed for substr() later | ||
| 327 | + $fullname = realpath($fullname); | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + // the substr() check added by Ian Eure to make sure | ||
| 331 | + // that the realpath() results in a directory registered | ||
| 332 | + // with Savant so that non-registered directores are not | ||
| 333 | + // accessible via directory traversal attempts. | ||
| 334 | + if (file_exists($fullname) && is_readable($fullname) && | ||
| 335 | + substr($fullname, 0, strlen($path)) == $path) { | ||
| 336 | + return $fullname; | ||
| 337 | + } | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + // could not find the file in the set of paths | ||
| 342 | + return false; | ||
| 343 | + } | ||
| 344 | + | ||
| 345 | + | ||
| 346 | + // ----------------------------------------------------------------- | ||
| 347 | + // | ||
| 348 | + // Variable and reference assignment | ||
| 349 | + // | ||
| 350 | + // ----------------------------------------------------------------- | ||
| 351 | + | ||
| 352 | + function assign() | ||
| 353 | + { | ||
| 354 | + // this method is overloaded. | ||
| 355 | + $arg = func_get_args(); | ||
| 356 | + | ||
| 357 | + // must have at least one argument. no error, just do nothing. | ||
| 358 | + if (! isset($arg[0])) { | ||
| 359 | + return; | ||
| 360 | + } | ||
| 361 | + | ||
| 362 | + // assign by object | ||
| 363 | + if (is_object($arg[0])) { | ||
| 364 | + // assign public properties | ||
| 365 | + foreach (get_object_vars($arg[0]) as $key => $val) { | ||
| 366 | + if (substr($key, 0, 1) != '_') { | ||
| 367 | + $this->$key = $val; | ||
| 368 | + } | ||
| 369 | + } | ||
| 370 | + return; | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + // assign by associative array | ||
| 374 | + if (is_array($arg[0])) { | ||
| 375 | + foreach ($arg[0] as $key => $val) { | ||
| 376 | + if (substr($key, 0, 1) != '_') { | ||
| 377 | + $this->$key = $val; | ||
| 378 | + } | ||
| 379 | + } | ||
| 380 | + return; | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + // assign by string name and mixed value. | ||
| 384 | + // | ||
| 385 | + // we use array_key_exists() instead of isset() becuase isset() | ||
| 386 | + // fails if the value is set to null. | ||
| 387 | + if (is_string($arg[0]) && | ||
| 388 | + substr($arg[0], 0, 1) != '_' && | ||
| 389 | + array_key_exists(1, $arg)) { | ||
| 390 | + $this->$arg[0] = $arg[1]; | ||
| 391 | + } else { | ||
| 392 | + return $this->_genError(SAVANT2_ERROR_ASSIGN, $arg); | ||
| 393 | + } | ||
| 394 | + } | ||
| 395 | + | ||
| 396 | + function assignRef($key, &$val) | ||
| 397 | + { | ||
| 398 | + if (is_string($key) && substr($key, 0, 1) != '_') { | ||
| 399 | + $this->$key =& $val; | ||
| 400 | + } else { | ||
| 401 | + return $this->_genError( | ||
| 402 | + SAVANT2_ERROR_ASSIGNREF, | ||
| 403 | + array('key' => $key, 'val' => $val) | ||
| 404 | + ); | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + function clear($var = null) | ||
| 409 | + { | ||
| 410 | + if (is_null($var)) { | ||
| 411 | + // clear all variables | ||
| 412 | + $var = array_keys(get_object_vars($this)); | ||
| 413 | + } else { | ||
| 414 | + // clear specific variables | ||
| 415 | + settype($var, 'array'); | ||
| 416 | + } | ||
| 417 | + | ||
| 418 | + // clear out the selected variables | ||
| 419 | + foreach ($var as $name) { | ||
| 420 | + if (substr($name, 0, 1) != '_' && isset($this->$name)) { | ||
| 421 | + unset($this->$name); | ||
| 422 | + } | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + | ||
| 426 | + function getVars($key = null) | ||
| 427 | + { | ||
| 428 | + if (is_null($key)) { | ||
| 429 | + $key = array_keys(get_object_vars($this)); | ||
| 430 | + } | ||
| 431 | + | ||
| 432 | + if (is_array($key)) { | ||
| 433 | + // return a series of vars | ||
| 434 | + $tmp = array(); | ||
| 435 | + foreach ($key as $var) { | ||
| 436 | + if (substr($var, 0, 1) != '_' && isset($this->$var)) { | ||
| 437 | + $tmp[$var] = $this->$var; | ||
| 438 | + } | ||
| 439 | + } | ||
| 440 | + return $tmp; | ||
| 441 | + } else { | ||
| 442 | + // return a single var | ||
| 443 | + if (substr($key, 0, 1) != '_' && isset($this->$key)) { | ||
| 444 | + return $this->$key; | ||
| 445 | + } | ||
| 446 | + } | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + | ||
| 450 | + // ----------------------------------------------------------------- | ||
| 451 | + // | ||
| 452 | + // Template processing | ||
| 453 | + // | ||
| 454 | + // ----------------------------------------------------------------- | ||
| 455 | + | ||
| 456 | + function loadTemplate($tpl = null, $setScript = false) | ||
| 457 | + { | ||
| 458 | + // set to default template if none specified. | ||
| 459 | + if (is_null($tpl)) { | ||
| 460 | + $tpl = $this->_template; | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + // find the template source. | ||
| 464 | + $file = $this->findFile('template', $tpl); | ||
| 465 | + if (! $file) { | ||
| 466 | + return $this->_genError( | ||
| 467 | + SAVANT2_ERROR_NOTEMPLATE, | ||
| 468 | + array('template' => $tpl) | ||
| 469 | + ); | ||
| 470 | + } | ||
| 471 | + | ||
| 472 | + // no compiling requested, return the source path | ||
| 473 | + $this->_script = $file; | ||
| 474 | + return $file; | ||
| 475 | + } | ||
| 476 | + | ||
| 477 | + function findTemplate($tpl = null) | ||
| 478 | + { | ||
| 479 | + return $this->loadTemplate($tpl, false); | ||
| 480 | + } | ||
| 481 | + | ||
| 482 | + function fetch($_tpl = null) | ||
| 483 | + { | ||
| 484 | + // clear prior output | ||
| 485 | + $this->_output = null; | ||
| 486 | + | ||
| 487 | + // load the template script | ||
| 488 | + $_result = $this->loadTemplate($_tpl, true); | ||
| 489 | + | ||
| 490 | + // is there a template script to be processed? | ||
| 491 | + if ($this->isError($_result)) { | ||
| 492 | + return $_result; | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + // unset so as not to introduce into template scope | ||
| 496 | + unset($_tpl); | ||
| 497 | + unset($_result); | ||
| 498 | + | ||
| 499 | + // never allow a 'this' property | ||
| 500 | + if (isset($this->this)) { | ||
| 501 | + unset($this->this); | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + // start capturing output into a buffer | ||
| 505 | + ob_start(); | ||
| 506 | + | ||
| 507 | + // include the requested template filename in the local scope | ||
| 508 | + // (this will execute the view logic). | ||
| 509 | + include $this->_script; | ||
| 510 | + | ||
| 511 | + // done with the requested template; get the buffer and | ||
| 512 | + // clear it. | ||
| 513 | + $this->_output = ob_get_contents(); | ||
| 514 | + ob_end_clean(); | ||
| 515 | + | ||
| 516 | + // done! | ||
| 517 | + return $this->_output; | ||
| 518 | + } | ||
| 519 | + | ||
| 520 | + function display($tpl = null) | ||
| 521 | + { | ||
| 522 | + $result = $this->fetch($tpl); | ||
| 523 | + if ($this->isError($result)) { | ||
| 524 | + return $result; | ||
| 525 | + } else { | ||
| 526 | + echo $result; | ||
| 527 | + } | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | + // ----------------------------------------------------------------- | ||
| 531 | + // | ||
| 532 | + // Error handling | ||
| 533 | + // | ||
| 534 | + // ----------------------------------------------------------------- | ||
| 535 | + | ||
| 536 | + function &_genError($code, $info = array()) | ||
| 537 | + { | ||
| 538 | + // the error config array | ||
| 539 | + $conf = array( | ||
| 540 | + 'code' => $code, | ||
| 541 | + 'text' => 'Savant2: ', | ||
| 542 | + 'info' => (array) $info | ||
| 543 | + ); | ||
| 544 | + | ||
| 545 | + // set an error message from the globals | ||
| 546 | + if (isset($GLOBALS['_SAVANT2']['error'][$code])) { | ||
| 547 | + $conf['text'] .= $GLOBALS['_SAVANT2']['error'][$code]; | ||
| 548 | + } else { | ||
| 549 | + $conf['text'] .= '???'; | ||
| 550 | + } | ||
| 551 | + | ||
| 552 | + // set up the error class name | ||
| 553 | + if ($this->_error) { | ||
| 554 | + $class = 'Savant2_Error_' . $this->_error; | ||
| 555 | + } else { | ||
| 556 | + $class = 'Savant2_Error'; | ||
| 557 | + } | ||
| 558 | + | ||
| 559 | + // set up the error class file name | ||
| 560 | + $file = $class . '.php'; | ||
| 561 | + | ||
| 562 | + // is it loaded? | ||
| 563 | + if (! class_exists($class)) { | ||
| 564 | + | ||
| 565 | + // find the error class | ||
| 566 | + $result = $this->findFile('resource', $file); | ||
| 567 | + if (! $result) { | ||
| 568 | + // could not find the custom error class, revert to | ||
| 569 | + // Savant_Error base class. | ||
| 570 | + $class = 'Savant2_Error'; | ||
| 571 | + $result = dirname(__FILE__) . '/Savant2/Error.php'; | ||
| 572 | + } | ||
| 573 | + | ||
| 574 | + // include the error class | ||
| 575 | + include_once $result; | ||
| 576 | + } | ||
| 577 | + | ||
| 578 | + // instantiate and return the error class | ||
| 579 | + $err = new $class($conf); | ||
| 580 | + return $err; | ||
| 581 | + } | ||
| 582 | + | ||
| 583 | + function isError(&$obj) | ||
| 584 | + { | ||
| 585 | + if (is_object($obj)) { | ||
| 586 | + if ($obj instanceof Savant2_Error || | ||
| 587 | + is_subclass_of($obj, 'Savant2_Error')) { | ||
| 588 | + return true; | ||
| 589 | + } | ||
| 590 | + } | ||
| 591 | + | ||
| 592 | + return false; | ||
| 593 | + } | ||
| 594 | +} | ||
| 595 | +?> |
libs/c_mysqlDb.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once LIBDIR . 'errException.php'; | ||
| 4 | + | ||
| 5 | +class mysqlQueryException extends errException | ||
| 6 | +{ | ||
| 7 | + private $query; | ||
| 8 | + | ||
| 9 | + function __construct ($msg, $no, $file, $line, $context, $query) | ||
| 10 | + { | ||
| 11 | + parent::__construct ($msg, $no, $file, $line, $context); | ||
| 12 | + | ||
| 13 | + $this->query = $query; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + function __toString () | ||
| 17 | + { | ||
| 18 | + $retStr = "Fehler in Query: \n"; | ||
| 19 | + $retStr .= $this->query . "\n\n"; | ||
| 20 | + $retStr .= $this->message . "\n\n"; | ||
| 21 | + $retStr .= 'Datei: ' . $this->file . "\n"; | ||
| 22 | + $retStr .= 'Zeile: ' . $this->line . "\n\n"; | ||
| 23 | + | ||
| 24 | + if ($this->errContext != NULL) | ||
| 25 | + { | ||
| 26 | + $retStr .= "Fehler Context: \n"; | ||
| 27 | + $retStr .= print_r ($this->errContext, TRUE) . "\n"; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + $retStr .= "Aufruf Stack: \n"; | ||
| 31 | + $retStr .= $this->getTraceAsString () . "\n"; | ||
| 32 | + | ||
| 33 | + return $retStr; | ||
| 34 | + } | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +/*** | ||
| 38 | + * This class depends on errException.php, as it does not handle any | ||
| 39 | + * error at all, except it catches exceptions. | ||
| 40 | + */ | ||
| 41 | +class c_mysqlDb | ||
| 42 | +{ | ||
| 43 | + private $connectRes; | ||
| 44 | + private $host; | ||
| 45 | + private $user; | ||
| 46 | + private $pass; | ||
| 47 | + private $database; | ||
| 48 | + | ||
| 49 | + private $result = array (); | ||
| 50 | + private $resCount = 0; | ||
| 51 | + | ||
| 52 | + private function getAllData ($resId, $method, $class = NULL, $parm = NULL) | ||
| 53 | + { | ||
| 54 | + $ret = array (); | ||
| 55 | + | ||
| 56 | + if (isset ($this->result[$resId]) && $this->result[$resId] != FALSE) | ||
| 57 | + { | ||
| 58 | + try | ||
| 59 | + { | ||
| 60 | + mysql_data_seek ($this->result[$resId], 0); | ||
| 61 | + } | ||
| 62 | + catch (Exception $e) | ||
| 63 | + { | ||
| 64 | + if ($e->getCode () != 2) | ||
| 65 | + throw ($e); | ||
| 66 | + // wenn der Fehlercode gleich 2 ist war das resultset nur leer | ||
| 67 | + // und ich mache weiter. | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + if ($class === NULL) | ||
| 71 | + $row = $method ($this->result[$resId]); | ||
| 72 | + else | ||
| 73 | + $row = $method ($this->result[$resId], $class, $parm); | ||
| 74 | + | ||
| 75 | + while ($row != FALSE) | ||
| 76 | + { | ||
| 77 | + $ret[] = $row; | ||
| 78 | + if ($class === NULL) | ||
| 79 | + $row = $method ($this->result[$resId]); | ||
| 80 | + else | ||
| 81 | + $row = $method ($this->result[$resId], $class, $parm); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + return $ret; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + function __construct ($host, $user, $pass, $db) | ||
| 89 | + { | ||
| 90 | + /* init member */ | ||
| 91 | + $this->host = $host; | ||
| 92 | + $this->user = $user; | ||
| 93 | + $this->pass = $pass; | ||
| 94 | + $this->database = $db; | ||
| 95 | + | ||
| 96 | + /* connect and select db */ | ||
| 97 | + $this->connectRes = mysql_pconnect ( | ||
| 98 | + $this->host, | ||
| 99 | + $this->user, | ||
| 100 | + $this->pass); | ||
| 101 | + mysql_select_db ($this->database); | ||
| 102 | + mysql_query ('set character set utf8'); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + function __destruct () | ||
| 106 | + { | ||
| 107 | + /* close connection */ | ||
| 108 | + mysql_close ($this->connectRes); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + function query ($query) | ||
| 112 | + { | ||
| 113 | + try | ||
| 114 | + { | ||
| 115 | + for ($i = 0; $i < $this->resCount; $i++) | ||
| 116 | + if (! isset ($this->result[$i])) | ||
| 117 | + break; | ||
| 118 | + | ||
| 119 | + if ($i == $this->resCount) | ||
| 120 | + $i = $this->resCount = $this->resCount + 1; | ||
| 121 | + | ||
| 122 | + $this->result[$i] = mysql_query ($query); | ||
| 123 | + | ||
| 124 | + if ($this->result[$i] === FALSE) | ||
| 125 | + throw new Exception (mysql_error (), mysql_errno ()); | ||
| 126 | + | ||
| 127 | + return $i; | ||
| 128 | + } | ||
| 129 | + catch (errException $e) | ||
| 130 | + { | ||
| 131 | + throw new mysqlQueryException ( | ||
| 132 | + $e->getMessage (), | ||
| 133 | + $e->getCode (), | ||
| 134 | + $e->getFile (), | ||
| 135 | + $e->getLine (), | ||
| 136 | + $e->getErrContext (), | ||
| 137 | + $query); | ||
| 138 | + } | ||
| 139 | + catch (Exception $e) | ||
| 140 | + { | ||
| 141 | + throw new mysqlQueryException ( | ||
| 142 | + $e->getMessage (), | ||
| 143 | + $e->getCode (), | ||
| 144 | + $e->getFile (), | ||
| 145 | + $e->getLine (), | ||
| 146 | + NULL, | ||
| 147 | + $query); | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + function freeResult ($resId) | ||
| 152 | + { | ||
| 153 | + if (is_resource ($this->result[$resId])) | ||
| 154 | + mysql_free_result ($this->result[$resId]); | ||
| 155 | + unset ($this->result[$resId]); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + function resetResult ($resId) | ||
| 159 | + { | ||
| 160 | + mysql_data_seek ($this->result[$resId], 0); | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + function getResult ($resId) | ||
| 164 | + { | ||
| 165 | + return $this->result[$resId]; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + function getAssoc ($resId) | ||
| 169 | + { | ||
| 170 | + return $this->getAllData ($resId, 'mysql_fetch_assoc'); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + function getArray ($resId) | ||
| 174 | + { | ||
| 175 | + return $this->getAllData ($resId, 'mysql_fetch_row'); | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + function getObject ($resId, $class, $parm = NULL) | ||
| 179 | + { | ||
| 180 | + return $this->getAllData ($resId, 'mysql_fetch_object', $class, $parm); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + function rows ($resId) | ||
| 184 | + { | ||
| 185 | + return mysql_num_rows ($this->result[$resId]); | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + function get ($resId, $row, $col) | ||
| 189 | + { | ||
| 190 | + if ($row > mysql_num_rows ($this->result[$resId])) | ||
| 191 | + return NULL; | ||
| 192 | + | ||
| 193 | + mysql_data_seek ($this->result[$resId], $row); | ||
| 194 | + | ||
| 195 | + if (is_int ($col) && $col > mysql_num_fields ($this->result[$resId])) | ||
| 196 | + return NULL; | ||
| 197 | + | ||
| 198 | + if (is_string ($col)) | ||
| 199 | + { | ||
| 200 | + $rowData = mysql_fetch_assoc ($this->result[$resId]); | ||
| 201 | + | ||
| 202 | + if (! array_key_exists ($col, $rowData)) | ||
| 203 | + return NULL; | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + return mysql_result ($this->result[$resId], $row, $col); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + // === einige nuetzlich Sachen ======================================== | ||
| 210 | + function setLocale ($locale) | ||
| 211 | + { | ||
| 212 | + $resId = $this->query ('set @LANG=\'' . $locale . '\''); | ||
| 213 | + $this->freeResult ($resId); | ||
| 214 | + } | ||
| 215 | +}; | ||
| 216 | + | ||
| 217 | +/* quote string (und pack ' herum) */ | ||
| 218 | +function quoteS ($var) | ||
| 219 | +{ | ||
| 220 | + if ($var === NULL) | ||
| 221 | + return 'NULL'; | ||
| 222 | + | ||
| 223 | + return "'" . addslashes ($var) . "'"; | ||
| 224 | +} | ||
| 225 | + | ||
| 226 | +?> |
libs/c_person.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once LIBDIR . 'c_xmlify.php'; | ||
| 4 | + | ||
| 5 | +class c_person extends c_xmlify | ||
| 6 | +{ | ||
| 7 | + protected $personId; | ||
| 8 | + protected $photographerId; | ||
| 9 | + protected $ownerId; | ||
| 10 | + protected $firstname; | ||
| 11 | + protected $surname; | ||
| 12 | + protected $company; | ||
| 13 | + protected $email; | ||
| 14 | + protected $url; | ||
| 15 | + protected $cameraId; | ||
| 16 | + protected $wmWidth; | ||
| 17 | + protected $wmHeight; | ||
| 18 | + protected $wmXPos; | ||
| 19 | + protected $wmYPos; | ||
| 20 | + | ||
| 21 | + function __construct ($xr) | ||
| 22 | + { | ||
| 23 | + if (NULL !== $xr) | ||
| 24 | + parent::__construct ($xr); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + function get_personId () { return $this->personId; } | ||
| 28 | + function get_photographerId () { return $this->photographerId; } | ||
| 29 | + function get_ownerId () { return $this->ownerId; } | ||
| 30 | + function get_firstname () { return $this->firstname; } | ||
| 31 | + function get_surname () { return $this->surname; } | ||
| 32 | + function get_company () { return $this->company; } | ||
| 33 | + function get_email () { return $this->email; } | ||
| 34 | + function get_url () { return $this->url; } | ||
| 35 | + function get_cameraId () { return $this->cameraId; } | ||
| 36 | + function get_wmWidth () { return $this->wmWidth; } | ||
| 37 | + function get_wmHeight () { return $this->wmHeight; } | ||
| 38 | + function get_wmXPos () { return $this->wmXPos; } | ||
| 39 | + function get_wmYPos () { return $this->wmYPos; } | ||
| 40 | +}; | ||
| 41 | + | ||
| 42 | +?> |
libs/c_personAdmin.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once PICTOOL_SAVANT; | ||
| 4 | +require_once LIBDIR . 'c_mysqlDb.php'; | ||
| 5 | +require_once LIBDIR . 'errException.php'; | ||
| 6 | +require_once LIBDIR . 'c_person.php'; | ||
| 7 | + | ||
| 8 | +class c_personAdmin extends c_picToolSavant | ||
| 9 | +{ | ||
| 10 | + private $dbHandle = NULL; | ||
| 11 | + private $_persons; | ||
| 12 | + | ||
| 13 | + function __construct ($locale = NULL) | ||
| 14 | + { | ||
| 15 | + parent::__construct (); | ||
| 16 | + | ||
| 17 | + setErrExceptionMapping (); | ||
| 18 | + | ||
| 19 | + try | ||
| 20 | + { | ||
| 21 | + $this->dbHandle = new c_mysqlDb ( | ||
| 22 | + self::DBHOST, self::DBUSER, self::DBPASS, self::DBNAME); | ||
| 23 | + | ||
| 24 | + if (is_string ($locale)) | ||
| 25 | + $this->dbHandle->setLocale ($locale); | ||
| 26 | + } | ||
| 27 | + catch (Exception $e) | ||
| 28 | + { | ||
| 29 | + if ($this->dbHandle !== NULL) | ||
| 30 | + unset ($this->dbHandle); | ||
| 31 | + | ||
| 32 | + print "<pre>\n"; | ||
| 33 | + print "Konnte Datenbank nicht initialisieren!\n"; | ||
| 34 | + print $e; | ||
| 35 | + print "</pre>\n"; | ||
| 36 | + exit (1); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + resetErrExceptionMapping (); | ||
| 40 | + | ||
| 41 | + $this->_persons = $this->getPersons (); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + function __destruct () | ||
| 45 | + { | ||
| 46 | + if (isset ($this->persons)) | ||
| 47 | + unset ($this->persons); | ||
| 48 | + | ||
| 49 | + if ($this->dbHandle !== NULL) | ||
| 50 | + unset ($this->dbHandle); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + private function getPersons () | ||
| 54 | + { | ||
| 55 | + $result = NULL; | ||
| 56 | + | ||
| 57 | + setErrExceptionMapping (); | ||
| 58 | + try | ||
| 59 | + { | ||
| 60 | + $resId = $this->dbHandle->query ( | ||
| 61 | + 'SELECT * from personsView ORDER BY surname, firstname'); | ||
| 62 | + $_result = $this->dbHandle->getObject ( | ||
| 63 | + $resId, 'c_person', array (NULL)); | ||
| 64 | + $this->dbHandle->freeResult ($resId); | ||
| 65 | + } | ||
| 66 | + catch (Exception $e) | ||
| 67 | + { | ||
| 68 | + print "jokus<br/>"; | ||
| 69 | + if (isset ($_result)) | ||
| 70 | + unset ($_result); | ||
| 71 | + if (isset ($resId)) | ||
| 72 | + $this->dbHandle->freeResult ($resId); | ||
| 73 | + | ||
| 74 | + print "<pre>"; | ||
| 75 | + print $e; | ||
| 76 | + print "</pre>"; | ||
| 77 | + } | ||
| 78 | + resetErrExceptionMapping (); | ||
| 79 | + | ||
| 80 | + foreach ($_result as $res) | ||
| 81 | + $result[$res->get_personId ()] = $res; | ||
| 82 | + unset ($_result); | ||
| 83 | + | ||
| 84 | + return $result; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + function personSearch1 () | ||
| 88 | + { | ||
| 89 | + $names = array (); | ||
| 90 | + | ||
| 91 | + foreach ($this->_persons as $person) | ||
| 92 | + $names[$person->get_surname ()][] = | ||
| 93 | + array ($person->get_firstname (), $person); | ||
| 94 | + | ||
| 95 | + $this->assign ('names', $names); | ||
| 96 | + | ||
| 97 | + return $this->fetch ('personAdmin/personSearch1.tpl.php'); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + function personInUp () | ||
| 101 | + { | ||
| 102 | + return $this->fetch ('personAdmin/personInUp.tpl.php'); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + function show () | ||
| 106 | + { | ||
| 107 | + $this->assign ('personSearch1', $this->personSearch1 ()); | ||
| 108 | + $this->assign ('personInUp', $this->personInUp ()); | ||
| 109 | + | ||
| 110 | + $this->display ('personAdmin/personAdmin.tpl.php'); | ||
| 111 | + } | ||
| 112 | +}; | ||
| 113 | + | ||
| 114 | +?> |
libs/c_picToolSavant.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once SAVANT_SMALL; | ||
| 4 | + | ||
| 5 | +class c_picToolSavant extends SavantSmall | ||
| 6 | +{ | ||
| 7 | + const DBHOST = 'localhost'; | ||
| 8 | + const DBUSER = 'picadmin'; | ||
| 9 | + const DBPASS = '1Rz3ftb.'; | ||
| 10 | + const DBNAME = 'bilder_new'; | ||
| 11 | + | ||
| 12 | + function __construct() | ||
| 13 | + { | ||
| 14 | + parent::__construct (); | ||
| 15 | + | ||
| 16 | + $this->addPath ('template', TPLDIR); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + function is_set($varname) | ||
| 20 | + { | ||
| 21 | + if ($this->getVars($varname)) | ||
| 22 | + return true; | ||
| 23 | + return false; | ||
| 24 | + } | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +?> |
libs/c_xmlify.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/* | ||
| 4 | + * xml stream to native vars | ||
| 5 | + */ | ||
| 6 | +function xmlToVar ($xr) | ||
| 7 | +{ | ||
| 8 | + if ($xr->isEmptyElement == TRUE) | ||
| 9 | + return NULL; | ||
| 10 | + | ||
| 11 | + $ret = NULL; | ||
| 12 | + | ||
| 13 | + while ($xr->read () && | ||
| 14 | + ! ($xr->nodeType == 15 && | ||
| 15 | + $xr->name == 'variable')) | ||
| 16 | + { | ||
| 17 | + if ($xr->nodeType == 3 && $xr->hasValue == TRUE) | ||
| 18 | + // der iconv is nur drin weil evolver ihre Seiten dummer weise | ||
| 19 | + // als latin1 verschicken, aus der Datenbank aber utf-8 kommt. | ||
| 20 | + $ret = iconv ("UTF-8", "ISO-8859-1", $xr->value); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + return $ret; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +function xmlToArray ($xr) | ||
| 27 | +{ | ||
| 28 | + $ret = array (); | ||
| 29 | + | ||
| 30 | + if ($xr->isEmptyElement == TRUE) | ||
| 31 | + return $ret; | ||
| 32 | + | ||
| 33 | + while ($xr->read () && | ||
| 34 | + ! ($xr->nodeType == 15 && | ||
| 35 | + $xr->name == 'array')) | ||
| 36 | + { | ||
| 37 | + if ($xr->nodeType == 1 && | ||
| 38 | + $xr->name == 'item') | ||
| 39 | + { | ||
| 40 | + $key = $xr->getAttribute ('key'); | ||
| 41 | + | ||
| 42 | + while ($xr->read () && | ||
| 43 | + ! ($xr->nodeType == 15 && | ||
| 44 | + $xr->name == 'item')) | ||
| 45 | + { | ||
| 46 | + if ($xr->nodeType == 1) | ||
| 47 | + { | ||
| 48 | + switch ($xr->name) | ||
| 49 | + { | ||
| 50 | + case 'variable': | ||
| 51 | + $ret[$key] = xmlToVar ($xr); | ||
| 52 | + $type = $xr->getAttribute ('type'); | ||
| 53 | + settype ($ret[$key], $type); | ||
| 54 | + break; | ||
| 55 | + | ||
| 56 | + case 'array': | ||
| 57 | + $ret[$key] = xmlToArray ($xr); | ||
| 58 | + break; | ||
| 59 | + | ||
| 60 | + case 'class': | ||
| 61 | + $class = $xr->getAttribute ('class'); | ||
| 62 | + $ret[$key] = new $class ($xr); | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + return $ret; | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | +/* | ||
| 73 | + * native vars to xml stream | ||
| 74 | + */ | ||
| 75 | +function varToXml ($xw, $name, $val) | ||
| 76 | +{ | ||
| 77 | + $xw->startElement ('variable'); | ||
| 78 | + | ||
| 79 | + if ($name !== NULL) | ||
| 80 | + $xw->writeAttribute ('name', $name); | ||
| 81 | + | ||
| 82 | + $xw->writeAttribute ('type', gettype ($val)); | ||
| 83 | + | ||
| 84 | + $xw->text ($val); | ||
| 85 | + | ||
| 86 | + $xw->endElement (); | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +function arrayToXml ($xw, $name, $arr) | ||
| 90 | +{ | ||
| 91 | + $xw->startElement ('array'); | ||
| 92 | + | ||
| 93 | + if ($name !== NULL) | ||
| 94 | + $xw->writeAttribute ('name', $name); | ||
| 95 | + | ||
| 96 | + foreach ($arr as $key => $val) | ||
| 97 | + { | ||
| 98 | + $xw->startElement ('item'); | ||
| 99 | + $xw->writeAttribute ('key', $key); | ||
| 100 | + | ||
| 101 | + if (is_array ($val)) | ||
| 102 | + { | ||
| 103 | + arrayToXml ($xw, NULL, $val); | ||
| 104 | + } | ||
| 105 | + else if (is_object ($val)) | ||
| 106 | + { | ||
| 107 | + if (in_array ('toXml', get_class_methods ($val)) == TRUE) | ||
| 108 | + { | ||
| 109 | + $val->toXml ($xw); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + else | ||
| 113 | + { | ||
| 114 | + varToXml ($xw, NULL, $val); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + $xw->endElement (); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + $xw->endElement (); | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +function xmlify ($val) | ||
| 124 | +{ | ||
| 125 | + $xw = new xmlWriter (); | ||
| 126 | + $xw->openMemory (); | ||
| 127 | + $xw->setIndent (TRUE); | ||
| 128 | + $xw->startDocument ('1.0', 'UTF-8'); | ||
| 129 | + | ||
| 130 | + if (is_array ($val)) | ||
| 131 | + { | ||
| 132 | + arrayToXml ($xw, NULL, $val); | ||
| 133 | + } | ||
| 134 | + else if (is_object ($val)) | ||
| 135 | + { | ||
| 136 | + if (in_array ('toXml', get_class_methods ($val)) == TRUE) | ||
| 137 | + { | ||
| 138 | + $val->toXml ($xw); | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + else | ||
| 142 | + { | ||
| 143 | + varToXml ($xw, NULL, $val); | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + $res = $xw->outputMemory(TRUE); | ||
| 147 | + unset ($xw); | ||
| 148 | + | ||
| 149 | + return $res; | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +function deXmlify ($xmldata) | ||
| 153 | +{ | ||
| 154 | + $ret = NULL; | ||
| 155 | + | ||
| 156 | +// print "<pre>"; | ||
| 157 | +// var_dump (str_replace ( | ||
| 158 | +// array ("<", ">"), array ("<", ">") , $xmldata)); | ||
| 159 | +// print "</pre>"; | ||
| 160 | +// exit (1); | ||
| 161 | + | ||
| 162 | + $xr = new XMLReader (); | ||
| 163 | + $xr->XML ($xmldata); | ||
| 164 | + | ||
| 165 | + $xr->read (); | ||
| 166 | + | ||
| 167 | + switch ($xr->name) | ||
| 168 | + { | ||
| 169 | + case 'variable': $ret = xmlToVar ($xr); break; | ||
| 170 | + case 'array': $ret = xmlToArray ($xr); break; | ||
| 171 | + case 'class': | ||
| 172 | + $class = $xr->getAttribute ('class'); | ||
| 173 | + $ret = new $class ($xr); | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + $xr->close (); | ||
| 177 | + | ||
| 178 | + return $ret; | ||
| 179 | +} | ||
| 180 | + | ||
| 181 | +class c_xmlify | ||
| 182 | +{ | ||
| 183 | + function __construct ($xr) | ||
| 184 | + { | ||
| 185 | + if ($xr->isEmptyElement == TRUE) | ||
| 186 | + return; | ||
| 187 | + | ||
| 188 | + while ($xr->read () && | ||
| 189 | + ! ($xr->nodeType == 15 && | ||
| 190 | + $xr->name == 'class')) | ||
| 191 | + { | ||
| 192 | + if ($xr->nodeType == 1) | ||
| 193 | + { | ||
| 194 | + $name = $xr->getAttribute ('name'); | ||
| 195 | + | ||
| 196 | + switch ($xr->name) | ||
| 197 | + { | ||
| 198 | + case 'variable': | ||
| 199 | + $this->$name = xmlToVar ($xr); | ||
| 200 | + $type = $xr->getAttribute ('type'); | ||
| 201 | + settype ($this->$name, $type); | ||
| 202 | + break; | ||
| 203 | + | ||
| 204 | + case 'array': | ||
| 205 | + $this->$name = xmlToArray ($xr); | ||
| 206 | + break; | ||
| 207 | + | ||
| 208 | + case 'class': | ||
| 209 | + $class = $xr->getAttribute ('class'); | ||
| 210 | + $this->$name = new $class ($xr); | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + function toXml ($xw, $name = NULL) | ||
| 217 | + { | ||
| 218 | + $xw->startElement ('class'); | ||
| 219 | + | ||
| 220 | + if ($name !== NULL) | ||
| 221 | + $xw->writeAttribute ('name', $name); | ||
| 222 | + | ||
| 223 | + $xw->writeAttribute ('class', get_class ($this)); | ||
| 224 | + | ||
| 225 | + foreach (get_object_vars ($this) as $var => $val) | ||
| 226 | + { | ||
| 227 | + if (is_array ($val)) | ||
| 228 | + { | ||
| 229 | + arrayToXml ($xw, $var, $val); | ||
| 230 | + continue; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + if (is_object ($val)) | ||
| 234 | + { | ||
| 235 | + if (in_array ('toXml', get_class_methods ($val)) == TRUE) | ||
| 236 | + { | ||
| 237 | + $val->toXml ($xw, $var); | ||
| 238 | + } | ||
| 239 | + continue; | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + varToXml ($xw, $var, $val); | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + $xw->endElement(); | ||
| 246 | + } | ||
| 247 | +}; | ||
| 248 | + | ||
| 249 | +?> |
libs/errException.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +static $oldErrHandler = NULL; | ||
| 4 | + | ||
| 5 | +class errException extends Exception | ||
| 6 | +{ | ||
| 7 | + protected $errContext; | ||
| 8 | + | ||
| 9 | + function __construct ($msg, $no, $file, $line, $context) | ||
| 10 | + { | ||
| 11 | + parent::__construct ($msg, $no); | ||
| 12 | + | ||
| 13 | + $this->file = $file; | ||
| 14 | + $this->line = $line; | ||
| 15 | + $this->errContext = $context; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + function __toString () | ||
| 19 | + { | ||
| 20 | + $retStr = "Laufzeitfehler (" . $this->code . "): \n"; | ||
| 21 | + $retStr .= $this->message . "\n\n"; | ||
| 22 | + $retStr .= 'Datei: ' . $this->file . "\n"; | ||
| 23 | + $retStr .= 'Zeile: ' . $this->line . "\n"; | ||
| 24 | + | ||
| 25 | + if ($this->errContext != NULL) | ||
| 26 | + { | ||
| 27 | + $retStr .= "Fehler Context: \n"; | ||
| 28 | + $retStr .= print_r ($this->errContext, TRUE) . "\n"; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + $retStr .= "Aufruf Stack: \n"; | ||
| 32 | + $retStr .= $this->getTraceAsString () . "\n"; | ||
| 33 | + | ||
| 34 | + return $retStr; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + function getErrContext () | ||
| 38 | + { | ||
| 39 | + return $this->errContext; | ||
| 40 | + } | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +function mapErrToExc ($no, $msg, $file, $line, $con) | ||
| 44 | +{ | ||
| 45 | + throw new errException ($msg, $no, $file, $line, $con); | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +function setErrExceptionMapping () | ||
| 49 | +{ | ||
| 50 | + global $oldErrHandler; | ||
| 51 | + | ||
| 52 | + if ($oldErrHandler == NULL) | ||
| 53 | + $oldErrHandler = set_error_handler ('mapErrToExc'); | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +function resetErrExceptionMapping () | ||
| 57 | +{ | ||
| 58 | + global $oldErrHandler; | ||
| 59 | + | ||
| 60 | + if ($oldErrHandler != NULL) | ||
| 61 | + { | ||
| 62 | + set_error_handler ($oldErrHandler); | ||
| 63 | + $oldErrHandler = NULL; | ||
| 64 | + } | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +?> |
libs/gd_bgMerge.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once dirname (__FILE__) . "/../config.php"; | ||
| 4 | +require_once LIBDIR . "errException.php"; | ||
| 5 | + | ||
| 6 | +setErrExceptionMapping (); | ||
| 7 | + | ||
| 8 | +// --- Data ---------------------------------- | ||
| 9 | +if (isset ($_REQUEST['img'])) | ||
| 10 | + $img = $_REQUEST['img']; | ||
| 11 | +else | ||
| 12 | + $img = -1; | ||
| 13 | + | ||
| 14 | +if (isset ($_REQUEST['col'])) | ||
| 15 | + $col = $_REQUEST['col']; | ||
| 16 | +else | ||
| 17 | + $col = 'aaaaaa'; | ||
| 18 | +// ------------------------------------------- | ||
| 19 | + | ||
| 20 | +// Load Image and get it's size | ||
| 21 | +if ($img !== -1) | ||
| 22 | +{ | ||
| 23 | + $size = getimagesize(IMGDIR . $img); | ||
| 24 | + $width = $size[0]; | ||
| 25 | + $height = $size[1]; | ||
| 26 | + unset ($size); | ||
| 27 | + $loadIm = imagecreatefrompng (IMGDIR . $img); | ||
| 28 | +} | ||
| 29 | +else | ||
| 30 | +{ | ||
| 31 | + $width = 1; | ||
| 32 | + $height = 1; | ||
| 33 | + $loadIm = imagecreatetruecolor ($width, $height); | ||
| 34 | + $color = imagecolorallocatealpha ($loadIm, 0, 0, 0, 127); | ||
| 35 | + imagefill ($loadIm, 0, 0, $color); | ||
| 36 | + unset ($color); | ||
| 37 | +} | ||
| 38 | +imagealphablending ($loadIm, TRUE); | ||
| 39 | + | ||
| 40 | +$bgImg = imagecreatetruecolor ($width, $height); | ||
| 41 | +preg_match_all ('/[A-Za-z0-9]{2,2}/', $col, $rgb); | ||
| 42 | +$color = imagecolorallocate ( | ||
| 43 | + $bgImg, hexdec ($rgb[0][0]), hexdec ($rgb[0][1]), hexdec ($rgb[0][2])); | ||
| 44 | +imagefill ($bgImg, 0, 0, $color); | ||
| 45 | +unset ($color); | ||
| 46 | + | ||
| 47 | +imagecopy ($bgImg, $loadIm, 0, 0, 0, 0, $width, $height); | ||
| 48 | +imagedestroy($loadIm); | ||
| 49 | + | ||
| 50 | +resetErrExceptionMapping (); | ||
| 51 | + | ||
| 52 | +header ("Content-Type: image/png"); | ||
| 53 | +imagepng ($bgImg); | ||
| 54 | + | ||
| 55 | +?> |
libs/initLocale.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | + exec ('locale -a | sort -u', $locales); | ||
| 4 | + $locale = 'C'; | ||
| 5 | + | ||
| 6 | + /* | ||
| 7 | + * First find the browser encoding and try to create a valid locale | ||
| 8 | + * from one of the supported browser encodings. Start with the most | ||
| 9 | + * preferred encoding. | ||
| 10 | + */ | ||
| 11 | + $langs = explode (",", $_SERVER[HTTP_ACCEPT_LANGUAGE]); | ||
| 12 | + | ||
| 13 | + foreach ($langs as $lang) | ||
| 14 | + { | ||
| 15 | + preg_match("/^([a-z]{2})(-([a-zA-Z]{2})){0,1}(;q=([0-9].[0-9])){0,1}$/", | ||
| 16 | + $lang, $lng_pref); | ||
| 17 | + | ||
| 18 | + $la = $lng_pref[1]; | ||
| 19 | + if (isset ($lng_pref[3]) && $lng_pref[3] !== "") | ||
| 20 | + $co = '_' . strtoupper ($lng_pref[3]); | ||
| 21 | + else | ||
| 22 | + $co = ''; | ||
| 23 | + if (isset ($lng_pref[5]) && $lng_pref[5] !== "") | ||
| 24 | + $pr = $lng_pref[5]; | ||
| 25 | + else | ||
| 26 | + $pr = 1.0; | ||
| 27 | + | ||
| 28 | + if ($co != "US") | ||
| 29 | + $la_specs[$la . $co] = $pr; | ||
| 30 | + else | ||
| 31 | + $la_specs["POSIX"]=$pr; | ||
| 32 | + } | ||
| 33 | + array_multisort ($la_specs, SORT_DESC, SORT_NUMERIC); | ||
| 34 | + | ||
| 35 | + /* | ||
| 36 | + * Set locale and initialize gettext catalogs | ||
| 37 | + */ | ||
| 38 | + foreach ($la_specs as $key => $value) | ||
| 39 | + { | ||
| 40 | + foreach ($locales as $l) | ||
| 41 | + { | ||
| 42 | + if (isset ($key) && "" !== $key && strpos ($l, $key) !== FALSE) | ||
| 43 | + { | ||
| 44 | + $locale = $l; | ||
| 45 | + break; | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + if ('C' !== $locale) break; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + $l = setlocale (LC_MESSAGES, $locale); | ||
| 52 | + if ($l !== $locale) | ||
| 53 | + { | ||
| 54 | + $locale = 'C'; | ||
| 55 | + setlocale (LC_MESSAGES, $locale); | ||
| 56 | + } | ||
| 57 | + setlocale (LC_TIME, $locale); | ||
| 58 | + bindtextdomain ("bilder", LOCALEDIR); | ||
| 59 | + bind_textdomain_codeset ("bilder", "UTF-8"); | ||
| 60 | + textdomain ("bilder"); | ||
| 61 | + | ||
| 62 | +?> |
locale/de/LC_MESSAGES/bilder.mo
0 → 100644
No preview for this file type
po/de.po
0 → 100644
| 1 | +# German translations for PACKAGE package | ||
| 2 | +# German messages for PACKAGE. | ||
| 3 | +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER | ||
| 4 | +# This file is distributed under the same license as the PACKAGE package. | ||
| 5 | +# <georg@steffers.org>, 2007. | ||
| 6 | +# | ||
| 7 | +msgid "" | ||
| 8 | +msgstr "" | ||
| 9 | +"Project-Id-Version: PACKAGE VERSION\n" | ||
| 10 | +"Report-Msgid-Bugs-To: \n" | ||
| 11 | +"POT-Creation-Date: 2007-10-08 03:09+0200\n" | ||
| 12 | +"PO-Revision-Date: 2007-10-07 15:45+0200\n" | ||
| 13 | +"Last-Translator: <georg@steffers.org>\n" | ||
| 14 | +"Language-Team: German\n" | ||
| 15 | +"MIME-Version: 1.0\n" | ||
| 16 | +"Content-Type: text/plain; charset=UTF-8\n" | ||
| 17 | +"Content-Transfer-Encoding: 8bit\n" | ||
| 18 | +"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
| 19 | + | ||
| 20 | +#: templates/personAdmin/personSearch1.tpl.php:37 | ||
| 21 | +msgid "search" | ||
| 22 | +msgstr "Suche" | ||
| 23 | + | ||
| 24 | +#: templates/personAdmin/personSearch1.tpl.php:45 | ||
| 25 | +#: templates/personAdmin/personInUp.tpl.php:86 | ||
| 26 | +msgid "surname" | ||
| 27 | +msgstr "Vorname" | ||
| 28 | + | ||
| 29 | +#: templates/personAdmin/personSearch1.tpl.php:56 | ||
| 30 | +#: templates/personAdmin/personInUp.tpl.php:80 | ||
| 31 | +msgid "firstname" | ||
| 32 | +msgstr "Nachname" | ||
| 33 | + | ||
| 34 | +#: templates/personAdmin/personInUp.tpl.php:47 | ||
| 35 | +msgid "update" | ||
| 36 | +msgstr "aktualisieren" | ||
| 37 | + | ||
| 38 | +#: templates/personAdmin/personInUp.tpl.php:54 | ||
| 39 | +msgid "insert" | ||
| 40 | +msgstr "einfügen" | ||
| 41 | + | ||
| 42 | +#: templates/personAdmin/personInUp.tpl.php:57 | ||
| 43 | +msgid "submit" | ||
| 44 | +msgstr "abschicken" | ||
| 45 | + | ||
| 46 | +#: templates/personAdmin/personInUp.tpl.php:63 | ||
| 47 | +msgid "personal data" | ||
| 48 | +msgstr "Perönliche Daten" | ||
| 49 | + | ||
| 50 | +#: templates/personAdmin/personInUp.tpl.php:92 | ||
| 51 | +msgid "company" | ||
| 52 | +msgstr "Firma" | ||
| 53 | + | ||
| 54 | +#: templates/personAdmin/personInUp.tpl.php:98 | ||
| 55 | +msgid "email" | ||
| 56 | +msgstr "eMail" | ||
| 57 | + | ||
| 58 | +#: templates/personAdmin/personInUp.tpl.php:104 | ||
| 59 | +msgid "url" | ||
| 60 | +msgstr "Homepage" | ||
| 61 | + | ||
| 62 | +#: templates/personAdmin/personInUp.tpl.php:117 | ||
| 63 | +msgid "photographer" | ||
| 64 | +msgstr "Fotograf" | ||
| 65 | + | ||
| 66 | +#: templates/personAdmin/personInUp.tpl.php:124 | ||
| 67 | +msgid "cameraId" | ||
| 68 | +msgstr "Kamera ID" | ||
| 69 | + | ||
| 70 | +#: templates/personAdmin/personInUp.tpl.php:137 | ||
| 71 | +msgid "owner" | ||
| 72 | +msgstr "Besitzer" | ||
| 73 | + | ||
| 74 | +#: templates/personAdmin/personInUp.tpl.php:144 | ||
| 75 | +msgid "watermark width" | ||
| 76 | +msgstr "Wasserzeichen Breite" | ||
| 77 | + | ||
| 78 | +#: templates/personAdmin/personInUp.tpl.php:150 | ||
| 79 | +msgid "watermark height" | ||
| 80 | +msgstr "Wasserzeichen Höhe" | ||
| 81 | + | ||
| 82 | +#: templates/personAdmin/personInUp.tpl.php:156 | ||
| 83 | +msgid "watermark xPos" | ||
| 84 | +msgstr "Wasserzeichen X" | ||
| 85 | + | ||
| 86 | +#: templates/personAdmin/personInUp.tpl.php:162 | ||
| 87 | +msgid "watermark yPos" | ||
| 88 | +msgstr "Wasserzeichen Y" |
sql/create.sql
0 → 100644
| 1 | +DROP DATABASE bilder_new; | ||
| 2 | +DROP USER 'picadmin'@'localhost'; | ||
| 3 | + | ||
| 4 | +CREATE USER 'picadmin'@'localhost' IDENTIFIED BY '1Rz3ftb.'; | ||
| 5 | + | ||
| 6 | +--GRANT USAGE ON *.* TO 'picadmin'@ 'localhost' IDENTIFIED BY '********' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; | ||
| 7 | + | ||
| 8 | +CREATE DATABASE bilder_new CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci; | ||
| 9 | +GRANT ALL PRIVILEGES ON bilder_new.* TO 'picadmin'@'localhost'; | ||
| 10 | + | ||
| 11 | +SET storage_engine=InnoDB; | ||
| 12 | +USE bilder_new; | ||
| 13 | + | ||
| 14 | +CREATE TABLE language | ||
| 15 | +( | ||
| 16 | + languageId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 17 | + languageCode VARCHAR(3) NOT NULL, | ||
| 18 | + countryCode VARCHAR(2) NULL, | ||
| 19 | + | ||
| 20 | + PRIMARY KEY (languageId), | ||
| 21 | + UNIQUE KEY (languageCode, countryCode) | ||
| 22 | +); | ||
| 23 | + | ||
| 24 | +CREATE TABLE i18n | ||
| 25 | +( | ||
| 26 | + textId BIGINT UNSIGNED NOT NULL, | ||
| 27 | + language BIGINT UNSIGNED NOT NULL, | ||
| 28 | + text TEXT NOT NULL, | ||
| 29 | + | ||
| 30 | + PRIMARY KEY (textId, language), | ||
| 31 | + CONSTRAINT FOREIGN KEY (language) | ||
| 32 | + REFERENCES language (languageId) | ||
| 33 | + ON UPDATE CASCADE | ||
| 34 | + ON DELETE CASCADE | ||
| 35 | +); | ||
| 36 | + | ||
| 37 | +CREATE TABLE watermark | ||
| 38 | +( | ||
| 39 | + watermarkId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 40 | + width SMALLINT UNSIGNED NOT NULL, | ||
| 41 | + height SMALLINT UNSIGNED NOT NULL, | ||
| 42 | + xpos SMALLINT NOT NULL, | ||
| 43 | + ypos SMALLINT NOT NULL, | ||
| 44 | + | ||
| 45 | + PRIMARY KEY (watermarkId) | ||
| 46 | +); | ||
| 47 | + | ||
| 48 | +-- Das sollte noch aufgeteilt werden, eine Person kann ein Fotograph, der | ||
| 49 | +-- Besitzer eines Bildes (Copyrighthalter) oder ein user des Bildertools sein. | ||
| 50 | +CREATE TABLE person | ||
| 51 | +( | ||
| 52 | + personId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 53 | + firstname VARCHAR(30) NULL, | ||
| 54 | + surname VARCHAR(30) NULL, | ||
| 55 | + company VARCHAR(30) NULL, | ||
| 56 | + email VARCHAR(30) NULL, | ||
| 57 | + url VARCHAR(30) NULL, | ||
| 58 | + | ||
| 59 | + PRIMARY KEY (personId), | ||
| 60 | + UNIQUE KEY (firstname, surname) | ||
| 61 | +); | ||
| 62 | + | ||
| 63 | +CREATE TABLE photographer | ||
| 64 | +( | ||
| 65 | + photographerId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 66 | + personId BIGINT UNSIGNED NOT NULL, | ||
| 67 | + cameraId BIGINT UNSIGNED NULL, | ||
| 68 | + | ||
| 69 | + PRIMARY KEY (photographerId), | ||
| 70 | + UNIQUE KEY (personId), | ||
| 71 | + CONSTRAINT FOREIGN KEY (personId) | ||
| 72 | + REFERENCES person (personId) | ||
| 73 | + ON UPDATE CASCADE | ||
| 74 | + ON DELETE CASCADE | ||
| 75 | +); | ||
| 76 | + | ||
| 77 | +CREATE TABLE owner | ||
| 78 | +( | ||
| 79 | + ownerId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 80 | + personId BIGINT UNSIGNED NOT NULL, | ||
| 81 | + watermarkId BIGINT UNSIGNED NULL, | ||
| 82 | + | ||
| 83 | + PRIMARY KEY (ownerId), | ||
| 84 | + UNIQUE KEY (personId), | ||
| 85 | + CONSTRAINT FOREIGN KEY (personId) | ||
| 86 | + REFERENCES person (personId) | ||
| 87 | + ON UPDATE CASCADE | ||
| 88 | + ON DELETE CASCADE, | ||
| 89 | + CONSTRAINT FOREIGN KEY (watermarkId) | ||
| 90 | + REFERENCES watermark (watermarkId) | ||
| 91 | + ON UPDATE CASCADE | ||
| 92 | + ON DELETE SET NULL | ||
| 93 | +); | ||
| 94 | + | ||
| 95 | +CREATE TABLE format | ||
| 96 | +( | ||
| 97 | + formatId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 98 | + width SMALLINT UNSIGNED NOT NULL, | ||
| 99 | + height SMALLINT UNSIGNED NOT NULL, | ||
| 100 | + quality TINYINT UNSIGNED NOT NULL, | ||
| 101 | + | ||
| 102 | + PRIMARY KEY (formatId) | ||
| 103 | +); | ||
| 104 | + | ||
| 105 | +CREATE TABLE picture | ||
| 106 | +( | ||
| 107 | + pictureId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 108 | + title BIGINT UNSIGNED NULL, | ||
| 109 | + photographerId BIGINT UNSIGNED NULL, | ||
| 110 | + ownerId BIGINT UNSIGNED NULL, | ||
| 111 | + origWidth SMALLINT UNSIGNED NOT NULL, | ||
| 112 | + origHeight SMALLINT UNSIGNED NOT NULL, | ||
| 113 | + trade ENUM('download', | ||
| 114 | + 'buy') NOT NULL default 'download', | ||
| 115 | + createDate TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP(), | ||
| 116 | + `lock` BOOLEAN NOT NULL DEFAULT FALSE, | ||
| 117 | + | ||
| 118 | + PRIMARY KEY (pictureId), | ||
| 119 | + CONSTRAINT FOREIGN KEY (title) | ||
| 120 | + REFERENCES i18n (textId) | ||
| 121 | + ON UPDATE CASCADE | ||
| 122 | + ON DELETE SET NULL, | ||
| 123 | + CONSTRAINT FOREIGN KEY (photographerId) | ||
| 124 | + REFERENCES photographer (photographerId) | ||
| 125 | + ON UPDATE CASCADE | ||
| 126 | + ON DELETE SET NULL, | ||
| 127 | + CONSTRAINT FOREIGN KEY (ownerId) | ||
| 128 | + REFERENCES owner (ownerId) | ||
| 129 | + ON UPDATE CASCADE | ||
| 130 | + ON DELETE SET NULL | ||
| 131 | +); | ||
| 132 | + | ||
| 133 | +CREATE TABLE pictureDetail | ||
| 134 | +( | ||
| 135 | + pictureId BIGINT UNSIGNED NOT NULL, | ||
| 136 | + textId BIGINT UNSIGNED NOT NULL, | ||
| 137 | + ident VARCHAR(30) NOT NULL DEFAULT "", | ||
| 138 | + | ||
| 139 | + PRIMARY KEY (pictureId, textId), | ||
| 140 | + UNIQUE KEY (pictureId,ident), | ||
| 141 | + CONSTRAINT FOREIGN KEY (pictureId) | ||
| 142 | + REFERENCES picture (pictureId) | ||
| 143 | + ON UPDATE CASCADE | ||
| 144 | + ON DELETE CASCADE, | ||
| 145 | + CONSTRAINT FOREIGN KEY (textId) | ||
| 146 | + REFERENCES i18n (textId) | ||
| 147 | + ON UPDATE CASCADE | ||
| 148 | + ON DELETE CASCADE | ||
| 149 | +); | ||
| 150 | + | ||
| 151 | +CREATE TABLE pictureLog | ||
| 152 | +( | ||
| 153 | + pictureId BIGINT UNSIGNED NOT NULL, | ||
| 154 | + `date` DATE NOT NULL, | ||
| 155 | + views BIGINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 156 | + downloads BIGINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 157 | + downlSize BIGINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 158 | + brokeDownl BIGINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 159 | + brokeSize BIGINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 160 | + | ||
| 161 | + PRIMARY KEY (pictureId,`date`), | ||
| 162 | + CONSTRAINT FOREIGN KEY (pictureId) | ||
| 163 | + REFERENCES picture (pictureId) | ||
| 164 | + ON UPDATE CASCADE | ||
| 165 | + ON DELETE CASCADE | ||
| 166 | +); | ||
| 167 | + | ||
| 168 | +CREATE TRIGGER picLogDateDefault_t | ||
| 169 | +BEFORE INSERT ON pictureLog | ||
| 170 | +FOR EACH ROW | ||
| 171 | + SET NEW.`date` = CURDATE (); | ||
| 172 | + | ||
| 173 | +CREATE TABLE picture_format | ||
| 174 | +( | ||
| 175 | + pictureId BIGINT UNSIGNED NOT NULL, | ||
| 176 | + formatId BIGINT UNSIGNED NOT NULL, | ||
| 177 | + | ||
| 178 | + PRIMARY KEY (pictureId,formatId), | ||
| 179 | + CONSTRAINT FOREIGN KEY (pictureId) | ||
| 180 | + REFERENCES picture (pictureId) | ||
| 181 | + ON UPDATE CASCADE | ||
| 182 | + ON DELETE CASCADE, | ||
| 183 | + CONSTRAINT FOREIGN KEY (formatId) | ||
| 184 | + REFERENCES format (formatId) | ||
| 185 | + ON UPDATE CASCADE | ||
| 186 | + ON DELETE CASCADE | ||
| 187 | +); | ||
| 188 | + | ||
| 189 | +CREATE TABLE location | ||
| 190 | +( | ||
| 191 | + locationId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 192 | + zip VARCHAR(5) NULL, | ||
| 193 | + city VARCHAR(30) NULL, | ||
| 194 | + street VARCHAR(30) NULL, | ||
| 195 | + hno VARCHAR(5) NULL, | ||
| 196 | + name VARCHAR(30) NULL, | ||
| 197 | + | ||
| 198 | + PRIMARY KEY (locationId), | ||
| 199 | + UNIQUE KEY (zip,city,street,hno) | ||
| 200 | +); | ||
| 201 | + | ||
| 202 | +CREATE TABLE section | ||
| 203 | +( | ||
| 204 | + sectionId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 205 | + title BIGINT UNSIGNED NULL, | ||
| 206 | + locationId BIGINT UNSIGNED NULL, | ||
| 207 | + `lock` BOOLEAN NOT NULL DEFAULT FALSE, | ||
| 208 | + | ||
| 209 | + PRIMARY KEY (sectionId), | ||
| 210 | + CONSTRAINT FOREIGN KEY (title) | ||
| 211 | + REFERENCES i18n (textId) | ||
| 212 | + ON UPDATE CASCADE | ||
| 213 | + ON DELETE SET NULL, | ||
| 214 | + CONSTRAINT FOREIGN KEY (locationId) | ||
| 215 | + REFERENCES location (locationId) | ||
| 216 | + ON UPDATE CASCADE | ||
| 217 | + ON DELETE SET NULL | ||
| 218 | +); | ||
| 219 | + | ||
| 220 | +CREATE TABLE sectionDetail | ||
| 221 | +( | ||
| 222 | + sectionId BIGINT UNSIGNED NOT NULL, | ||
| 223 | + textId BIGINT UNSIGNED NOT NULL, | ||
| 224 | + ident VARCHAR(30) NOT NULL DEFAULT "", | ||
| 225 | + | ||
| 226 | + PRIMARY KEY (sectionId, textId), | ||
| 227 | + UNIQUE KEY (sectionId,ident), | ||
| 228 | + CONSTRAINT FOREIGN KEY (sectionId) | ||
| 229 | + REFERENCES section (sectionId) | ||
| 230 | + ON UPDATE CASCADE | ||
| 231 | + ON DELETE CASCADE, | ||
| 232 | + CONSTRAINT FOREIGN KEY (textId) | ||
| 233 | + REFERENCES i18n (textId) | ||
| 234 | + ON UPDATE CASCADE | ||
| 235 | + ON DELETE CASCADE | ||
| 236 | +); | ||
| 237 | + | ||
| 238 | +CREATE TABLE picture_section | ||
| 239 | +( | ||
| 240 | + pictureId BIGINT UNSIGNED NOT NULL, | ||
| 241 | + sectionId BIGINT UNSIGNED NOT NULL, | ||
| 242 | + validFrom TIMESTAMP NULL, | ||
| 243 | + validTo TIMESTAMP NULL, | ||
| 244 | + prio SMALLINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 245 | + | ||
| 246 | + PRIMARY KEY (pictureId,sectionId), | ||
| 247 | + CONSTRAINT FOREIGN KEY (pictureId) | ||
| 248 | + REFERENCES picture (pictureId) | ||
| 249 | + ON UPDATE CASCADE | ||
| 250 | + ON DELETE CASCADE, | ||
| 251 | + CONSTRAINT FOREIGN KEY (sectionId) | ||
| 252 | + REFERENCES section (sectionId) | ||
| 253 | + ON UPDATE CASCADE | ||
| 254 | + ON DELETE CASCADE | ||
| 255 | +); | ||
| 256 | + | ||
| 257 | +CREATE PROCEDURE lockEmptySection (IN oldId BIGINT(20)) | ||
| 258 | + UPDATE section SET `lock` = TRUE | ||
| 259 | + WHERE | ||
| 260 | + sectionId IN ( | ||
| 261 | + SELECT sectionId | ||
| 262 | + FROM picture_section | ||
| 263 | + INNER JOIN picture USING (pictureId) | ||
| 264 | + WHERE `lock` = FALSE | ||
| 265 | + GROUP BY sectionId | ||
| 266 | + HAVING | ||
| 267 | + COUNT(*) = 1 AND | ||
| 268 | + MAX(pictureId) = oldId); | ||
| 269 | + | ||
| 270 | +CREATE TRIGGER lockEmptySectionD_t | ||
| 271 | +BEFORE DELETE ON picture | ||
| 272 | +FOR EACH ROW | ||
| 273 | + CALL lockEmptySection (OLD.pictureId); | ||
| 274 | + | ||
| 275 | +CREATE TRIGGER lockEmptySectionU_t | ||
| 276 | +BEFORE UPDATE ON picture | ||
| 277 | +FOR EACH ROW | ||
| 278 | + CALL lockEmptySection (OLD.pictureId); | ||
| 279 | + | ||
| 280 | +CREATE TABLE gallery | ||
| 281 | +( | ||
| 282 | + galleryId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 283 | + title BIGINT UNSIGNED NULL, | ||
| 284 | + creator BIGINT UNSIGNED NOT NULL, | ||
| 285 | + createDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), | ||
| 286 | + `lock` BOOLEAN NOT NULL DEFAULT FALSE, | ||
| 287 | + | ||
| 288 | + PRIMARY KEY (galleryId), | ||
| 289 | + UNIQUE KEY (creator,createDate), | ||
| 290 | + CONSTRAINT FOREIGN KEY (title) | ||
| 291 | + REFERENCES i18n (textId) | ||
| 292 | + ON UPDATE CASCADE | ||
| 293 | + ON DELETE SET NULL, | ||
| 294 | + CONSTRAINT FOREIGN KEY (creator) | ||
| 295 | + REFERENCES person (personId) | ||
| 296 | + ON UPDATE CASCADE | ||
| 297 | +); | ||
| 298 | + | ||
| 299 | +CREATE TABLE galleryDetail | ||
| 300 | +( | ||
| 301 | + galleryId BIGINT UNSIGNED NOT NULL, | ||
| 302 | + textId BIGINT UNSIGNED NOT NULL, | ||
| 303 | + ident VARCHAR(30) NOT NULL DEFAULT "", | ||
| 304 | + | ||
| 305 | + PRIMARY KEY (galleryId, textId), | ||
| 306 | + UNIQUE KEY (galleryId,ident), | ||
| 307 | + CONSTRAINT FOREIGN KEY (galleryId) | ||
| 308 | + REFERENCES gallery (galleryId) | ||
| 309 | + ON UPDATE CASCADE | ||
| 310 | + ON DELETE CASCADE, | ||
| 311 | + CONSTRAINT FOREIGN KEY (textId) | ||
| 312 | + REFERENCES i18n (textId) | ||
| 313 | + ON UPDATE CASCADE | ||
| 314 | + ON DELETE CASCADE | ||
| 315 | +); | ||
| 316 | + | ||
| 317 | +CREATE TABLE section_gallery | ||
| 318 | +( | ||
| 319 | + sectionId BIGINT UNSIGNED NOT NULL, | ||
| 320 | + galleryId BIGINT UNSIGNED NOT NULL, | ||
| 321 | + validFrom TIMESTAMP NULL, | ||
| 322 | + validTo TIMESTAMP NULL, | ||
| 323 | + prio SMALLINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 324 | + | ||
| 325 | + PRIMARY KEY (sectionId,galleryId), | ||
| 326 | + CONSTRAINT FOREIGN KEY (sectionId) | ||
| 327 | + REFERENCES section (sectionId) | ||
| 328 | + ON UPDATE CASCADE | ||
| 329 | + ON DELETE CASCADE, | ||
| 330 | + CONSTRAINT FOREIGN KEY (galleryId) | ||
| 331 | + REFERENCES gallery (galleryId) | ||
| 332 | + ON UPDATE CASCADE | ||
| 333 | + ON DELETE CASCADE | ||
| 334 | +); | ||
| 335 | + | ||
| 336 | +CREATE PROCEDURE lockEmptyGallery (IN oldId BIGINT(20)) | ||
| 337 | + UPDATE gallery SET `lock` = TRUE | ||
| 338 | + WHERE | ||
| 339 | + galleryId IN ( | ||
| 340 | + SELECT galleryId | ||
| 341 | + FROM section_gallery | ||
| 342 | + INNER JOIN section USING (sectionId) | ||
| 343 | + WHERE `lock` = FALSE | ||
| 344 | + GROUP BY galleryId | ||
| 345 | + HAVING | ||
| 346 | + COUNT(*) = 1 AND | ||
| 347 | + MAX(sectionId) = oldId); | ||
| 348 | + | ||
| 349 | +CREATE TRIGGER lockEmptyGalleryD_t | ||
| 350 | +BEFORE DELETE ON section | ||
| 351 | +FOR EACH ROW | ||
| 352 | + CALL lockEmptyGallery (OLD.sectionId); | ||
| 353 | + | ||
| 354 | +CREATE TRIGGER lockEmptyGalleryU_t | ||
| 355 | +BEFORE UPDATE ON section | ||
| 356 | +FOR EACH ROW | ||
| 357 | + CALL lockEmptyGallery (OLD.sectionId); | ||
| 358 | + | ||
| 359 | +CREATE TABLE template | ||
| 360 | +( | ||
| 361 | + templateId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 362 | + name VARCHAR(100) NOT NULL, | ||
| 363 | + | ||
| 364 | + PRIMARY KEY (templateId), | ||
| 365 | + UNIQUE KEY (name) | ||
| 366 | +); | ||
| 367 | + | ||
| 368 | +CREATE TABLE category | ||
| 369 | +( | ||
| 370 | + categoryId BIGINT UNSIGNED NOT NULL auto_increment, | ||
| 371 | + title BIGINT UNSIGNED NULL, | ||
| 372 | + templateId BIGINT UNSIGNED NOT NULL, | ||
| 373 | + `lock` BOOLEAN NOT NULL DEFAULT FALSE, | ||
| 374 | + | ||
| 375 | + PRIMARY KEY (categoryId), | ||
| 376 | + CONSTRAINT FOREIGN KEY (title) | ||
| 377 | + REFERENCES i18n (textId) | ||
| 378 | + ON UPDATE CASCADE | ||
| 379 | + ON DELETE SET NULL, | ||
| 380 | + CONSTRAINT FOREIGN KEY (templateId) | ||
| 381 | + REFERENCES template (templateId) | ||
| 382 | + ON UPDATE CASCADE | ||
| 383 | +); | ||
| 384 | + | ||
| 385 | +CREATE TABLE categoryDetail | ||
| 386 | +( | ||
| 387 | + categoryId BIGINT UNSIGNED NOT NULL, | ||
| 388 | + textId BIGINT UNSIGNED NOT NULL, | ||
| 389 | + ident VARCHAR(30) NOT NULL DEFAULT "", | ||
| 390 | + | ||
| 391 | + PRIMARY KEY (categoryId, textId), | ||
| 392 | + UNIQUE KEY (categoryId,ident), | ||
| 393 | + CONSTRAINT FOREIGN KEY (categoryId) | ||
| 394 | + REFERENCES category (categoryId) | ||
| 395 | + ON UPDATE CASCADE | ||
| 396 | + ON DELETE CASCADE, | ||
| 397 | + CONSTRAINT FOREIGN KEY (textId) | ||
| 398 | + REFERENCES i18n (textId) | ||
| 399 | + ON UPDATE CASCADE | ||
| 400 | + ON DELETE CASCADE | ||
| 401 | +); | ||
| 402 | + | ||
| 403 | +CREATE TABLE gallery_category | ||
| 404 | +( | ||
| 405 | + galleryId BIGINT UNSIGNED NOT NULL, | ||
| 406 | + categoryId BIGINT UNSIGNED NOT NULL, | ||
| 407 | + validFrom TIMESTAMP NULL, | ||
| 408 | + validTo TIMESTAMP NULL, | ||
| 409 | + prio SMALLINT UNSIGNED NOT NULL DEFAULT 0, | ||
| 410 | + | ||
| 411 | + PRIMARY KEY (galleryId,categoryId), | ||
| 412 | + CONSTRAINT FOREIGN KEY (galleryId) | ||
| 413 | + REFERENCES gallery (galleryId) | ||
| 414 | + ON UPDATE CASCADE | ||
| 415 | + ON DELETE CASCADE, | ||
| 416 | + CONSTRAINT FOREIGN KEY (categoryId) | ||
| 417 | + REFERENCES category (categoryId) | ||
| 418 | + ON UPDATE CASCADE | ||
| 419 | + ON DELETE CASCADE | ||
| 420 | +); | ||
| 421 | + | ||
| 422 | +CREATE TABLE subCategory | ||
| 423 | +( | ||
| 424 | + categoryId BIGINT UNSIGNED NOT NULL, | ||
| 425 | + subId BIGINT UNSIGNED NOT NULL, | ||
| 426 | + | ||
| 427 | + PRIMARY KEY (categoryId,subId), | ||
| 428 | + CONSTRAINT FOREIGN KEY (categoryId) | ||
| 429 | + REFERENCES category (categoryId) | ||
| 430 | + ON UPDATE CASCADE | ||
| 431 | + ON DELETE CASCADE, | ||
| 432 | + CONSTRAINT FOREIGN KEY (subId) | ||
| 433 | + REFERENCES category (categoryId) | ||
| 434 | + ON UPDATE CASCADE | ||
| 435 | + ON DELETE CASCADE | ||
| 436 | +); | ||
| 437 | + | ||
| 438 | +CREATE VIEW i18nView AS | ||
| 439 | + SELECT | ||
| 440 | + textId, languageCode, countryCode, text | ||
| 441 | + FROM i18n _1 | ||
| 442 | + INNER JOIN language ON language = languageId; | ||
| 443 | + | ||
| 444 | +DELIMITER // | ||
| 445 | +CREATE FUNCTION gettextFunc (tId BIGINT(20)) | ||
| 446 | +RETURNS TEXT | ||
| 447 | +READS SQL DATA | ||
| 448 | +COMMENT 'This function nees the Variable @LANG set to the current locale.' | ||
| 449 | +BEGIN | ||
| 450 | + DECLARE lText TEXT; | ||
| 451 | + DECLARE lc VARCHAR(3); | ||
| 452 | + DECLARE cc VARCHAR(2); | ||
| 453 | + | ||
| 454 | + SET lc = SUBSTRING(@LANG, 1, | ||
| 455 | + CASE LOCATE('_', @LANG) | ||
| 456 | + WHEN 0 THEN CHAR_LENGTH(@LANG) | ||
| 457 | + ELSE LOCATE('_', @LANG)-1 | ||
| 458 | + END); | ||
| 459 | + SET lc = CASE WHEN lc IS NOT NULL THEN lc ELSE 'en' END; | ||
| 460 | + | ||
| 461 | + SET cc = SUBSTR(@LANG, | ||
| 462 | + CASE LOCATE('_', @LANG) | ||
| 463 | + WHEN 0 THEN NULL | ||
| 464 | + ELSE LOCATE('_', @LANG)+1 | ||
| 465 | + END); | ||
| 466 | + | ||
| 467 | + SELECT `text` INTO lText | ||
| 468 | + FROM i18nView | ||
| 469 | + WHERE | ||
| 470 | + textId = tId AND | ||
| 471 | + languageCode = lc AND | ||
| 472 | + countryCode = cc; | ||
| 473 | + IF lText IS NULL THEN | ||
| 474 | + SELECT `text` INTO lText | ||
| 475 | + FROM i18nView | ||
| 476 | + WHERE | ||
| 477 | + textId = tId AND | ||
| 478 | + languageCode = lc AND | ||
| 479 | + countryCode IS NULL; | ||
| 480 | + END If; | ||
| 481 | + IF lText IS NULL THEN | ||
| 482 | + SELECT `text` INTO lText | ||
| 483 | + FROM i18nView | ||
| 484 | + WHERE | ||
| 485 | + textId = tId AND | ||
| 486 | + languageCode = 'en' AND | ||
| 487 | + countryCode IS NULL ; | ||
| 488 | + END If; | ||
| 489 | + | ||
| 490 | + RETURN lText; | ||
| 491 | +END// | ||
| 492 | +DELIMITER ; | ||
| 493 | + | ||
| 494 | +CREATE VIEW personsView AS | ||
| 495 | + SELECT | ||
| 496 | + personId, photographerId, ownerId, | ||
| 497 | + firstname, surname, company, email, url, cameraId, | ||
| 498 | + width AS wmWidth, height AS wmHeight, xpos AS wmXPos, ypos AS wmYPos | ||
| 499 | + FROM person | ||
| 500 | + LEFT JOIN photographer USING (personId) | ||
| 501 | + LEFT JOIN owner USING (personId) | ||
| 502 | + LEFT JOIN watermark USING (watermarkId); | ||
| 503 | + | ||
| 504 | +CREATE VIEW photographerView AS | ||
| 505 | + SELECT | ||
| 506 | + photographerId, | ||
| 507 | + firstname AS pFirstname, surname AS pSurname, company AS pCompany, | ||
| 508 | + email AS pEmail, url AS pUrl, cameraId | ||
| 509 | + FROM photographer | ||
| 510 | + LEFT JOIN person USING (personId); | ||
| 511 | + | ||
| 512 | +CREATE VIEW ownerView AS | ||
| 513 | + SELECT | ||
| 514 | + ownerId, | ||
| 515 | + firstname AS oFirstname, surname AS oSurname, company AS oCompany, | ||
| 516 | + email AS oEmail, url AS oUrl, | ||
| 517 | + width AS wmWidth, height AS wmHeight, xpos AS wmXPos, ypos AS wmYPos | ||
| 518 | + FROM owner | ||
| 519 | + LEFT JOIN person USING (personId) | ||
| 520 | + LEFT JOIN watermark USING (watermarkId); | ||
| 521 | + | ||
| 522 | +CREATE VIEW picturesView AS | ||
| 523 | + SELECT | ||
| 524 | + _1.pictureId, | ||
| 525 | + gettextFunc(title) AS pTitle, | ||
| 526 | + gettextFunc(textId) AS pDetails, ident AS pDetailIdent, | ||
| 527 | + pFirstname, pSurname, pCompany, pEmail, pUrl, cameraId, | ||
| 528 | + oFirstname, oSurname, oCompany, oEmail, oUrl, | ||
| 529 | + wmWidth, wmHeight, wmXPos, wmYPos, | ||
| 530 | + origWidth, origHeight, trade, createDate AS pCreateDate, | ||
| 531 | + width, height, quality, | ||
| 532 | + `date` AS vDate, views, downloads, downlSize, brokeDownl, brokeSize | ||
| 533 | + FROM picture _1 | ||
| 534 | + LEFT JOIN pictureDetail USING (pictureId) | ||
| 535 | + LEFT JOIN photographerView USING (photographerId) | ||
| 536 | + LEFT JOIN ownerView USING (ownerId) | ||
| 537 | + LEFT JOIN pictureLog USING (pictureId) | ||
| 538 | + INNER JOIN picture_format _2 ON | ||
| 539 | + _1.pictureId = _2.pictureId AND | ||
| 540 | + _1.`lock` = FALSE | ||
| 541 | + INNER JOIN format USING (formatId); | ||
| 542 | + | ||
| 543 | +CREATE VIEW pictureCountsSumView AS | ||
| 544 | + SELECT | ||
| 545 | + pictureId, pTitle, pDetails, pDetailIdent, | ||
| 546 | + pFirstname, pSurname, pCompany, pEmail, pUrl, cameraId, | ||
| 547 | + oFirstname, oSurname, oCompany, oEmail, oUrl, | ||
| 548 | + wmWidth, wmHeight, wmXPos, wmYPos, | ||
| 549 | + origWidth, origHeight, trade, pCreateDate, width, height, quality, | ||
| 550 | + CAST(SUM(views) AS UNSIGNED) AS views, | ||
| 551 | + CAST(SUM(downloads) AS UNSIGNED) AS downloads, | ||
| 552 | + CAST(SUM(downlSize) AS UNSIGNED) AS downlSize, | ||
| 553 | + CAST(SUM(brokeDownl) AS UNSIGNED) AS brokeDownl, | ||
| 554 | + CAST(SUM(brokeSize) AS UNSIGNED) AS brokeSize | ||
| 555 | + FROM picturesView | ||
| 556 | + GROUP BY | ||
| 557 | + pictureId, pTitle, pDetails, pDetailIdent, | ||
| 558 | + pCreateDate, origWidth, origHeight, trade, width, height, quality, | ||
| 559 | + pFirstname, pSurname, pCompany, pEmail, pUrl, cameraId, | ||
| 560 | + oFirstname, oSurname, oCompany, oEmail, oUrl, | ||
| 561 | + wmWidth, wmHeight, wmXPos, wmYPos; | ||
| 562 | + | ||
| 563 | +CREATE VIEW sectionsView AS | ||
| 564 | + SELECT | ||
| 565 | + sectionId, gettextFunc(title) AS sTitle, | ||
| 566 | + gettextFunc(_3.textId) AS sDetails, _3.ident AS sDetailIdent, | ||
| 567 | + zip, city, street, hno | ||
| 568 | + FROM section _1 | ||
| 569 | + LEFT JOIN location _2 USING (locationId) | ||
| 570 | + LEFT JOIN sectionDetail _3 USING (sectionId) | ||
| 571 | + WHERE | ||
| 572 | + _1.`lock` = FALSE; | ||
| 573 | + | ||
| 574 | +CREATE VIEW sectionPicturesView AS | ||
| 575 | + SELECT | ||
| 576 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 577 | + zip, city, street, hno, | ||
| 578 | + pictureId, pTitle, pDetails, pDetailIdent, | ||
| 579 | + pFirstname, pSurname, pCompany, pEmail, pUrl, cameraId, | ||
| 580 | + oFirstname, oSurname, oCompany, oEmail, oUrl, | ||
| 581 | + wmWidth, wmHeight, wmXPos, wmYPos, | ||
| 582 | + origWidth, origHeight, trade, pCreateDate, width, height, quality, | ||
| 583 | + vDate, views, downloads, downlSize, brokeDownl, brokeSize | ||
| 584 | + FROM sectionsView | ||
| 585 | + INNER JOIN picture_section USING (sectionId) | ||
| 586 | + INNER JOIN picturesView USING (pictureId); | ||
| 587 | + | ||
| 588 | +CREATE VIEW sectionCountsView AS | ||
| 589 | + SELECT | ||
| 590 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 591 | + zip, city, street, hno, vDate, | ||
| 592 | + CAST(SUM(views) AS UNSIGNED) AS views, | ||
| 593 | + CAST(SUM(downloads) AS UNSIGNED) AS downloads, | ||
| 594 | + CAST(SUM(downlSize) AS UNSIGNED) AS downlSize, | ||
| 595 | + CAST(SUM(brokeDownl) AS UNSIGNED) AS brokeDownl, | ||
| 596 | + CAST(SUM(brokeSize) AS UNSIGNED) AS brokeSize | ||
| 597 | + FROM sectionPicturesView | ||
| 598 | + GROUP BY | ||
| 599 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 600 | + zip, city, street, hno, vDate; | ||
| 601 | + | ||
| 602 | +CREATE VIEW sectionCountsSumView AS | ||
| 603 | + SELECT | ||
| 604 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 605 | + zip, city, street, hno, | ||
| 606 | + CAST(SUM(views) AS UNSIGNED) AS views, | ||
| 607 | + CAST(SUM(downloads) AS UNSIGNED) AS downloads, | ||
| 608 | + CAST(SUM(downlSize) AS UNSIGNED) AS downlSize, | ||
| 609 | + CAST(SUM(brokeDownl) AS UNSIGNED) AS brokeDownl, | ||
| 610 | + CAST(SUM(brokeSize) AS UNSIGNED) AS brokeSize | ||
| 611 | + FROM sectionPicturesView | ||
| 612 | + GROUP BY | ||
| 613 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 614 | + zip, city, street, hno; | ||
| 615 | + | ||
| 616 | +CREATE VIEW galleriesView AS | ||
| 617 | + SELECT | ||
| 618 | + galleryId, | ||
| 619 | + gettextFunc(title) AS gTitle, | ||
| 620 | + gettextFunc(_4.textId) AS gDetails, _4.ident AS gDetailIdent, | ||
| 621 | + createDate AS sCreateDate, | ||
| 622 | + creator, firstname AS cFirstname, surname AS cSurname, | ||
| 623 | + company AS cCompany, email AS cEmail, url AS cUrl | ||
| 624 | + FROM gallery _1 | ||
| 625 | + INNER JOIN person _2 ON | ||
| 626 | + _1.creator = _2.personId AND | ||
| 627 | + _1.`lock` = FALSE | ||
| 628 | + LEFT JOIN galleryDetail _4 USING (galleryId); | ||
| 629 | + | ||
| 630 | +CREATE VIEW galleryPicturesView AS | ||
| 631 | + SELECT | ||
| 632 | + galleryId, gTitle, gDetails, gDetailIdent, | ||
| 633 | + sCreateDate, creator, cFirstname, cSurname, cCompany, cEmail, cUrl, | ||
| 634 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 635 | + zip, city, street, hno, | ||
| 636 | + pictureId, pTitle, pDetails, pDetailIdent, | ||
| 637 | + pFirstname, pSurname, pCompany, pEmail, pUrl, cameraId, | ||
| 638 | + oFirstname, oSurname, oCompany, oEmail, oUrl, | ||
| 639 | + wmWidth, wmHeight, wmXPos, wmYPos, | ||
| 640 | + origWidth, origHeight, trade, pCreateDate, width, height, quality, | ||
| 641 | + vDate, views, downloads, downlSize, brokeDownl, brokeSize | ||
| 642 | + FROM galleriesView _1 | ||
| 643 | + INNER JOIN section_gallery _2 USING (galleryId) | ||
| 644 | + INNER JOIN sectionPicturesView _3 USING (sectionId); | ||
| 645 | + | ||
| 646 | +CREATE VIEW galleryCountsView AS | ||
| 647 | + SELECT | ||
| 648 | + galleryId, gTitle, gDetails, gDetailIdent, sCreateDate, | ||
| 649 | + creator, cFirstname, cSurname, cCompany, cEmail, cUrl, vDate, | ||
| 650 | + CAST(SUM(views) AS UNSIGNED) AS views, | ||
| 651 | + CAST(SUM(downloads) AS UNSIGNED) AS downloads, | ||
| 652 | + CAST(SUM(downlSize) AS UNSIGNED) AS downlSize, | ||
| 653 | + CAST(SUM(brokeDownl) AS UNSIGNED) AS brokeDownl, | ||
| 654 | + CAST(SUM(brokeSize) AS UNSIGNED) AS brokeSize | ||
| 655 | + FROM galleryPicturesView | ||
| 656 | + GROUP BY | ||
| 657 | + galleryId, gTitle, gDetails, gDetailIdent, sCreateDate, | ||
| 658 | + creator, cFirstname, cSurname, cCompany, cEmail, cUrl, vDate; | ||
| 659 | + | ||
| 660 | +CREATE VIEW galleryCountsSumView AS | ||
| 661 | + SELECT | ||
| 662 | + galleryId, gTitle, gDetails, gDetailIdent, sCreateDate, | ||
| 663 | + creator, cFirstname, cSurname, cCompany, cEmail, cUrl, | ||
| 664 | + CAST(SUM(views) AS UNSIGNED) AS views, | ||
| 665 | + CAST(SUM(downloads) AS UNSIGNED) AS downloads, | ||
| 666 | + CAST(SUM(downlSize) AS UNSIGNED) AS downlSize, | ||
| 667 | + CAST(SUM(brokeDownl) AS UNSIGNED) AS brokeDownl, | ||
| 668 | + CAST(SUM(brokeSize) AS UNSIGNED) AS brokeSize | ||
| 669 | + FROM galleryPicturesView | ||
| 670 | + GROUP BY | ||
| 671 | + galleryId, gTitle, gDetails, gDetailIdent, sCreateDate, | ||
| 672 | + creator, cFirstname, cSurname, cCompany, cEmail, cUrl; | ||
| 673 | + | ||
| 674 | +CREATE VIEW gallerySectionsView AS | ||
| 675 | + SELECT | ||
| 676 | + galleryId, gTitle, gDetails, gDetailIdent, | ||
| 677 | + sCreateDate, creator, cFirstname, cSurname, cCompany, cEmail, cUrl, | ||
| 678 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 679 | + zip, city, street, hno | ||
| 680 | + FROM galleriesView _1 | ||
| 681 | + INNER JOIN section_gallery _2 USING (galleryId) | ||
| 682 | + INNER JOIN sectionsView _3 USING (sectionId); | ||
| 683 | + | ||
| 684 | +CREATE VIEW categoriesView AS | ||
| 685 | + SELECT | ||
| 686 | + categoryId, | ||
| 687 | + gettextFunc(title) AS cTitle, | ||
| 688 | + gettextFunc(_5.textId) AS cDetails, _5.ident AS cDetailIdent, | ||
| 689 | + _2.templateId, _2.name AS templateName, | ||
| 690 | + _4.subId | ||
| 691 | + FROM category _1 | ||
| 692 | + INNER JOIN template _2 ON | ||
| 693 | + _1.templateId = _2.templateId AND | ||
| 694 | + _1.`lock` = FALSE | ||
| 695 | + LEFT JOIN categoryDetail _5 USING (categoryId) | ||
| 696 | + LEFT JOIN subCategory _4 USING (categoryId); | ||
| 697 | + | ||
| 698 | +CREATE VIEW catPicturesView AS | ||
| 699 | + SELECT | ||
| 700 | + categoryId, cTitle, cDetails, cDetailIdent, | ||
| 701 | + templateId, templateName, subId, | ||
| 702 | + galleryId, gTitle, gDetails, gDetailIdent, | ||
| 703 | + sCreateDate, creator, cFirstname, cSurname, cCompany, cEmail, cUrl, | ||
| 704 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 705 | + zip, city, street, hno, | ||
| 706 | + pictureId, pTitle, pDetails, pDetailIdent, | ||
| 707 | + origWidth, origHeight, trade, pCreateDate, width, height, quality, | ||
| 708 | + pFirstname, pSurname, pCompany, pEmail, pUrl, cameraId, | ||
| 709 | + oFirstname, oSurname, oCompany, oEmail, oUrl, | ||
| 710 | + wmWidth, wmHeight, wmXPos, wmYPos, | ||
| 711 | + vDate, views, downloads, downlSize, brokeDownl, brokeSize | ||
| 712 | + FROM categoriesView | ||
| 713 | + INNER JOIN gallery_category USING (categoryId) | ||
| 714 | + INNER JOIN galleryPicturesView USING (galleryId); | ||
| 715 | + | ||
| 716 | +CREATE VIEW categoryCountsView AS | ||
| 717 | + SELECT | ||
| 718 | + categoryId, cTitle, cDetails, cDetailIdent, | ||
| 719 | + templateId, templateName, subId, vDate, | ||
| 720 | + CAST(SUM(views) AS UNSIGNED) AS views, | ||
| 721 | + CAST(SUM(downloads) AS UNSIGNED) AS downloads, | ||
| 722 | + CAST(SUM(downlSize) AS UNSIGNED) AS downlSize, | ||
| 723 | + CAST(SUM(brokeDownl) AS UNSIGNED) AS brokeDownl, | ||
| 724 | + CAST(SUM(brokeSize) AS UNSIGNED) AS brokeSize | ||
| 725 | + FROM catPicturesView | ||
| 726 | + GROUP BY | ||
| 727 | + categoryId, cTitle, cDetails, cDetailIdent, | ||
| 728 | + templateId, templateName, subId, vDate; | ||
| 729 | + | ||
| 730 | +CREATE VIEW categoryCountsSumView AS | ||
| 731 | + SELECT | ||
| 732 | + categoryId, cTitle, cDetails, cDetailIdent, | ||
| 733 | + templateId, templateName, subId, | ||
| 734 | + CAST(SUM(views) AS UNSIGNED) AS views, | ||
| 735 | + CAST(SUM(downloads) AS UNSIGNED) AS downloads, | ||
| 736 | + CAST(SUM(downlSize) AS UNSIGNED) AS downlSize, | ||
| 737 | + CAST(SUM(brokeDownl) AS UNSIGNED) AS brokeDownl, | ||
| 738 | + CAST(SUM(brokeSize) AS UNSIGNED) AS brokeSize | ||
| 739 | + FROM catPicturesView | ||
| 740 | + GROUP BY | ||
| 741 | + categoryId, cTitle, cDetails, cDetailIdent, | ||
| 742 | + templateId, templateName, subId; | ||
| 743 | + | ||
| 744 | +CREATE VIEW catSectionsView AS | ||
| 745 | + SELECT | ||
| 746 | + categoryId, cTitle, cDetails, cDetailIdent, | ||
| 747 | + templateId, templateName, subId, | ||
| 748 | + galleryId, gTitle, gDetails, gDetailIdent, | ||
| 749 | + sCreateDate, creator, cFirstname, cSurname, cCompany, cEmail, cUrl, | ||
| 750 | + sectionId, sTitle, sDetails, sDetailIdent, | ||
| 751 | + zip, city, street, hno | ||
| 752 | + FROM categoriesView | ||
| 753 | + INNER JOIN gallery_category USING (categoryId) | ||
| 754 | + INNER JOIN gallerySectionsView USING (galleryId); | ||
| 755 | + | ||
| 756 | +CREATE VIEW catGalleriesView AS | ||
| 757 | + SELECT | ||
| 758 | + categoryId, cTitle, cDetails, cDetailIdent, | ||
| 759 | + templateId, templateName, subId, | ||
| 760 | + galleryId, gTitle, gDetails, gDetailIdent, | ||
| 761 | + sCreateDate, creator, cFirstname, cSurname, cCompany, cEmail, cUrl | ||
| 762 | + FROM categoriesView | ||
| 763 | + INNER JOIN gallery_category USING (categoryId) | ||
| 764 | + INNER JOIN galleriesView USING (galleryId); | ||
| 765 | + | ||
| 766 | +DELIMITER // | ||
| 767 | +CREATE PROCEDURE updateOwner (IN pid BIGINT, | ||
| 768 | + IN _width SMALLINT UNSIGNED, IN _height SMALLINT UNSIGNED, | ||
| 769 | + IN _xpos SMALLINT, IN _ypos SMALLINT) | ||
| 770 | +BEGIN | ||
| 771 | + DECLARE wid, oid BIGINT DEFAULT NULL; | ||
| 772 | + | ||
| 773 | + IF _width IS NOT NULL AND _height IS NOT NULL AND | ||
| 774 | + _xpos IS NOT NULL AND _ypos IS NOT NULL | ||
| 775 | + THEN | ||
| 776 | + SELECT ownerId, watermarkId INTO oid, wid | ||
| 777 | + FROM owner | ||
| 778 | + WHERE personId = pid; | ||
| 779 | + | ||
| 780 | + IF oid IS NULL | ||
| 781 | + THEN | ||
| 782 | + SELECT watermarkId INTO wid | ||
| 783 | + FROM watermark | ||
| 784 | + WHERE | ||
| 785 | + height = _height AND | ||
| 786 | + width = _width AND | ||
| 787 | + xpos = _xpos AND | ||
| 788 | + ypos = _ypos; | ||
| 789 | + | ||
| 790 | + IF wid IS NULL | ||
| 791 | + THEN | ||
| 792 | + INSERT INTO watermark (width, height, xpos, ypos) | ||
| 793 | + VALUES (_width, _height, _xpos, _ypos); | ||
| 794 | + SELECT LAST_INSERT_ID() INTO wid; | ||
| 795 | + END IF; | ||
| 796 | + | ||
| 797 | + INSERT INTO owner (personId, watermarkId) | ||
| 798 | + VALUES (pid, wid); | ||
| 799 | + ELSE | ||
| 800 | + IF wid IS NULL | ||
| 801 | + THEN | ||
| 802 | + INSERT INTO watermark (width, height, xpos, ypos) | ||
| 803 | + VALUES (_width, _height, _xpos, _ypos); | ||
| 804 | + SELECT LAST_INSERT_ID() INTO wid; | ||
| 805 | + ELSE | ||
| 806 | + UPDATE watermark | ||
| 807 | + SET | ||
| 808 | + width = _width, | ||
| 809 | + height = _height, | ||
| 810 | + xpos = _xpos, | ||
| 811 | + ypos = _ypos | ||
| 812 | + WHERE watermarkId = wid; | ||
| 813 | + END IF; | ||
| 814 | + | ||
| 815 | + UPDATE owner | ||
| 816 | + SET watermarkId = wid | ||
| 817 | + WHERE ownerId = oid; | ||
| 818 | + END IF; | ||
| 819 | + END IF; | ||
| 820 | + | ||
| 821 | + SELECT oid, wid; | ||
| 822 | +END// | ||
| 823 | +DELIMITER ; | ||
| 824 | + | ||
| 825 | +DELIMITER // | ||
| 826 | +CREATE PROCEDURE updatePhotographer (IN pid BIGINT, IN _camId BIGINT) | ||
| 827 | +BEGIN | ||
| 828 | + DECLARE phid BIGINT DEFAULT NULL; | ||
| 829 | + | ||
| 830 | + IF _camId IS NOT NULL | ||
| 831 | + THEN | ||
| 832 | + SELECT photographerId INTO phid | ||
| 833 | + FROM photographer | ||
| 834 | + WHERE personId = pid; | ||
| 835 | + | ||
| 836 | + IF phid IS NULL | ||
| 837 | + THEN | ||
| 838 | + INSERT INTO photographer (personId, cameraId) | ||
| 839 | + VALUES (pid, _camId); | ||
| 840 | + SELECT LAST_INSERT_ID() INTO phid; | ||
| 841 | + ELSE | ||
| 842 | + UPDATE photographer | ||
| 843 | + SET cameraId = _camId | ||
| 844 | + WHERE photographerId = phid; | ||
| 845 | + END IF; | ||
| 846 | + END IF; | ||
| 847 | + | ||
| 848 | + SELECT phid; | ||
| 849 | +END// | ||
| 850 | +DELIMITER ; | ||
| 851 | + | ||
| 852 | +DELIMITER // | ||
| 853 | +CREATE PROCEDURE updatePerson (IN _firstname VARCHAR(30), | ||
| 854 | + IN _surname VARCHAR(30), IN _company VARCHAR(30), IN _email VARCHAR(30), | ||
| 855 | + IN _url VARCHAR(30), IN _camId BIGINT, | ||
| 856 | + IN _width SMALLINT UNSIGNED, IN _height SMALLINT UNSIGNED, | ||
| 857 | + IN _xpos SMALLINT, IN _ypos SMALLINT) | ||
| 858 | +BEGIN | ||
| 859 | + DECLARE pid BIGINT DEFAULT NULL; | ||
| 860 | + | ||
| 861 | + IF _firstname IS NOT NULL AND _surname IS NOT NULL | ||
| 862 | + THEN | ||
| 863 | + SELECT personId INTO pid | ||
| 864 | + FROM person | ||
| 865 | + WHERE | ||
| 866 | + UPPER(firstname) = UPPER(_firstname) AND | ||
| 867 | + UPPER(surname) = UPPER(_surname); | ||
| 868 | + | ||
| 869 | + IF pid IS NOT NULL | ||
| 870 | + THEN | ||
| 871 | + UPDATE person | ||
| 872 | + SET | ||
| 873 | + firstname = _firstname, | ||
| 874 | + surname = _surname, | ||
| 875 | + company = _company, | ||
| 876 | + email = _email, | ||
| 877 | + url = _url | ||
| 878 | + WHERE | ||
| 879 | + personId = pid; | ||
| 880 | + ELSE | ||
| 881 | + INSERT INTO person (firstname, surname, company, email, url) | ||
| 882 | + VALUES (_firstname, _surname, _company, _email, _url); | ||
| 883 | + SELECT LAST_INSERT_ID() INTO pid; | ||
| 884 | + END IF; | ||
| 885 | + | ||
| 886 | + CALL updateOwner (pid, _width, _height, _xpos, _ypos); | ||
| 887 | + CALL updatePhotographer (pid, _camId); | ||
| 888 | + END IF; | ||
| 889 | + | ||
| 890 | + SELECT pid; | ||
| 891 | +END// | ||
| 892 | +DELIMITER ; | ||
| 893 | + | ||
| 894 | +INSERT INTO language | ||
| 895 | + (languageCode, countryCode) | ||
| 896 | +VALUES | ||
| 897 | + ('de', NULL), | ||
| 898 | + ('de', 'DE'), | ||
| 899 | + ('en', NULL), | ||
| 900 | + ('en', 'GB'), | ||
| 901 | + ('en', 'US'); | ||
| 902 | + | ||
| 903 | +INSERT INTO person | ||
| 904 | + (firstname, surname) | ||
| 905 | +VALUES | ||
| 906 | + ('Elisabeth', 'Steffers'), | ||
| 907 | + ('Mechtild', 'Steffers'), | ||
| 908 | + ('Wilhelm', 'Steffers'), | ||
| 909 | + ('Markus', 'Engbers'), | ||
| 910 | + ('Jens', 'Rautenberg'), | ||
| 911 | + ('Achim', 'Krämer'), | ||
| 912 | + ('Lambert', 'Herrgesell'), | ||
| 913 | + ('Jochen', 'Bilek'), | ||
| 914 | + ('Holger', 'Böking'), | ||
| 915 | + ('Torsten', 'Böking'), | ||
| 916 | + ('Georg', 'Steffers'), | ||
| 917 | + ('Donald', 'von Entenhausen'), | ||
| 918 | + ('Dagobert', 'von Entenhausen'); | ||
| 919 | + | ||
| 920 | +INSERT INTO watermark | ||
| 921 | + (width, height, xpos, ypos) | ||
| 922 | +VALUES | ||
| 923 | + (22, 22, -5, -5); | ||
| 924 | + | ||
| 925 | +INSERT INTO photographer | ||
| 926 | + (personId, cameraId) | ||
| 927 | +VALUES | ||
| 928 | + (2, 3); | ||
| 929 | + | ||
| 930 | +INSERT INTO owner | ||
| 931 | + (personId, watermarkId) | ||
| 932 | +VALUES | ||
| 933 | + (1, 1), | ||
| 934 | + (2, 1); | ||
| 935 | + | ||
| 936 | +INSERT INTO i18n | ||
| 937 | + (textId, language, text) | ||
| 938 | +VALUES | ||
| 939 | + (1, 1, 'Das erste Bild'), | ||
| 940 | + (1, 2, 'Das erste Bild'), | ||
| 941 | + (1, 3, 'The first picture'), | ||
| 942 | + (2, 1, 'Der erste Testeintrag in der DB'), | ||
| 943 | + (2, 2, 'Der erste Testeintrag in der DB'), | ||
| 944 | + (2, 3, 'The first testentry in the DB'), | ||
| 945 | + (3, 1, 'Pictures von Zuhause'), | ||
| 946 | + (3, 2, 'Pictures von Zuhause'), | ||
| 947 | + (3, 3, 'Pictures from home'), | ||
| 948 | + (4, 1, 'So wohn ich nunmal und basta.'), | ||
| 949 | + (4, 2, 'So wohn ich nunmal und basta.'), | ||
| 950 | + (4, 3, 'That\'s the way i live. End of story.'), | ||
| 951 | + (5, 1, 'Daheim'), | ||
| 952 | + (5, 3, 'Home'), | ||
| 953 | + (6, 1, 'Diese Sektion zeigt mein Zuhause'), | ||
| 954 | + (6, 3, 'This section shows my home'), | ||
| 955 | + (7, 1, 'dummy'), | ||
| 956 | + (7, 3, 'dummy'), | ||
| 957 | + (8, 1, 'Eine Dummy-Sektion'), | ||
| 958 | + (8, 3, 'A dummy-section'), | ||
| 959 | + (9, 1, 'Galerie 1'), | ||
| 960 | + (9, 3, 'Gallery 1'), | ||
| 961 | + (10, 1, 'Die erste Galerie'), | ||
| 962 | + (10, 3, 'The first gallery'), | ||
| 963 | + (11, 1, 'Kategorie 1'), | ||
| 964 | + (11, 3, 'Category 1'), | ||
| 965 | + (12, 1, 'Die erste Kategorie'), | ||
| 966 | + (12, 3, 'The first category'); | ||
| 967 | + | ||
| 968 | +INSERT INTO format | ||
| 969 | + (width, height, quality) | ||
| 970 | +VALUES | ||
| 971 | + (1024, 768, 100), | ||
| 972 | + (800, 600, 100); | ||
| 973 | + | ||
| 974 | +INSERT INTO picture | ||
| 975 | + (title, photographerId, ownerId, origWidth, origHeight) | ||
| 976 | +VALUES | ||
| 977 | + (1, 1, 2, 2835, 1212), | ||
| 978 | + (3, 1, 1, 2135, 1100), | ||
| 979 | + (1, 1, 2, 1024, 915); | ||
| 980 | + | ||
| 981 | +INSERT INTO pictureDetail | ||
| 982 | + (pictureId, textId) | ||
| 983 | +VALUES | ||
| 984 | + (1, 2), | ||
| 985 | + (2, 4), | ||
| 986 | + (3, 2); | ||
| 987 | + | ||
| 988 | +INSERT INTO picture_format | ||
| 989 | + (pictureId, formatId) | ||
| 990 | +VALUES | ||
| 991 | + (1, 1), | ||
| 992 | + (1, 2), | ||
| 993 | + (2, 1), | ||
| 994 | + (3, 1); | ||
| 995 | + | ||
| 996 | +INSERT INTO location | ||
| 997 | + (zip, city, street, hno, name) | ||
| 998 | +VALUES | ||
| 999 | + ('48145', 'Münster', 'Warendorfer Str.', '75', 'Daheim'); | ||
| 1000 | + | ||
| 1001 | +INSERT INTO section | ||
| 1002 | + (title, locationId) | ||
| 1003 | +VALUES | ||
| 1004 | + (5, 1), | ||
| 1005 | + (7, 1); | ||
| 1006 | + | ||
| 1007 | +INSERT INTO sectionDetail | ||
| 1008 | + (sectionId, textId) | ||
| 1009 | +VALUES | ||
| 1010 | + (1, 6), | ||
| 1011 | + (2, 8); | ||
| 1012 | + | ||
| 1013 | +INSERT INTO picture_section | ||
| 1014 | + (pictureId, sectionId, prio) | ||
| 1015 | +VALUES | ||
| 1016 | + (1, 1, 1), | ||
| 1017 | + (2, 1, 1), | ||
| 1018 | + (1, 2, 1); | ||
| 1019 | + | ||
| 1020 | +INSERT INTO gallery | ||
| 1021 | + (title, creator) | ||
| 1022 | +VALUES | ||
| 1023 | + (9, 1); | ||
| 1024 | + | ||
| 1025 | +INSERT INTO galleryDetail | ||
| 1026 | + (galleryId, textId) | ||
| 1027 | +VALUES | ||
| 1028 | + (1, 10); | ||
| 1029 | + | ||
| 1030 | +INSERT INTO section_gallery | ||
| 1031 | + (sectionId, galleryId, prio) | ||
| 1032 | +VALUES | ||
| 1033 | + (1, 1, 1); | ||
| 1034 | + | ||
| 1035 | +INSERT INTO template | ||
| 1036 | + (templateId, name) | ||
| 1037 | +VALUES | ||
| 1038 | + (1, 'Template 1'); | ||
| 1039 | + | ||
| 1040 | +INSERT INTO category | ||
| 1041 | + (title, templateId) | ||
| 1042 | +VALUES | ||
| 1043 | + (11, 1); | ||
| 1044 | + | ||
| 1045 | +INSERT INTO categoryDetail | ||
| 1046 | + (categoryId, textId) | ||
| 1047 | +VALUES | ||
| 1048 | + (1, 12); | ||
| 1049 | + | ||
| 1050 | +INSERT INTO gallery_category | ||
| 1051 | + (galleryId, categoryId, prio) | ||
| 1052 | +VALUES | ||
| 1053 | + (1, 1, 1); |
templates/personAdmin/personAdmin.tpl.php
0 → 100644
| 1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
| 2 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
| 3 | +<html> | ||
| 4 | + <head> | ||
| 5 | + <title>Nur zum testen</title> | ||
| 6 | + <meta http-equiv="content-type" content="text/html;charset=utf-8" /> | ||
| 7 | + | ||
| 8 | + <link rel="stylesheet" type="text/css" | ||
| 9 | + href="<?=CSSURL?>background-colors.css" /> | ||
| 10 | + <link rel="stylesheet" type="text/css" href="<?=CSSURL?>fonts.css" /> | ||
| 11 | + <link rel="stylesheet" type="text/css" href="<?=CSSURL?>displays.css" /> | ||
| 12 | + | ||
| 13 | + <script src="<?=JSURL?>levenshtein.js" type="text/javascript"></script> | ||
| 14 | + <script src="<?=JSURL?>fittingStrings.js" type="text/javascript"></script> | ||
| 15 | + <script src="<?=JSURL?>transPngBg.js" type="text/javascript"></script> | ||
| 16 | + <script src="<?=JSURL?>personAdmin/personSearch1.js" | ||
| 17 | + type="text/javascript"></script> | ||
| 18 | + <script src="<?=JSURL?>personAdmin/personInUp.js" | ||
| 19 | + type="text/javascript"></script> | ||
| 20 | + <script src="<?=JSURL?>personAdmin/person.js" | ||
| 21 | + type="text/javascript"></script> | ||
| 22 | + | ||
| 23 | + <script language="javascript"> | ||
| 24 | + //<![CDATA[ | ||
| 25 | + arrDown = new transPngBg ('circDblArrDownBlk.png', '<?=LIBURL?>'); | ||
| 26 | + arrRight = new transPngBg ('circDblArrRightBlk.png', '<?=LIBURL?>'); | ||
| 27 | + | ||
| 28 | + newPerson = new c_person ( | ||
| 29 | + -1, -1, -1, '', '', '', '', '', -1, '', '', '', ''); | ||
| 30 | + person = new c_person ( | ||
| 31 | + -1, -1, -1, '', '', '', '', '', -1, '', '', '', ''); | ||
| 32 | + //]]> | ||
| 33 | + </script> | ||
| 34 | + </head> | ||
| 35 | + | ||
| 36 | + <body> | ||
| 37 | + <div style="width: 350px"> | ||
| 38 | + <?=$this->personSearch1?> | ||
| 39 | + <div style="height: 5px; line-height: 5px"> </div> | ||
| 40 | + <?=$this->personInUp?> | ||
| 41 | + </div> | ||
| 42 | + </body> | ||
| 43 | +</html> |
templates/personAdmin/personInUp.tpl.php
0 → 100644
| 1 | +<script language="javascript"> | ||
| 2 | +//<![CDATA[ | ||
| 3 | + pInUp = new personInUp ( | ||
| 4 | + 'update', 'insert', 'submit', person, newPerson, arrRight, arrDown); | ||
| 5 | + | ||
| 6 | + function showHideBlock (titleId) | ||
| 7 | + { | ||
| 8 | + var titleElement = document.getElementById (titleId); | ||
| 9 | + var imgElement = titleElement.getElementsByTagName ('img')[0]; | ||
| 10 | + var blockElement = titleElement.parentNode; | ||
| 11 | + var dataElement = blockElement.getElementsByTagName ('div')[1]; | ||
| 12 | + | ||
| 13 | + if (dataElement.style.display == 'none') | ||
| 14 | + { | ||
| 15 | + dataElement.style.display = 'block'; | ||
| 16 | + imgElement.src = arrDown.getImgUrl (titleElement); | ||
| 17 | + } | ||
| 18 | + else | ||
| 19 | + { | ||
| 20 | + dataElement.style.display = 'none'; | ||
| 21 | + imgElement.src = arrRight.getImgUrl (titleElement); | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + function personInUpInit () | ||
| 26 | + { | ||
| 27 | + var tCam = document.getElementById ('_title_camera'); | ||
| 28 | + var tCamImg = tCam.getElementsByTagName ('img')[0]; | ||
| 29 | + var tWat = document.getElementById ('_title_watermark'); | ||
| 30 | + var tWatImg = tWat.getElementsByTagName ('img')[0]; | ||
| 31 | + | ||
| 32 | + tCamImg.src = arrRight.getImgUrl (tCam); | ||
| 33 | + tWatImg.src = arrRight.getImgUrl (tWat); | ||
| 34 | + } | ||
| 35 | +//]]> | ||
| 36 | +</script> | ||
| 37 | + | ||
| 38 | +<div class="bgc-bg1 d-bg1 f-bg1"> | ||
| 39 | + <form id="pForm" onSubmit="return false"> | ||
| 40 | + <div> | ||
| 41 | + <table width="100%"><tr> | ||
| 42 | + <td style="vertical-align: middle"> | ||
| 43 | + <input type="checkbox" id="update" name="action" | ||
| 44 | + value="update" disabled="true" | ||
| 45 | + onClick="pInUp.updateForm ()" /> | ||
| 46 | + </td> | ||
| 47 | + <td style="vertical-align: middle"><?=_('update')?></td> | ||
| 48 | + <td style="vertical-align: middle"> </td> | ||
| 49 | + <td style="vertical-align: middle"> | ||
| 50 | + <input type="checkbox" id="insert" name="action" | ||
| 51 | + value="insert" | ||
| 52 | + onClick="pInUp.updateForm ()" /> | ||
| 53 | + </td> | ||
| 54 | + <td style="vertical-align: middle"><?=_('insert')?></td> | ||
| 55 | + <td align="right" width="100%"> | ||
| 56 | + <input type="button" id="submit" | ||
| 57 | + value="<?=_('submit')?>" disabled="true" /> | ||
| 58 | + </td> | ||
| 59 | + </tr></table> | ||
| 60 | + </div> | ||
| 61 | + <div class="bgc-grp1 d-grp1" style="margin-top: 2px"> | ||
| 62 | + <div class="bgc-head1 f-head1 d-head1"> | ||
| 63 | + <?=_('personal data')?> | ||
| 64 | + </div> | ||
| 65 | + <div class="bgc-box1 f-box1 d-box1"> | ||
| 66 | + <div> | ||
| 67 | + <input type="hidden" id="personId" value="-1" disabled="true" /> | ||
| 68 | + </div> | ||
| 69 | + <div> | ||
| 70 | + <input type="hidden" id="photographerId" value="-1" | ||
| 71 | + disabled="true" /> | ||
| 72 | + </div> | ||
| 73 | + <div> | ||
| 74 | + <input type="hidden" id="ownerId" value="-1" disabled="true" /> | ||
| 75 | + </div> | ||
| 76 | + <div> | ||
| 77 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 78 | + id="firstname" value="" disabled="true" | ||
| 79 | + onChange="pInUp.setFirstname (this.value)" /> | ||
| 80 | + <?=_('firstname')?> | ||
| 81 | + </div> | ||
| 82 | + <div> | ||
| 83 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 84 | + id="surname" value="" disabled="true" | ||
| 85 | + onChange="pInUp.setSurname (this.value)" /> | ||
| 86 | + <?=_('surname')?> | ||
| 87 | + </div> | ||
| 88 | + <div> | ||
| 89 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 90 | + id="company" value="" disabled="true" | ||
| 91 | + onChange="pInUp.setCompany (this.value)" /> | ||
| 92 | + <?=_('company')?> | ||
| 93 | + </div> | ||
| 94 | + <div> | ||
| 95 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 96 | + id="email" value="" disabled="true" | ||
| 97 | + onChange="pInUp.setEmail (this.value)" /> | ||
| 98 | + <?=_('email')?> | ||
| 99 | + </div> | ||
| 100 | + <div> | ||
| 101 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 102 | + id="url" value="" disabled="true" | ||
| 103 | + onChange="pInUp.setUrl (this.value)" /> | ||
| 104 | + <?=_('url')?> | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + | ||
| 109 | + <div class="bgc-grp1 d-grp1" style="margin-top: 2px"> | ||
| 110 | + <div class="bgc-head1 f-head1 d-head1" id="_title_camera"> | ||
| 111 | + <img style=" | ||
| 112 | + position: relative; | ||
| 113 | + float: right; | ||
| 114 | + margin-right: 3px; | ||
| 115 | + cursor: pointer" | ||
| 116 | + onClick="showHideBlock ('_title_camera')" /> | ||
| 117 | + <?=_('photographer')?> | ||
| 118 | + </div> | ||
| 119 | + <div class="bgc-box1 f-box1 d-box1" style="display: none"> | ||
| 120 | + <div> | ||
| 121 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 122 | + id="cameraId" value="-1" disabled="true" | ||
| 123 | + onChange="pInUp.setCameraId (this.value)" /> | ||
| 124 | + <?=_('cameraId')?> | ||
| 125 | + </div> | ||
| 126 | + </div> | ||
| 127 | + </div> | ||
| 128 | + | ||
| 129 | + <div class="bgc-grp1 d-grp1" style="margin-top: 2px"> | ||
| 130 | + <div class="bgc-head1 f-head1 d-head1" id="_title_watermark"> | ||
| 131 | + <img style=" | ||
| 132 | + position: relative; | ||
| 133 | + float: right; | ||
| 134 | + margin-right: 3px; | ||
| 135 | + cursor: pointer" | ||
| 136 | + onClick="showHideBlock ('_title_watermark')" /> | ||
| 137 | + <?=_('owner')?> | ||
| 138 | + </div> | ||
| 139 | + <div class="bgc-box1 f-box1 d-box1" style="display: none"> | ||
| 140 | + <div> | ||
| 141 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 142 | + id="wmWidth" value="" disabled="true" | ||
| 143 | + onChange="pInUp.setWmWidth (this.value)" /> | ||
| 144 | + <?=_('watermark width')?> | ||
| 145 | + </div> | ||
| 146 | + <div> | ||
| 147 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 148 | + id="wmHeight" value="" disabled="true" | ||
| 149 | + onChange="pInUp.setWmHeight (this.value)" /> | ||
| 150 | + <?=_('watermark height')?> | ||
| 151 | + </div> | ||
| 152 | + <div> | ||
| 153 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 154 | + id="wmXPos" value="" disabled="true" | ||
| 155 | + onChange="pInUp.setWmXPos (this.value)" /> | ||
| 156 | + <?=_('watermark xPos')?> | ||
| 157 | + </div> | ||
| 158 | + <div> | ||
| 159 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 160 | + id="wmYPos" value="" disabled="true" | ||
| 161 | + onChange="pInUp.setWmYPos (this.value)" /> | ||
| 162 | + <?=_('watermark yPos')?> | ||
| 163 | + </div> | ||
| 164 | + </div> | ||
| 165 | + </div> | ||
| 166 | + </form> | ||
| 167 | +</div> | ||
| 168 | + | ||
| 169 | +<script language="javascript"> | ||
| 170 | +//<![CDATA[ | ||
| 171 | + personInUpInit (); | ||
| 172 | +//]]> | ||
| 173 | +</script> |
templates/personAdmin/personSearch1.tpl.php
0 → 100644
| 1 | +<script language="javascript"> | ||
| 2 | +//<![CDATA[ | ||
| 3 | + var names = new Array (); | ||
| 4 | + | ||
| 5 | + <? foreach ($this->names as $surname => $data): ?> | ||
| 6 | + names['<?=$surname?>'] = new Array (); | ||
| 7 | + <? foreach ($data as $d): ?> | ||
| 8 | + names['<?=$surname?>'].push ( | ||
| 9 | + new Array ('<?=$d[0]?>', | ||
| 10 | + new c_person ( | ||
| 11 | + <?=$d[1]->get_personId ()?>, | ||
| 12 | + <?=(($val=$d[1]->get_photographerId ()) !== NULL)?$val:-1?>, | ||
| 13 | + <?=(($val=$d[1]->get_ownerId ()) !== NULL)?$val:-1?>, | ||
| 14 | + '<?=$d[1]->get_firstname ()?>', | ||
| 15 | + '<?=$d[1]->get_surname ()?>', | ||
| 16 | + '<?=$d[1]->get_company ()?>', | ||
| 17 | + '<?=$d[1]->get_email ()?>', | ||
| 18 | + '<?=$d[1]->get_url ()?>', | ||
| 19 | + <?=(($val=$d[1]->get_cameraId ()) !== NULL)?$val:-1?>, | ||
| 20 | + '<?=(($val=$d[1]->get_wmWidth ()) !== NULL)?$val:''?>', | ||
| 21 | + '<?=(($val=$d[1]->get_wmHeight ()) !== NULL)?$val:''?>', | ||
| 22 | + '<?=(($val=$d[1]->get_wmXPos ()) !== NULL)?$val:''?>', | ||
| 23 | + '<?=(($val=$d[1]->get_wmYPos ()) !== NULL)?$val:''?>'))); | ||
| 24 | + <? endforeach ?> | ||
| 25 | + <? endforeach ?> | ||
| 26 | + | ||
| 27 | + pSearch1 = new c_personSearch1 ( | ||
| 28 | + 'personSearch1_fname', 'personSearch1_sname', | ||
| 29 | + 'personSearch1_fBestFit', 'personSearch1_sBestFit', names, person); | ||
| 30 | +//]]> | ||
| 31 | +</script> | ||
| 32 | + | ||
| 33 | +<div class="bgc-bg1 d-bg1"> | ||
| 34 | + <div class="bgc-grp1 d-grp1"> | ||
| 35 | + <form id="personForm" onSubmit="return false"> | ||
| 36 | + <div class="bgc-head1 f-head1 d-head1"> | ||
| 37 | + <?=_('search')?> | ||
| 38 | + </div> | ||
| 39 | + <div class="bgc-box1 f-box1 d-box1"> | ||
| 40 | + <div style="position: relative; z-index: 1"> | ||
| 41 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 42 | + id="personSearch1_sname" value="" | ||
| 43 | + onKeyUp="return pSearch1.altSurnames ()" | ||
| 44 | + onBlur="return pSearch1.hide ('personSearch1_sBestFit')" /> | ||
| 45 | + <?=_('surname')?> | ||
| 46 | + <div class="bgc-tt1 d-tt1" | ||
| 47 | + style="position: absolute; top: 20px; left: 0px"> | ||
| 48 | + <ul id="personSearch1_sBestFit" class="d-tt1" /> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + <div style="position: relative; z-index: 0"> | ||
| 52 | + <input type="text" style="width: 200px" maxlength="255" | ||
| 53 | + id="personSearch1_fname" value="" | ||
| 54 | + onKeyUp="return pSearch1.altFirstnames ()" | ||
| 55 | + onBlur="return pSearch1.hide ('personSearch1_fBestFit')" /> | ||
| 56 | + <?=_('firstname')?> | ||
| 57 | + <div class="bgc-tt1 d-tt1" | ||
| 58 | + style="position: absolute; top: 20px; left: 0px"> | ||
| 59 | + <ul id="personSearch1_fBestFit" class="d-tt1" /> | ||
| 60 | + </div> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </form> | ||
| 64 | + </div> | ||
| 65 | +</div> |
Please
register
or
login
to post a comment