Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • isaack/VMS-SUEE_2.0
  • ztk.me/VMS-z
2 results
Show changes
Showing
with 11452 additions and 788 deletions
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// Title: tigra slider control
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_slider_control/
// Version: 1.1 (commented source)
// Date: 08/28/2012
// Tech. Support: http://www.softcomplex.com/forum/
// Notes: This script is free. Visit official site for further details.
function slider (a_init, a_tpl) {
this.f_setValue = f_sliderSetValue;
this.f_getPos = f_sliderGetPos;
// register in the global collection
if (!window.A_SLIDERS)
window.A_SLIDERS = [];
var n_id = this.n_id = window.A_SLIDERS.length;
window.A_SLIDERS[n_id] = this;
// save config parameters in the slider object
var s_key;
if (a_tpl)
for (s_key in a_tpl)
this[s_key] = a_tpl[s_key];
for (s_key in a_init)
this[s_key] = a_init[s_key];
this.n_pix2value = this.n_pathLength / (this.n_maxValue - this.n_minValue);
if (this.n_value == null)
this.n_value = this.n_minValue;
// generate the control's HTML
document.write(
'<div style="width:' + this.n_controlWidth + 'px;height:' + this.n_controlHeight + 'px;border:0; background-image:url(' + this.s_imgControl + ')" id="sl' + n_id + 'base">' +
'<img src="' + this.s_imgSlider + '" width="' + this.n_sliderWidth + '" height="' + this.n_sliderHeight + '" border="0" style="position:relative;left:' + this.n_pathLeft + 'px;top:' + this.n_pathTop + 'px;z-index:' + this.n_zIndex + ';cursor:pointer;visibility:hidden;" name="sl' + n_id + 'slider" id="sl' + n_id + 'slider" onmousedown="return f_sliderMouseDown(' + n_id + ')" /></div>'
);
this.e_base = get_element('sl' + n_id + 'base');
this.e_slider = get_element('sl' + n_id + 'slider');
if (document.addEventListener) {
this.e_slider.addEventListener("touchstart", function (e_event) { f_sliderMouseDown(n_id, e_event) }, false);
document.addEventListener("touchmove", f_sliderMouseMove, false);
document.addEventListener("touchend", f_sliderMouseUp, false);
}
// safely hook document/window events
if (!window.f_savedMouseMove && document.onmousemove != f_sliderMouseMove) {
window.f_savedMouseMove = document.onmousemove;
document.onmousemove = f_sliderMouseMove;
}
if (!window.f_savedMouseUp && document.onmouseup != f_sliderMouseUp) {
window.f_savedMouseUp = document.onmouseup;
document.onmouseup = f_sliderMouseUp;
}
// preset to the value in the input box if available
var e_input = this.s_form == null
? get_element(this.s_name)
: document.forms[this.s_form]
? document.forms[this.s_form].elements[this.s_name]
: null;
this.f_setValue(e_input && e_input.value != '' ? e_input.value : null, 1);
this.e_slider.style.visibility = 'visible';
}
function f_sliderSetValue (n_value, b_noInputCheck) {
if (n_value == null)
n_value = this.n_value == null ? this.n_minValue : this.n_value;
if (isNaN(n_value))
return false;
// round to closest multiple if step is specified
if (this.n_step)
n_value = Math.round((n_value - this.n_minValue) / this.n_step) * this.n_step + this.n_minValue;
// smooth out the result
if (n_value % 1)
n_value = Math.round(n_value * 1e5) / 1e5;
if (n_value < this.n_minValue)
n_value = this.n_minValue;
if (n_value > this.n_maxValue)
n_value = this.n_maxValue;
this.n_value = n_value;
// move the slider
if (this.b_vertical)
this.e_slider.style.top = (this.n_pathTop + this.n_pathLength - Math.round((n_value - this.n_minValue) * this.n_pix2value)) + 'px';
else
this.e_slider.style.left = (this.n_pathLeft + Math.round((n_value - this.n_minValue) * this.n_pix2value)) + 'px';
// save new value
var e_input;
if (this.s_form == null) {
e_input = get_element(this.s_name);
if (!e_input)
return b_noInputCheck ? null : f_sliderError(this.n_id, "Can not find the input with ID='" + this.s_name + "'.");
}
else {
var e_form = document.forms[this.s_form];
if (!e_form)
return b_noInputCheck ? null : f_sliderError(this.n_id, "Can not find the form with NAME='" + this.s_form + "'.");
e_input = e_form.elements[this.s_name];
if (!e_input)
return b_noInputCheck ? null : f_sliderError(this.n_id, "Can not find the input with NAME='" + this.s_name + "'.");
}
e_input.value = n_value;
}
// get absolute position of the element in the document
function f_sliderGetPos (b_vertical, b_base) {
var n_pos = 0,
s_coord = (b_vertical ? 'Top' : 'Left');
var o_elem = o_elem2 = b_base ? this.e_base : this.e_slider;
while (o_elem) {
n_pos += o_elem["offset" + s_coord];
o_elem = o_elem.offsetParent;
}
o_elem = o_elem2;
var n_offset;
while (o_elem.tagName != "BODY") {
n_offset = o_elem["scroll" + s_coord];
if (n_offset)
n_pos -= o_elem["scroll" + s_coord];
o_elem = o_elem.parentNode;
}
return n_pos;
}
function f_sliderMouseDown (n_id, e_event) {
window.n_activeSliderId = n_id;
f_sliderSaveTouch(e_event);
var o_slider = A_SLIDERS[n_id];
window.n_mouseOffset = o_slider.b_vertical
? window.n_mouseY - o_slider.n_sliderHeight / 2 - o_slider.f_getPos(1, 1) - parseInt(o_slider.e_slider.style.top)
: window.n_mouseX - o_slider.n_sliderWidth / 2 - o_slider.f_getPos(0, 1) - parseInt(o_slider.e_slider.style.left);
return false;
}
function f_sliderMouseUp (e_event, b_watching) {
if (window.n_activeSliderId != null) {
var o_slider = window.A_SLIDERS[window.n_activeSliderId];
o_slider.f_setValue(o_slider.n_minValue + (o_slider.b_vertical
? (o_slider.n_pathLength - parseInt(o_slider.e_slider.style.top) + o_slider.n_pathTop)
: (parseInt(o_slider.e_slider.style.left) - o_slider.n_pathLeft)) / o_slider.n_pix2value);
if (b_watching) return;
window.n_activeSliderId = null;
window.n_mouseOffset = null;
}
if (window.f_savedMouseUp)
return window.f_savedMouseUp(e_event);
}
function f_sliderMouseMove (e_event) {
if (!e_event && window.event) e_event = window.event;
// save mouse coordinates
if (e_event) {
window.n_mouseX = e_event.clientX + f_scrollLeft();
window.n_mouseY = e_event.clientY + f_scrollTop();
}
// check if in drag mode
if (window.n_activeSliderId != null) {
f_sliderSaveTouch(e_event);
var o_slider = window.A_SLIDERS[window.n_activeSliderId];
var n_pxOffset;
if (o_slider.b_vertical) {
var n_sliderTop = window.n_mouseY - o_slider.n_sliderHeight / 2 - o_slider.f_getPos(1, 1) - window.n_mouseOffset;
// limit the slider movement
if (n_sliderTop < o_slider.n_pathTop)
n_sliderTop = o_slider.n_pathTop;
var n_pxMax = o_slider.n_pathTop + o_slider.n_pathLength;
if (n_sliderTop > n_pxMax)
n_sliderTop = n_pxMax;
o_slider.e_slider.style.top = n_sliderTop + 'px';
n_pxOffset = o_slider.n_pathLength - n_sliderTop + o_slider.n_pathTop;
}
else {
var n_sliderLeft = window.n_mouseX - o_slider.n_sliderWidth / 2 - o_slider.f_getPos(0, 1) - window.n_mouseOffset;
// limit the slider movement
if (n_sliderLeft < o_slider.n_pathLeft)
n_sliderLeft = o_slider.n_pathLeft;
var n_pxMax = o_slider.n_pathLeft + o_slider.n_pathLength;
if (n_sliderLeft > n_pxMax)
n_sliderLeft = n_pxMax;
o_slider.e_slider.style.left = n_sliderLeft + 'px';
n_pxOffset = n_sliderLeft - o_slider.n_pathLeft;
}
if (o_slider.b_watch)
f_sliderMouseUp(e_event, 1);
return false;
}
if (window.f_savedMouseMove)
return window.f_savedMouseMove(e_event);
}
function f_sliderSaveTouch (e_event) {
if (!e_event || !e_event.touches) return;
e_event.preventDefault();
var e_touch = e_event.touches[0] || e_event.changedTouches[0];
window.n_mouseX = e_touch.pageX;
window.n_mouseY = e_touch.pageY;
}
// get the scroller positions of the page
function f_scrollLeft() {
return f_filterResults (
window.pageXOffset ? window.pageXOffset : 0,
document.documentElement ? document.documentElement.scrollLeft : 0,
document.body ? document.body.scrollLeft : 0
);
}
function f_scrollTop() {
return f_filterResults (
window.pageYOffset ? window.pageYOffset : 0,
document.documentElement ? document.documentElement.scrollTop : 0,
document.body ? document.body.scrollTop : 0
);
}
function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
if (n_docel && (!n_result || (n_result > n_docel)))
n_result = n_docel;
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function f_sliderError (n_id, s_message) {
alert("Slider #" + n_id + " Error:\n" + s_message);
window.n_activeSliderId = null;
}
get_element = document.all ?
function (s_id) { return document.all[s_id] } :
function (s_id) { return document.getElementById(s_id) };
function GetURLParameter(sParam){
var erg = false;
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++){
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam){
erg = sParameterName[1];
}
}
return erg;
}
function loggen(){
var url = window.location.origin+'?page='+GetURLParameter('page')+'&anzahl='+$('#anzahl').val()+'&sort='+$('#sort').val();
window.location.href = url;
}
function Parameter(){
var anzahl = GetURLParameter('anzahl');
var sort = GetURLParameter('sort');
if(!sort){ sort = 0;}
if(!anzahl){ anzahl = 1;}
$('#sort').val(sort);
$('#anzahl').val(anzahl);
}
var countdownfunc = function(elem, ende, endstring)
{
if(typeof endstring == 'undefined'){
endstring = '<font color="#01DF01">Startseite bereit</font>';
}
var output = endstring;
var timeDiff = (parseInt(ende)) - (parseInt(new Date().getTime() / 1000));
if(timeDiff > 0){
output = '';
if(timeDiff > 3600){
output += parseInt(timeDiff/3600) + 'h ';
timeDiff = timeDiff%3600; //Modulo, teile durch eine stunde und speichere den rest
}
if(timeDiff > 60){
output += parseInt(timeDiff/60) + 'm ';
timeDiff = timeDiff%60;//... und merk dir den rest
}
output += timeDiff + 's';
setTimeout(function() {countdownfunc(elem, ende, endstring);},1000);
}
elem.innerHTML = output;
};
\ No newline at end of file
/*
Stylesheet for Tigra Calendar v5.0
Product is Public Domain (Free for any kind of applicaiton, customization and derivative works are allowed)
URL: http://www.softcomplex.com/products/tigra_calendar/
- all image paths are relative to path of stylesheet
- the styles below can be moved into the document or in existing stylesheet
*/
/* input box in default state */
.tcalInput {
background: url('img/cal.gif') 100% 50% no-repeat;
padding-right: 20px;
cursor: pointer;
}
/* additional properties for input boxe in activated state, above still applies unless in conflict */
.tcalActive {
background-image: url('img/no_cal.gif');
}
/* container of calendar's pop-up */
#tcal {
position: absolute;
visibility: hidden;
z-index: 100;
width: 170px;
background-color: white;
margin-top: 2px;
padding: 0 2px 2px 2px;
border: 1px solid silver;
-moz-box-shadow: 3px 3px 4px silver;
-webkit-box-shadow: 3px 3px 4px silver;
box-shadow: 3px 3px 4px silver;
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='silver')";
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='silver');
}
/* table containing navigation and current month */
#tcalControls {
border-collapse: collapse;
border: 0;
width: 100%;
}
#tcalControls td {
border-collapse: collapse;
border: 0;
padding: 0;
width: 16px;
background-position: 50% 50%;
background-repeat: no-repeat;
cursor: pointer;
}
#tcalControls th {
border-collapse: collapse;
border: 0;
padding: 0;
line-height: 25px;
font-size: 10px;
text-align: center;
font-family: Tahoma, Geneva, sans-serif;
font-weight: bold;
white-space: nowrap;
}
#tcalPrevYear { background-image: url('img/prev_year.gif'); }
#tcalPrevMonth { background-image: url('img/prev_mon.gif'); }
#tcalNextMonth { background-image: url('img/next_mon.gif'); }
#tcalNextYear { background-image: url('img/next_year.gif'); }
/* table containing week days header and calendar grid */
#tcalGrid {
border-collapse: collapse;
border: 1px solid silver;
width: 100%;
}
#tcalGrid th {
border: 1px solid silver;
border-collapse: collapse;
padding: 3px 0;
text-align: center;
font-family: Tahoma, Geneva, sans-serif;
font-size: 10px;
background-color: gray;
color: white;
}
#tcalGrid td {
border: 0;
border-collapse: collapse;
padding: 2px 0;
text-align: center;
font-family: Tahoma, Geneva, sans-serif;
width: 14%;
font-size: 11px;
cursor: pointer;
}
#tcalGrid td.tcalOtherMonth { color: silver; }
#tcalGrid td.tcalWeekend { background-color: #ACD6F5; }
#tcalGrid td.tcalToday { border: 1px solid red; }
#tcalGrid td.tcalSelected { background-color: #FFB3BE; }
// Tigra Calendar v5.2 (11/20/2011)
// http://www.softcomplex.com/products/tigra_calendar/
// License: Public Domain... You're welcome.
// default settins - this structure can be moved in separate file in multilangual applications
var A_TCALCONF = {
'cssprefix' : 'tcal',
'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
'longwdays' : ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
'yearscroll' : true, // show year scroller
'weekstart' : 0, // first day of week: 0-Su or 1-Mo
'prevyear' : 'Previous Year',
'nextyear' : 'Next Year',
'prevmonth' : 'Previous Month',
'nextmonth' : 'Next Month',
'format' : 'm/d/Y' // 'd-m-Y', Y-m-d', 'l, F jS Y'
};
var A_TCALTOKENS = [
// A full numeric representation of a year, 4 digits
{'t': 'Y', 'r': '19\\d{2}|20\\d{2}', 'p': function (d_date, n_value) { d_date.setFullYear(Number(n_value)); return d_date; }, 'g': function (d_date) { var n_year = d_date.getFullYear(); return n_year; }},
// Numeric representation of a month, with leading zeros
{'t': 'm', 'r': '0?[1-9]|1[0-2]', 'p': function (d_date, n_value) { d_date.setMonth(Number(n_value) - 1); return d_date; }, 'g': function (d_date) { var n_month = d_date.getMonth() + 1; return (n_month < 10 ? '0' : '') + n_month }},
// A full textual representation of a month, such as January or March
{'t': 'F', 'r': A_TCALCONF.months.join('|'), 'p': function (d_date, s_value) { for (var m = 0; m < 12; m++) if (A_TCALCONF.months[m] == s_value) { d_date.setMonth(m); return d_date; }}, 'g': function (d_date) { return A_TCALCONF.months[d_date.getMonth()]; }},
// Day of the month, 2 digits with leading zeros
{'t': 'd', 'r': '0?[1-9]|[12][0-9]|3[01]', 'p': function (d_date, n_value) { d_date.setDate(Number(n_value)); if (d_date.getDate() != n_value) d_date.setDate(0); return d_date }, 'g': function (d_date) { var n_date = d_date.getDate(); return (n_date < 10 ? '0' : '') + n_date; }},
// Day of the month without leading zeros
{'t': 'j', 'r': '0?[1-9]|[12][0-9]|3[01]', 'p': function (d_date, n_value) { d_date.setDate(Number(n_value)); if (d_date.getDate() != n_value) d_date.setDate(0); return d_date }, 'g': function (d_date) { var n_date = d_date.getDate(); return n_date; }},
// A full textual representation of the day of the week
{'t': 'l', 'r': A_TCALCONF.longwdays.join('|'), 'p': function (d_date, s_value) { return d_date }, 'g': function (d_date) { return A_TCALCONF.longwdays[d_date.getDay()]; }},
// English ordinal suffix for the day of the month, 2 characters
{'t': 'S', 'r': 'st|nd|rd|th', 'p': function (d_date, s_value) { return d_date }, 'g': function (d_date) { n_date = d_date.getDate(); if (n_date % 10 == 1 && n_date != 11) return 'st'; if (n_date % 10 == 2 && n_date != 12) return 'nd'; if (n_date % 10 == 3 && n_date != 13) return 'rd'; return 'th'; }}
];
function f_tcalGetHTML (d_date) {
var e_input = f_tcalGetInputs(true);
if (!e_input) return;
var s_pfx = A_TCALCONF.cssprefix,
s_format = A_TCALCONF.format;
// today from config or client date
var d_today = f_tcalParseDate(A_TCALCONF.today, A_TCALCONF.format);
if (!d_today)
d_today = f_tcalResetTime(new Date());
// selected date from input or config or today
var d_selected = f_tcalParseDate(e_input.value, s_format);
if (!d_selected)
d_selected = f_tcalParseDate(A_TCALCONF.selected, A_TCALCONF.format);
if (!d_selected)
d_selected = new Date(d_today);
// show calendar for passed or selected date
d_date = d_date ? f_tcalResetTime(d_date) : new Date(d_selected);
var d_firstDay = new Date(d_date);
d_firstDay.setDate(1);
d_firstDay.setDate(1 - (7 + d_firstDay.getDay() - A_TCALCONF.weekstart) % 7);
var a_class, s_html = '<table id="' + s_pfx + 'Controls"><tbody><tr>'
+ (A_TCALCONF.yearscroll ? '<td id="' + s_pfx + 'PrevYear" ' + f_tcalRelDate(d_date, -1, 'y') + ' title="' + A_TCALCONF.prevyear + '"></td>' : '')
+ '<td id="' + s_pfx + 'PrevMonth"' + f_tcalRelDate(d_date, -1) + ' title="' + A_TCALCONF.prevmonth + '"></td><th>'
+ A_TCALCONF.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
+ '</th><td id="' + s_pfx + 'NextMonth"' + f_tcalRelDate(d_date, 1) + ' title="' + A_TCALCONF.nextmonth + '"></td>'
+ (A_TCALCONF.yearscroll ? '<td id="' + s_pfx + 'NextYear"' + f_tcalRelDate(d_date, 1, 'y') + ' title="' + A_TCALCONF.nextyear + '"></td>' : '')
+ '</tr></tbody></table><table id="' + s_pfx + 'Grid"><tbody><tr>';
// print weekdays titles
for (var i = 0; i < 7; i++)
s_html += '<th>' + A_TCALCONF.weekdays[(A_TCALCONF.weekstart + i) % 7] + '</th>';
s_html += '</tr>' ;
// print calendar table
var n_date, n_month, d_current = new Date(d_firstDay);
while (d_current.getMonth() == d_date.getMonth() ||
d_current.getMonth() == d_firstDay.getMonth()) {
s_html +='<tr>';
for (var n_wday = 0; n_wday < 7; n_wday++) {
a_class = [];
n_date = d_current.getDate();
n_month = d_current.getMonth();
if (d_current.getMonth() != d_date.getMonth())
a_class[a_class.length] = s_pfx + 'OtherMonth';
if (d_current.getDay() == 0 || d_current.getDay() == 6)
a_class[a_class.length] = s_pfx + 'Weekend';
if (d_current.valueOf() == d_today.valueOf())
a_class[a_class.length] = s_pfx + 'Today';
if (d_current.valueOf() == d_selected.valueOf())
a_class[a_class.length] = s_pfx + 'Selected';
s_html += '<td' + f_tcalRelDate(d_current) + (a_class.length ? ' class="' + a_class.join(' ') + '">' : '>') + n_date + '</td>';
d_current.setDate(++n_date);
}
s_html +='</tr>';
}
s_html +='</tbody></table>';
return s_html;
}
function f_tcalRelDate (d_date, d_diff, s_units) {
var s_units = (s_units == 'y' ? 'FullYear' : 'Month');
var d_result = new Date(d_date);
if (d_diff) {
d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
if (d_result.getDate() != d_date.getDate())
d_result.setDate(0);
}
return ' onclick="f_tcalUpdate(' + d_result.valueOf() + (d_diff ? ',1' : '') + ')"';
}
function f_tcalResetTime (d_date) {
d_date.setMilliseconds(0);
d_date.setSeconds(0);
d_date.setMinutes(0);
d_date.setHours(12);
return d_date;
}
// closes calendar and returns all inputs to default state
function f_tcalCancel () {
var s_pfx = A_TCALCONF.cssprefix;
var e_cal = document.getElementById(s_pfx);
if (e_cal)
e_cal.style.visibility = '';
var a_inputs = f_tcalGetInputs();
for (var n = 0; n < a_inputs.length; n++)
f_tcalRemoveClass(a_inputs[n], s_pfx + 'Active');
}
function f_tcalUpdate (n_date, b_keepOpen) {
var e_input = f_tcalGetInputs(true);
if (!e_input) return;
d_date = new Date(n_date);
var s_pfx = A_TCALCONF.cssprefix;
if (b_keepOpen) {
var e_cal = document.getElementById(s_pfx);
if (!e_cal || e_cal.style.visibility != 'visible') return;
e_cal.innerHTML = f_tcalGetHTML(d_date, e_input);
}
else {
e_input.value = f_tcalGenerateDate(d_date, A_TCALCONF.format);
f_tcalCancel();
}
}
function f_tcalOnClick () {
// see if already opened
var s_pfx = A_TCALCONF.cssprefix;
var s_activeClass = s_pfx + 'Active';
var b_close = f_tcalHasClass(this, s_activeClass);
// close all clalendars
f_tcalCancel();
if (b_close) return;
// get position of input
f_tcalAddClass(this, s_activeClass);
var n_left = f_getPosition (this, 'Left'),
n_top = f_getPosition (this, 'Top') + this.offsetHeight;
var e_cal = document.getElementById(s_pfx);
if (!e_cal) {
e_cal = document.createElement('div');
e_cal.onselectstart = function () { return false };
e_cal.id = s_pfx;
document.getElementsByTagName("body").item(0).appendChild(e_cal);
}
e_cal.innerHTML = f_tcalGetHTML(null);
e_cal.style.top = n_top + 'px';
e_cal.style.left = (n_left + this.offsetWidth - e_cal.offsetWidth) + 'px';
e_cal.style.visibility = 'visible';
}
function f_tcalParseDate (s_date, s_format) {
if (!s_date) return;
var s_char, s_regexp = '^', a_tokens = {}, a_options, n_token = 0;
for (var n = 0; n < s_format.length; n++) {
s_char = s_format.charAt(n);
if (A_TCALTOKENS_IDX[s_char]) {
a_tokens[s_char] = ++n_token;
s_regexp += '(' + A_TCALTOKENS_IDX[s_char]['r'] + ')';
}
else if (s_char == ' ')
s_regexp += '\\s';
else
s_regexp += (s_char.match(/[\w\d]/) ? '' : '\\') + s_char;
}
var r_date = new RegExp(s_regexp + '$');
if (!s_date.match(r_date)) return;
var s_val, d_date = f_tcalResetTime(new Date());
d_date.setDate(1);
for (n = 0; n < A_TCALTOKENS.length; n++) {
s_char = A_TCALTOKENS[n]['t'];
if (!a_tokens[s_char])
continue;
s_val = RegExp['$' + a_tokens[s_char]];
d_date = A_TCALTOKENS[n]['p'](d_date, s_val);
}
return d_date;
}
function f_tcalGenerateDate (d_date, s_format) {
var s_char, s_date = '';
for (var n = 0; n < s_format.length; n++) {
s_char = s_format.charAt(n);
s_date += A_TCALTOKENS_IDX[s_char] ? A_TCALTOKENS_IDX[s_char]['g'](d_date) : s_char;
}
return s_date;
}
function f_tcalGetInputs (b_active) {
var a_inputs = document.getElementsByTagName('input'),
e_input, s_rel, a_result = [];
for (n = 0; n < a_inputs.length; n++) {
e_input = a_inputs[n];
if (!e_input.type || e_input.type != 'text')
continue;
if (!f_tcalHasClass(e_input, 'tcal'))
continue;
if (b_active && f_tcalHasClass(e_input, A_TCALCONF.cssprefix + 'Active'))
return e_input;
a_result[a_result.length] = e_input;
}
return b_active ? null : a_result;
}
function f_tcalHasClass (e_elem, s_class) {
var s_classes = e_elem.className;
if (!s_classes)
return false;
var a_classes = s_classes.split(' ');
for (var n = 0; n < a_classes.length; n++)
if (a_classes[n] == s_class)
return true;
return false;
}
function f_tcalAddClass (e_elem, s_class) {
if (f_tcalHasClass (e_elem, s_class))
return;
var s_classes = e_elem.className;
e_elem.className = (s_classes ? s_classes + ' ' : '') + s_class;
}
function f_tcalRemoveClass (e_elem, s_class) {
var s_classes = e_elem.className;
if (!s_classes || s_classes.indexOf(s_class) == -1)
return false;
var a_classes = s_classes.split(' '),
a_newClasses = [];
for (var n = 0; n < a_classes.length; n++) {
if (a_classes[n] == s_class)
continue;
a_newClasses[a_newClasses.length] = a_classes[n];
}
e_elem.className = a_newClasses.join(' ');
return true;
}
function f_getPosition (e_elemRef, s_coord) {
var n_pos = 0, n_offset,
e_elem = e_elemRef;
while (e_elem) {
n_offset = e_elem["offset" + s_coord];
n_pos += n_offset;
e_elem = e_elem.offsetParent;
}
e_elem = e_elemRef;
while (e_elem != document.body) {
n_offset = e_elem["scroll" + s_coord];
if (n_offset && e_elem.style.overflow == 'scroll')
n_pos -= n_offset;
e_elem = e_elem.parentNode;
}
return n_pos;
}
function f_tcalInit () {
if (!document.getElementsByTagName)
return;
var e_input, a_inputs = f_tcalGetInputs();
for (var n = 0; n < a_inputs.length; n++) {
e_input = a_inputs[n];
e_input.onclick = f_tcalOnClick;
f_tcalAddClass(e_input, A_TCALCONF.cssprefix + 'Input');
}
window.A_TCALTOKENS_IDX = {};
for (n = 0; n < A_TCALTOKENS.length; n++)
A_TCALTOKENS_IDX[A_TCALTOKENS[n]['t']] = A_TCALTOKENS[n];
}
function f_tcalAddOnload (f_func) {
if (document.addEventListener) {
window.addEventListener('load', f_func, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', f_func);
}
else {
var f_onLoad = window.onload;
if (typeof window.onload != 'function') {
window.onload = f_func;
}
else {
window.onload = function() {
f_onLoad();
f_func();
}
}
}
}
f_tcalAddOnload (f_tcalInit);
var A_TPL = {
'b_vertical' : false,
'b_watch': true,
'n_controlWidth': 120,
'n_controlHeight': 16,
'n_sliderWidth': 16,
'n_sliderHeight': 15,
'n_pathLeft' : 1,
'n_pathTop' : 1,
'n_pathLength' : 103,
's_imgControl': 'js/img/blueh_bg.gif',
's_imgSlider': 'js/img/blueh_sl.gif',
'n_zIndex': 1
}
var A_INIT1 = {
's_form' : 0,
's_name': 'sliderValue1',
'n_minValue' : 0,
'n_maxValue' : 50,
'n_value' : 1,
'n_step' : 1
}
new slider(A_INIT1, A_TPL);
\ No newline at end of file
var A_TPL = {
'b_vertical' : false,
'b_watch': true,
'n_controlWidth': 120,
'n_controlHeight': 16,
'n_sliderWidth': 16,
'n_sliderHeight': 15,
'n_pathLeft' : 1,
'n_pathTop' : 1,
'n_pathLength' : 103,
's_imgControl': 'js/img/blueh_bg.gif',
's_imgSlider': 'js/img/blueh_sl.gif',
'n_zIndex': 1
}
var A_INIT1 = {
's_form' : 0,
's_name': 'sliderValue2',
'n_minValue' : 0,
'n_maxValue' : 50,
'n_value' : 1,
'n_step' : 1
}
new slider(A_INIT1, A_TPL);
\ No newline at end of file
<?php
require_once( 'db_config.php');
require_once( 'class/db.class.php');
require_once( 'var.php');
$grundconfig = $datenbank->get_row("SELECT * FROM ". PREFIX . CONFIG ." ",true);
require_once( 'session.lib.php');
require_once( 'lang/lang.'. $_SESSION['lang'] .'.php');
require_once ( 'functions.lib.php');
require_once ( 'run.inc.php');
require_once ( 'layout.lib.php');
require_once ( 'extras.lib.php');
require_once ( 'extra/mail.php');
ReloadDelete();
if (!isset($_GET['page']) || empty ($_GET['page'])) $_GET['page'] = '/intern/startseite';
if (!file_exists('page' . $_GET['page'] . '.php')) $_GET['page'] = '/error/keine_seite';
if ($_GET['page'] == '/intern/startseite') require_once ( 'texte/alt_startseitenpopup.txt');
if ($_GET['page'] == '/betteln') require_once ( 'texte/alt_bettelseitenpopup.txt');
LoadLanguageFile();
CheckLogin();
$CountDownTime = 0;
$start_reload = "SELECT * FROM ". PREFIX . RELOAD ." WHERE uid = '".$datenbank->escape($_SESSION['uid']) ."' and tan = 'startseitenaufruf' and bis >= '". time() ."'";
if ($datenbank->num_rows($start_reload) != 0) {
$start = $datenbank->get_row($start_reload,true);
$CountDownTime = $start->bis;
}
?>
\ No newline at end of file
<?php
require("datenbank.inc.php");
require_once("class/chat.class.php");
$id = intval( $_GET['lastTimeID'] );
$jsonData = chatClass::getRestChatLines($id);
//db_query("INSERT INTO json (text) VALUES ('". $jsonData ."')");
print $jsonData;
?>
\ No newline at end of file
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/lib/db_config.php");
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/functions.lib.php');
$datenbank = Classloader('db');
$grundconfig = $datenbank->get_row("SELECT * FROM ". PREFIX . CONFIG ." ",true);
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/session.lib.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/class/chat.class.php');
$id = intval( $_GET['lastTimeID'] );
$Class = Classloader('chat');
print $Class->getRestChatLines($id);
?>
<?php
class ANMELDEN{
protected $uid;
protected $ak;
protected $werber;
private $db;
private $error = 0;
private $meldung;
private $post = array();
private $config;
private $session;
public function __construct(){
global $datenbank,$grundconfig,$_SESSION;
$this->db = $datenbank;
$this->config = $grundconfig;
$this->session = $_SESSION;
}
private function make_array($post){
foreach($post AS $key => $value){
if($key != '' && $value != ''){
$this->post[$key] = $this->db->escape($value);
}
}
}
function anmelden_los(){
global $_POST;
$this->make_array($_POST);
$this->pruef();
if($this->error == 0){
$this->konto();
$this->email();
$this->user();
$this->werber();
$this->nickpage();
if($this->grundconfig->reg_free == 1){
$this->aktivierung();
$this->ak_senden();
}
if($this->error == 0){
return true;
}else{
return false;
}
}
meldung($this->error,$this->meldung);
}
function ak_senden(){
$betreff = "Ihre Anmeldung auf ". $this->config->seitenname;
$email_message = 'Hallo ' . $this->post['nickname'] . ',
Du hast Dich soeben erfolgreich bei ' . $this->config->seitenname . ' angemeldet.
Bitte aktiviere jetzt Deinen Account, klicke dazu bitte auf den
Aktivierungslink: ' . $this->config->domain . '/?page=/intern/aktivieren&ak=' . $this->ak . '
----------------------------------------------------------
Kontonummer: ' . $this->uid . '
Passwort: Ihnen bekannt*
----------------------------------------------------------
Nach der Aktivierung kannst Du dich sofort einloggen und bei
uns teilnehmen.
Mit freundlichen Grüßen
Das ' . $this->config->seitenname . ' Team
';
$Class = Classloader('mail');
$Class->senden($_POST['emailadresse'],$betreff,$email_message);
}
function aktivierung(){
$this->ak = md5($this->uid . time() );
$insert = array(
"uid" => $this->uid,
"ak" => $this->ak
);
$this->db->insert(PREFIX . AKT , $insert);
}
function nickpage(){
$insert = array(
"uid" => $this->uid
);
$this->db->insert(PREFIX . NICKP, $insert);
}
function werber(){
$insert = array(
"uid" => $this->uid,
"werber" => $this->session['werber'],
"umsatz" => 0,
"zuordnungszeit" => time()
);
$this->db->insert(PREFIX . WERBER , $insert);
}
function user(){
$insert = array(
"uid" => $this->uid,
"nickname" => $this->post['nickname'],
"vorname" => $this->post['vorname'],
"nachname" => $this->post['nachname'],
"angemeldet_seit" => time(),
"bdate" => $this->bdate($this->post['bdate'])
);
$this->db->insert(PREFIX . USER , $insert);
}
function konto(){
$pw = pw_erstellen($this->post['password1']);
$this->db->insert(PREFIX . KONTO, array("passwort" => $pw, "status" => 0));
$this->uid = $this->db->lastid();
}
function email(){
$insert = array(
"uid" => $this->uid,
"emailadresse" => $this->post['emailadresse'],
"freigabe_fuer" => $this->post['newsletter']
);
$this->db->insert(PREFIX . EMAIL , $insert);
}
function bdate($date){
$explode = explode(".",$date,100);
$bdate = strtotime($date.'T 00:00:00');
return $bdate;
}
function pruef(){
if(empty($this->post['nachname'])){ $this->error = 1; $this->meldung .= ANMELDEN_NAME_FALSE;}
if(empty($this->post['bdate'])){ $this->error = 1; $this->meldung .= ANMELDEN_GEB_FALSE;}
if(empty($this->post['vorname'])){ $this->error = 1; $this->meldung .= ANMELDEN_VORNAME_FALSE;}
$this->mailadresse($this->post['emailadresse']);
$this->nickname($this->post['nickname']);
$this->pass($this->post['password1'],$_POST['password2']);
if($this->post['agb'] != "ja"){ $this->error = 1; $this->meldung .= ANEMLDEN_AGB_FALSE; }
}
function mail_denied($mail){
$denied = explode(';', $this->config->denied_domains);
if($this->config->ip_erlaubt != ''){
$ip_denied = explode(',', $this->config->ip_erlaubt);
if(!in_array(geoIP($ip),$ip_denied)){
$this->error = 1;
$this->meldung .= ANMELDEN_IP_FALSE;}
}
foreach ($denied AS $nr => $emaildomain){
if (($nr < (count ($denied) - 2) || strlen ($emaildomain) >= 5) && strpos ($mail, $emaildomain) !== false){
$this->error = 1;
$this->meldung .= ANMELDEN_MAIL_ANBIETER_FALSE;
}
}
}
function mailadresse($mail){
if(!filter_var( $mail, FILTER_VALIDATE_EMAIL )) { $this->error = 1; $this->meldung .= ANMELDEN_EMAIL_FALSE;}
$select = $this->db->num_rows("SELECT * FROM ". PREFIX . EMAIL ." WHERE emailadresse = '$mail' ");
if($select == true){
$this->error = 1;
$this->meldung .= ANMELDEN_MAIL_EXIST;
}
$this->mail_denied($mail);
}
function pass($pass1,$pass2){
if(empty($pass1)){ $this->error = 1; $this->meldung .= ANMELDEN_PASS1_FALSE;}
if(empty($pass2)){ $this->error = 1; $this->meldung .= ANMELDEN_PASS2_FALSE;}
if($pass1 != $pass2){ $this->error = 1; $this->meldung .= ANMELDEN_PASS_KONTROLLE_FALSE;}
if(strlen($pass1) < 8){ $this->error = 1; $this->meldung .= ANMELDEN_PASS_SHORT; }
}
function nickname($nick){
if(empty($nick)){$this->error = 1; $this->meldung = ANMELDEN_NICKNAME_FALSE;}
$select = $this->db->exists(PREFIX . USER , 'nickname', array("nickname" => $nick));
if($select == true){
$this->error = 1;
$this->meldung .= ANMLEDEN_NICKNAME_EXIST;
}
}
}
?>
<?php
class bettel{
private $db;
private $session = array();
private $gconfig;
private $config;
private $uid = 0;
private $error = 0;
private $meldung = '';
private $cookie = 0;
private $ip;
private $refferer;
private $server;
private $url;
function __construct(){
global $_SESSION,$datenbank,$grundconfig,$_SERVER;
$this->url = new stdClass;
$this->db = $datenbank;
$this->session = $this->db->escape($_SESSION);
$this->gconfig = $grundconfig;
$this->ip = $_SERVER['REMOTE_ADDR'];
if(isset($_SERVER['HTTP_REFERER'])){
$this->refferer = $this->db->escape($_SERVER['HTTP_REFERER']);
}else{
$this->refferer = 'direktaufruf';
}
}
public function Top25(){
$aus = '';
$rang = 1;
$result = $this->db->get_results('SELECT k.uid, k.angebettelt, k.bv, u.nickname FROM ' . PREFIX . KONTO . ' k LEFT JOIN ' . PREFIX . USER . ' u ON u.uid = k.uid WHERE k.angebettelt > 0 ORDER BY angebettelt DESC LIMIT 25');
foreach($result AS $res){
$aus .= '
<tr>
<td>' . $rang++ . '.&nbsp;</td>
<td>&nbsp;' . $res->nickname . '</td>
<td align="right">' . number_format($res->angebettelt, 0) . '&nbsp;</td>
<td align="right">' . number_format($res->bv, 2, ',', '.') . ' ' . $this->config->waehrung . '&nbsp;</td>
</tr>
';
}
return $aus;
}
private function AngebetteltPruef(){
if($this->session['uid'] == $this->uid || $this->uid == $this->cookie){
$this->error = 1;
$this->meldung = BETTEL_SELF_TRUE;
}
}
private function ReloadCheck(){
if($this->db->num_rows("SELECT bis FROM " . PREFIX . RELOAD . " WHERE ip = '$this->ip' and tan = 'bettelaufruf' and bis >= " . time() . " LIMIT 1") == 1){
$this->error = 1;
$this->meldung = BETTEL_RELOAD_TRUE;
}
}
private function BettelSperre(){
if($this->db->num_rows("SELECT uid FROM ". PREFIX . KONTO ." WHERE uid = '$this->uid' AND bettel_sperre = '1' ") != 0){
$this->error = 1;
$this->meldung = BETTEL_SPERRE_TRUE;
}
}
private function CheckReferer(){
if(!isset($this->server['HTTP_REFERER'])){
$this->server['HTTP_REFERER'] = 'kein Referer';
$this->url->host = 'direktaufruf';
}else{
$url = parse_url($this->server);
$this->url->host = $url['host'];
}
}
private function BettelAuszahlung(){
$this->CheckReferer();
$bettelsumme = rand($this->gconfig->min_betteln * 100, $this->gconfig->max_betteln * 100) / 100;
$new_reload = time() + $this->gconfig->reload_betteln;
$bettelb = array(
"uid" => $this->uid,
"refferer" => $this->server['HTTP_REFERER'],
"url" => 'https://'.$this->url->host,
"betrag" => $bettelsumme,
"zeit" => time(),
"status" => 1
);
//$this->db->insert(PREFIX . RELOAD, array("ip" => $this->ip,"uid" => $this->uid ,"tan" => 'bettelaufruf',"bis" => $new_reload) );
if($this->gconfig->bettel_direkt == 1 && $this->db->num_rows("SELECT id FROM ". PREFIX . BETTELURLS ." WHERE url = '". $bettelb['refferer'] ."' ") == 0){
$this->db->query("UPDATE ". PREFIX . KONTO ." SET angebettelt = angebettelt + 1, bv = bv + $bettelsumme, kontostand_a = kontostand_a + $bettelsumme WHERE uid = '$this->uid' ");
$bilanz = Classloader('bilanz');
refumsatz ($bettelsumme, $this->uid);
rallysystem ($this->uid, '6', $bettelsumme);
$bilanz->bilanz(0,$bettelsumme,'werbekosten','Bettellink');
$this->meldung = '<b>Du hast für den User ' . $this->uid . ' gerade ' . $bettelsumme . ' ' . $this->gconfig->waehrung . ' erbettelt!</b>';
}else{
$bettelb['status'] = 0;
$this->meldung = 'Leider konnte dein Aufruf nicht gewertet werden, da du keinen Referer &uuml;bergeben hast.';
}
$this->db->insert(PREFIX . BETTELB, $bettelb,1);
}
public function BettelAufruf($get,$cookie,$server){
$this->server = $server;
if(isset($cookie['uid'])){
if(is_numeric($cookie['uid'])){$this->cookie = $cookie['uid'];}
}
if(is_numeric($get['ref'])){ $this->uid = $get['ref'];}
if($this->gconfig->reload_betteln > 0){
$this->AngebetteltPruef();
if($this->error == 0){ $this->ReloadCheck();}
if($this->error == 0){ $this->BettelSperre();}
if($this->error == 0){ $this->BettelAuszahlung();}
}else{
$this->error = 1;
$this->meldung = BETTEL_NOT_ACTIVE;
}
return $aus = array("error" => $this->error, "meldung" => $this->meldung);
}
}
?>
<?php
class bilanz{
private $db;
function __construct(){
global $datenbank;
$this->db = $datenbank;
}
/**
* bilanz()
*
* @author vms1-scripte.de
* @category system
* @example bilanz(100,0,Spiele,Slotname);
* @param number $ein einnahme
* @param number $aus ausgabe
* @param number $gruppe Die Gruppe in die die Bilanz fallen soll
* @param number $was Der Name der in der Gruppe angezeigt werden soll
* @return keine
*/
public function bilanz ($ein,$aus,$gruppe,$name) {
if(empty($ein)){ $ein = 0;}
if(empty($aus)){ $aus = 0;}
$datum = mktime(0,0,0,date("m",time()),date("d",time()),date("Y",time()));
$array = array(
"ein" => $this->db->escape($ein),
"aus" => $this->db->escape($aus),
"datum" => $datum,
"gruppe" => $this->db->escape($gruppe),
"name" => $this->db->escape($name)
);
$query = "SELECT id,ein,aus FROM ". PREFIX . BILANZ ." WHERE datum = '". $datum ."' AND name = '". $name ."' ";
if($this->db->num_rows($query) == 0){
$this->db->insert(PREFIX . BILANZ,$array);
}else{
$row = $this->db->get_row($query,true);
$ein_neu = $row->ein + $array['ein'];
$aus_neu = $row->aus + $array['aus'];
$this->db->update(PREFIX . BILANZ,array("aus" => $aus_neu, "ein" => $ein_neu), array("datum" => $datum, "name" => $name));
}
}
}
<?php
class buchungsliste{
private $db;
private $minus = 1;
private $seiteAktuell;
private $SitesComplete;
private $extVariables;
private $session = array();
private $config;
function __construct(){
global $_GET,$datenbank,$_SESSION,$grundconfig;
$this->db = $datenbank;
$this->session = $this->db->escape($_SESSION);
$this->config = $grundconfig;
if(isset($_GET['minus']) && is_numeric($_GET['minus'])){ $this->minus = $_GET['minus'];}
}
public function get_results(){
$result = $this->db->get_results("SELECT * FROM ". PREFIX . BUCH ." WHERE uid = '". $this->session['uid'] ."' ORDER BY id DESC");
$aus = '
<table class="table" id="Buchungsliste">
<thead>
<tr>
<th>#</th>
<th>Datum</th>
<th>Zeit</th>
<th>Betrag</th>
<th>Verwendungszweck</th>
<th>Buchungs-ID</th>
</tr>
</thead>
<tbody>
';
foreach($result AS $res){
$aus .= '
<tr>
<td>'. $res->id .'</td>
<td>'. date("d.m.Y", $res->buchungszeit) .'</td>
<td>'. date("H:i", $res->buchungszeit) .'</td>
<td>'. number_format($res->buchungsmenge,2,',','.') .'</td>
<td>'. $res->verwendungszweck .'</td>
<td>'. $res->buchungs_id .'</td>
</tr>
';
}
$aus .= '
</tbody>
</table>
';
return $aus;
}
}
?>
<?php
class chatClass{
public static function getRestChatLines($id){
global $db_host,$db_user,$db_pass,$db_base;
class chat{
private $db;
private $session = array();
private $array = array();
private $error = 0;
private $meldung = '';
private $ChatSetting;
private $konto;
private $post;
private $smiley = array();
function __construct(){
global $datenbank,$_SESSION,$konto,$_POST;
$this->db = $datenbank;
$this->session = $this->db->escape($_SESSION);
$this->ChatSetting = $this->db->get_row("SELECT sb_reload,sb_verguetung FROM ". PREFIX . CHATSE ." ",true);
$this->konto = $konto;
foreach($_POST AS $key => $value){
if($key == 'inhalt'){
$this->post[$key] = $this->db->escape($value);
}
}
foreach($this->db->get_results("SELECT * FROM ". PREFIX . CHATP ." ") AS $res){
$this->smiley[$res->kurz] = '<img src="images/chat/'. $res->pic .'" alt="'. $res->kurz .'">';
}
}
private function ChattextSmiley($text){
return strtr($text,$this->smiley);
}
public function getRestChatLines($id){
$arr = array();
$jsonData = '{"results":[';
$db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base);
$db_connection = new mysqli( DB_HOST, DB_USER, DB_PASS, DB_BASS);
$db_connection->query( "SET NAMES 'UTF8'" );
$statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM vms_chat WHERE id > ? ");
$statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM ". PREFIX . CHAT ." WHERE id > ?");
$statement->bind_param( 'i', $id);
$statement->execute();
$statement->bind_result( $id, $usrname, $chattext, $chattime);
......@@ -15,8 +46,9 @@ class chatClass{
while ($statement->fetch()) {
$line->id = $id;
$line->usrname = $usrname;
$line->chattext = $chattext;
$line->chattext = $this->ChattextSmiley($chattext);
$line->chattime = date('H:i:s', $chattime);
$line->userpic = IMGtoBase64($this->UserPic($usrname));
$arr[] = json_encode($line);
}
$statement->close();
......@@ -25,16 +57,137 @@ class chatClass{
$jsonData .= ']}';
return $jsonData;
}
private function UserPic($user){
$rowpic = $this->db->get_row("SELECT ava FROM ". PREFIX . USER ." WHERE nickname = '". $user ."' ");
if($rowpic[0] == ''){
$bild = 'default.png';
}else{
$bild = $rowpic[0];
}
return $bild;
}
public static function setChatLines( $chattext, $usrname, $color) {
global $db_host,$db_user,$db_pass,$db_base;
$db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base);
$db_connection = new mysqli( DB_HOST, DB_USER, DB_PASS, DB_BASS);
$db_connection->query( "SET NAMES 'UTF8'" );
$statement = $db_connection->prepare( "INSERT INTO chat( usrname, color, chattext) VALUES(?, ?, ?)");
$statement = $db_connection->prepare( "INSERT INTO ". PREFIX . CHAT ."( usrname, color, chattext) VALUES(?, ?, ?)");
$statement->bind_param( 'sss', $usrname, $color, $chattext);
$statement->execute();
$statement->close();
$db_connection->close();
}
private function make_array($post){
foreach($post AS $key => $value){
if($key != '' && $value != 'Senden'){
$this->post[$key] = $this->db->escape($value);
}
}
}
private function InsertPruef(){
$sperre = $this->db->get_row("SELECT chat_sperre FROM ". PREFIX . KONTO ." WHERE uid = '". $this->session['uid'] ."' ",true);
if($sperre->chat_sperre == '1'){ $this->error = 1; $this->meldung = 'Du bist für den Chat gesperrt.';}
if(empty($this->post['inhalt'])){ $this->error = 1; $this->meldung = 'Bitte Text eingeben.';}
if($this->session['uid'] <= 0){ $this->error = 1; $this->meldung = 'Ung&uuml;ltige User-ID.';}
}
private function InsertPunkte(){
if($this->db->num_rows("SELECT * FROM ". PREFIX . RELOAD ." WHERE uid = '". $this->session['uid'] ."' AND tan = 'sb_reload' AND bis > '". time() ."' ") == 0){
$this->konto->set_var($this->session['uid'],$this->ChatSetting->sb_verguetung,'+','Gutschrift chatbonus');
}
}
private function InsertChat(){
$user = $this->db->get_row("SELECT nickname FROM ". PREFIX . USER ." WHERE uid = '". $this->session['uid'] ."' ",true);
$InsertArray = array(
"absender" => $user->nickname,
"nachricht" => $this->post['inhalt'],
"time" => time()
);
$this->db->insert(PREFIX . CHAT,$InsertArray);
}
public function Insert($post){
$this->make_array($post);
$this->InsertPruef();
if($this->error == 0){
$this->InsertPunkte();
$this->InsertChat();
}
meldung($this->error,$this->meldung);
}
private function Seiten(){
$aus = '<div class="btn-group" role="group" aria-label="Basic example">';
$anzahl = ceil($this->db->num_rows("SELECT id FROM ". PREFIX . CHAT ." ")/50);
for($i = 1; $i <= $anzahl; $i++){
$aus .= '<a href="?content=/chat/archiv&seite='. $i .'" class="btn btn-secondary">'. $i .'</a>';
}
$aus .= '</div>';
return $aus;
}
private function navigationsLeiste($seite,$art,$link){
$string = '';
$extVariables = '';
$SitesComplete = ceil($this->db->num_rows("SELECT id FROM ". PREFIX . CHAT ." ")/50);
$NavCeil = floor(NAV_LEISTE / 2);
if($seite > 1){
$string .= '<a class="btn btn-light" href="'. $link .'&'.$art.'=1'.$extVariables.'"><<</a>&nbsp;&nbsp;';
$string .= '<a class="btn btn-light" href="'. $link .'&'.$art.'='.($seite-1).$extVariables.'">
<</a>&nbsp;&nbsp;';
}
for($x=$seite-$NavCeil;$x<=$seite+$NavCeil;$x++){
// Alle Seitenzahlen vor und nach der aktuellen Seite verlinken
if(($x>0 && $x<$seite) || ($x>$seite && $x<=$SitesComplete))
$string .= '<a class="btn btn-light" href="'. $link .'&'.$art.'='.$x.$extVariables.'">'.$x.'</a>&nbsp;&nbsp;';
if($x==$seite)
$string .= '<button class="btn btn-primary" disabled="disabled">'.$x . '</button>';
}
if($seite < $SitesComplete){
$string .= '<a class="btn btn-light" href="'. $link .'&'.$art.'='.($seite+1).$extVariables.'">>
</a>&nbsp;&nbsp;';
$string .= '<a class="btn btn-light" href="'. $link .'&'.$art.'='.$SitesComplete.$extVariables.'">>>
</a>&nbsp;&nbsp;';
}
return $string;
}
public function Archive($seite){
$start = $seite * 50 - 50;
$aus = '<ul class="list-group">';
foreach($this->db->get_results("SELECT * FROM ". PREFIX . CHAT ." ORDER BY id DESC LIMIT $start,50") AS $res){
$aus .= '
<li class="list-group-item">
<div class="row">
<div class="col-md-2 text-left">
<img alt="'. $res->absender .'" src="'. IMGtoBase64($this->UserPic($res->absender)) .'" class="img-thumbnail rounded-circle" width="30">'. $res->absender .'<br>
<small>'. date("d.m.Y H:i", $res->time) .'</small>
</div>
<div class="col-md-10 text-left">
'. $res->nachricht .'
</div>
</div>
</li>
';
}
$aus .= '</ul><hr>';
$aus .= '<div class="text-center">'.$this->navigationsLeiste($seite,"seite","?content=/chat/archiv").'</div>';
return $aus;
}
public function Smileys(){
$aus = '';
foreach($this->db->get_results("SELECT * FROM ". PREFIX . CHATP ." ") AS $res){
$aus .= '<img src="'. IMGtoBase64($res->pic, 'chat') .'" onclick="InputValueAdd(\''. $res->kurz .'\');" class="avatar img-circle img-thumbnail" alt="avatar">';
}
return $aus;
}
}
?>
\ No newline at end of file
?>
<?php
class daten{
private $mail;
private $db;
private $gconfig;
private $error;
private $meldung;
private $mail;
public function __construct(){
global $datenbank,$grundconfig;
$this->db = $datenbank;
$this->gconfig = $grundconfig;
$this->mail = Classloader('mail');
}
public function user_suche($mailad){
$user = $this->db->exists(PREFIX . EMAIL , 'uid', array("emailadresse" => $datenbank->escape($mailad) ));
if($user == true){
$u = $this->db->get_row("SELECT uid FROM ". PREFIX . EMAIL . " WHERE emailadresse = '". $datenbank->escape($mailad) ."' ", true);
$uid = $u->uid;
$this->pw_neu($uid,$mailad);
}else{
$error = 1;
$meldung = PASSWORT_SET_USER_FALSE;
}
}
public function pw_neu($user,$mailad){
$pw_roh = create_code(10);
$pw_neu = pw_erstellen($pw_roh);
if($this->db->update( PREFIX . KONTO , array("passwort" => $pw_neu), array("uid" => $user),1 ) == true){
$this->pw_update($mailad,$user,$pw_roh);
}else{
$error = 1;
$meldung = PASSWORT_ERROR_SET;
}
}
private function pw_update($mailad,$user,$pw){
$betreff = 'Anforderung Passwort';
$nachricht =
'Hallo,
Du hast soeben die Zugangsdaten für '.$this->gconfig->seitenname.' angefordert.
----------------------------------------------------------
Kontonummer: '.$user.'
Passwort: '.$pw.'
----------------------------------------------------------
Jetzt kannst Du dich wieder auf '.$this->gconfig->domain.'
einloggen und das Passwort wieder ändern!
Mit freundlichen Grüßen
Das '.$grundconfig->seitenname.' Team
';
if($this->mail->senden($mailad,$betreff,$nachricht) == true){
$meldung = PASSWORT_SET_USER_TRUE;
$error = 0;
}else{
$meldung = PASSWORT_SET_USER_SEND_FALSE;
$error = 1;
}
return $error;
return $meldung;
}
}
?>
\ No newline at end of file
<?php
class DB
{
private $link = null;
public $filter;
static $inst = null;
public static $counter = 0;
/**
* Allow the class to send admins a message alerting them to errors
* on production sites
*
* @access public
* @param string $error
* @param string $query
* @return mixed
*/
public function log_db_errors( $error, $query )
{
$message = '<p>Error at '. date('Y-m-d H:i:s').':</p>';
$message .= '<p>Query: '. htmlentities( $query ).'<br />';
$message .= 'Error: ' . $error;
$message .= '</p>';
if( defined( 'SEND_ERRORS_TO' ) )
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: Admin <'.SEND_ERRORS_TO.'>' . "\r\n";
$headers .= 'From: Yoursite <system@'.$_SERVER['SERVER_NAME'].'.com>' . "\r\n";
mail( SEND_ERRORS_TO, 'Database Error', $message, $headers );
}
else
{
trigger_error( $message );
}
if( !defined( 'DISPLAY_DEBUG' ) || ( defined( 'DISPLAY_DEBUG' ) && DISPLAY_DEBUG ) )
{
echo $message;
}
}
public function __construct()
{
mb_internal_encoding( 'UTF-8' );
mb_regex_encoding( 'UTF-8' );
mysqli_report( MYSQLI_REPORT_STRICT );
try {
$this->link = new mysqli( DB_HOST, DB_USER, DB_PASS, DB_BASS );
$this->link->set_charset( "utf8" );
} catch ( Exception $e ) {
die( 'Unable to connect to database' );
}
}
public function __destruct()
{
if( $this->link)
{
$this->disconnect();
}
}
/**
* Sanitize user data
*
* Example usage:
* $user_name = $database->filter( $_POST['user_name'] );
*
* Or to filter an entire array:
* $data = array( 'name' => $_POST['name'], 'email' => 'email@address.com' );
* $data = $database->filter( $data );
*
* @access public
* @param mixed $data
* @return mixed $data
*/
public function filter( $data )
{
if( !is_array( $data ) )
{
$data = $this->link->real_escape_string( $data );
$data = trim( htmlentities( $data, ENT_QUOTES, 'UTF-8', false ) );
}
else
{
//Self call function to sanitize array data
$data = array_map( array( $this, 'filter' ), $data );
}
return $data;
}
/**
* Extra function to filter when only mysqli_real_escape_string is needed
* @access public
* @param mixed $data
* @return mixed $data
*/
public function escape( $data )
{
if( !is_array( $data ) )
{
$data = $this->link->real_escape_string( $data );
}
else
{
//Self call function to sanitize array data
$data = array_map( array( $this, 'escape' ), $data );
}
return $data;
}
/**
* Normalize sanitized data for display (reverse $database->filter cleaning)
*
* Example usage:
* echo $database->clean( $data_from_database );
*
* @access public
* @param string $data
* @return string $data
*/
public function clean( $data )
{
$data = stripslashes( $data );
$data = html_entity_decode( $data, ENT_QUOTES, 'UTF-8' );
$data = nl2br( $data );
$data = urldecode( $data );
return $data;
}
/**
* Determine if common non-encapsulated fields are being used
*
* Example usage:
* if( $database->db_common( $query ) )
* {
* //Do something
* }
* Used by function exists
*
* @access public
* @param string
* @param array
* @return bool
*
*/
public function db_common( $value = '' )
{
if( is_array( $value ) )
{
foreach( $value as $v )
{
if( preg_match( '/AES_DECRYPT/i', $v ) || preg_match( '/AES_ENCRYPT/i', $v ) || preg_match( '/now()/i', $v ) )
{
return true;
}
else
{
return false;
}
}
}
else
{
if( preg_match( '/AES_DECRYPT/i', $value ) || preg_match( '/AES_ENCRYPT/i', $value ) || preg_match( '/now()/i', $value ) )
{
return true;
}
}
}
/**
* Perform queries
* All following functions run through this function
*
* @access public
* @param string
* @return string
* @return array
* @return bool
*
*/
public function query( $query )
{
$full_query = $this->link->query( $query );
if( $this->link->error )
{
$this->log_db_errors( $this->link->error, $query );
return false;
}
else
{
return true;
}
}
public function queryInstall( $query )
{
$full_query = $this->link->query( $query );
if( $this->link->error )
{
}
else
{
return true;
}
}
/**
* Determine if database table exists
* Example usage:
* if( !$database->table_exists( 'checkingfortable' ) )
* {
* //Install your table or throw error
* }
*
* @access public
* @param string
* @return bool
*
*/
public function table_exists( $name )
{
self::$counter++;
$check = $this->link->query( "SELECT 1 FROM $name" );
if($check !== false)
{
if( $check->num_rows > 0 )
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
/**
* Count number of rows found matching a specific query
*
* Example usage:
* $rows = $database->num_rows( "SELECT id FROM users WHERE user_id = 44" );
*
* @access public
* @param string
* @return int
*
*/
public function num_rows( $query )
{
self::$counter++;
$num_rows = $this->link->query( $query );
if( $this->link->error )
{
$this->log_db_errors( $this->link->error, $query );
return $this->link->error;
}
else
{
return $num_rows->num_rows;
}
}
/**
* Run check to see if value exists, returns true or false
*
* Example Usage:
* $check_user = array(
* 'user_email' => 'someuser@gmail.com',
* 'user_id' => 48
* );
* $exists = $database->exists( 'your_table', 'user_id', $check_user );
*
* @access public
* @param string database table name
* @param string field to check (i.e. 'user_id' or COUNT(user_id))
* @param array column name => column value to match
* @return bool
*
*/
public function exists( $table = '', $check_val = '', $params = array() )
{
self::$counter++;
if( empty($table) || empty($check_val) || empty($params) )
{
return false;
}
$check = array();
foreach( $params as $field => $value )
{
if( !empty( $field ) && !empty( $value ) )
{
//Check for frequently used mysql commands and prevent encapsulation of them
if( $this->db_common( $value ) )
{
$check[] = "$field = $value";
}
else
{
$check[] = "$field = '$value'";
}
}
}
$check = implode(' AND ', $check);
$rs_check = "SELECT $check_val FROM ".$table." WHERE $check";
$number = $this->num_rows( $rs_check );
if( $number === 0 )
{
return false;
}
else
{
return true;
}
}
/**
* Return specific row based on db query
*
* Example usage:
* list( $name, $email ) = $database->get_row( "SELECT name, email FROM users WHERE user_id = 44" );
*
* @access public
* @param string
* @param bool $object (true returns results as objects)
* @return array
*
*/
public function get_row( $query, $object = false )
{
self::$counter++;
$row = $this->link->query( $query );
if( $this->link->error )
{
$this->log_db_errors( $this->link->error, $query );
return false;
}
else
{
$r = ( !$object ) ? $row->fetch_row() : $row->fetch_object();
return $r;
}
}
/**
* Perform query to retrieve array of associated results
*
* Example usage:
* $users = $database->get_results( "SELECT name, email FROM users ORDER BY name ASC" );
* foreach( $users as $user )
* {
* echo $user['name'] . ': '. $user['email'] .'<br />';
* }
*
* @access public
* @param string
* @param bool $object (true returns object)
* @return array
*
*/
public function get_results( $query, $object = false )
{
self::$counter++;
//Overwrite the $row var to null
$row = null;
$results = $this->link->query( $query );
if( $this->link->error )
{
$this->log_db_errors( $this->link->error, $query );
return false;
}
else
{
$row = new stdClass();
$i = 1;
while( $r = ( !$object ) ? $results->fetch_object() : $results->fetch_object() )
{
$row->{$i} = $r;
$i++;
}
return $row;
}
}
/**
* Insert data into database table
*
* Example usage:
* $user_data = array(
* 'name' => 'Bennett',
* 'email' => 'email@address.com',
* 'active' => 1
* );
* $database->insert( 'users_table', $user_data );
*
* @access public
* @param string table name
* @param array table column => column value
* @return bool
*
*/
public function insert( $table, $variables = array() )
{
self::$counter++;
//Make sure the array isn't empty
if( empty( $variables ) )
{
return false;
}
$sql = "INSERT INTO ". $table;
$fields = array();
$values = array();
foreach( $variables as $field => $value )
{
$fields[] = $field;
$values[] = "'".$value."'";
}
$fields = ' (' . implode(', ', $fields) . ')';
$values = '('. implode(', ', $values) .')';
$sql .= $fields .' VALUES '. $values;
$query = $this->link->query( $sql );
if( $this->link->error )
{
//return false;
$this->log_db_errors( $this->link->error, $sql );
return false;
}
else
{
return true;
}
}
/**
* Insert data KNOWN TO BE SECURE into database table
* Ensure that this function is only used with safe data
* No class-side sanitizing is performed on values found to contain common sql commands
* As dictated by the db_common function
* All fields are assumed to be properly encapsulated before initiating this function
*
* @access public
* @param string table name
* @param array table column => column value
* @return bool
*/
public function insert_safe( $table, $variables = array() )
{
self::$counter++;
//Make sure the array isn't empty
if( empty( $variables ) )
{
return false;
}
$sql = "INSERT INTO ". $table;
$fields = array();
$values = array();
foreach( $variables as $field => $value )
{
$fields[] = $this->filter( $field );
//Check for frequently used mysql commands and prevent encapsulation of them
$values[] = $value;
}
$fields = ' (' . implode(', ', $fields) . ')';
$values = '('. implode(', ', $values) .')';
$sql .= $fields .' VALUES '. $values;
$query = $this->link->query( $sql );
if( $this->link->error )
{
$this->log_db_errors( $this->link->error, $sql );
return false;
}
else
{
return true;
}
}
/**
* Insert multiple records in a single query into a database table
*
* Example usage:
* $fields = array(
* 'name',
* 'email',
* 'active'
* );
* $records = array(
* array(
* 'Bennett', 'bennett@email.com', 1
* ),
* array(
* 'Lori', 'lori@email.com', 0
* ),
* array(
* 'Nick', 'nick@nick.com', 1, 'This will not be added'
* ),
* array(
* 'Meghan', 'meghan@email.com', 1
* )
* );
* $database->insert_multi( 'users_table', $fields, $records );
*
* @access public
* @param string table name
* @param array table columns
* @param nested array records
* @return bool
* @return int number of records inserted
*
*/
public function insert_multi( $table, $columns = array(), $records = array() )
{
self::$counter++;
//Make sure the arrays aren't empty
if( empty( $columns ) || empty( $records ) )
{
return false;
}
//Count the number of fields to ensure insertion statements do not exceed the same num
$number_columns = count( $columns );
//Start a counter for the rows
$added = 0;
//Start the query
$sql = "INSERT INTO ". $table;
$fields = array();
//Loop through the columns for insertion preparation
foreach( $columns as $field )
{
$fields[] = '`'.$field.'`';
}
$fields = ' (' . implode(', ', $fields) . ')';
//Loop through the records to insert
$values = array();
foreach( $records as $record )
{
//Only add a record if the values match the number of columns
if( count( $record ) == $number_columns )
{
$values[] = '(\''. implode( '\', \'', array_values( $record ) ) .'\')';
$added++;
}
}
$values = implode( ', ', $values );
$sql .= $fields .' VALUES '. $values;
$query = $this->link->query( $sql );
if( $this->link->error )
{
$this->log_db_errors( $this->link->error, $sql );
return false;
}
else
{
return $added;
}
}
/**
* Update data in database table
*
* Example usage:
* $update = array( 'name' => 'Not bennett', 'email' => 'someotheremail@email.com' );
* $update_where = array( 'user_id' => 44, 'name' => 'Bennett' );
* $database->update( 'users_table', $update, $update_where, 1 );
*
* @access public
* @param string table name
* @param array values to update table column => column value
* @param array where parameters table column => column value
* @param int limit
* @return bool
*
*/
public function update( $table, $variables = array(), $where = array(), $limit = '' )
{
self::$counter++;
//Make sure the required data is passed before continuing
//This does not include the $where variable as (though infrequently)
//queries are designated to update entire tables
if( empty( $variables ) )
{
return false;
}
$sql = "UPDATE ". $table ." SET ";
foreach( $variables as $field => $value )
{
$updates[] = "`$field` = '$value'";
}
$sql .= implode(', ', $updates);
//Add the $where clauses as needed
if( !empty( $where ) )
{
foreach( $where as $field => $value )
{
$value = $value;
$clause[] = "$field = '$value'";
}
$sql .= ' WHERE '. implode(' AND ', $clause);
}
if( !empty( $limit ) )
{
$sql .= ' LIMIT '. $limit;
}
$query = $this->link->query( $sql );
if( $this->link->error )
{
$this->log_db_errors( $this->link->error, $sql );
return false;
}
else
{
return true;
}
}
/**
* Delete data from table
*
* Example usage:
* $where = array( 'user_id' => 44, 'email' => 'someotheremail@email.com' );
* $database->delete( 'users_table', $where, 1 );
*
* @access public
* @param string table name
* @param array where parameters table column => column value
* @param int max number of rows to remove.
* @return bool
*
*/
public function delete( $table, $where = array(), $limit = '' )
{
self::$counter++;
//Delete clauses require a where param, otherwise use "truncate"
if( empty( $where ) )
{
return false;
}
$sql = "DELETE FROM ". $table;
foreach( $where as $field => $value )
{
$value = $value;
$clause[] = "$field = '$value'";
}
$sql .= " WHERE ". implode(' AND ', $clause);
if( !empty( $limit ) )
{
$sql .= " LIMIT ". $limit;
}
$query = $this->link->query( $sql );
if( $this->link->error )
{
//return false; //
$this->log_db_errors( $this->link->error, $sql );
return false;
}
else
{
return true;
}
}
/**
* Get last auto-incrementing ID associated with an insertion
*
* Example usage:
* $database->insert( 'users_table', $user );
* $last = $database->lastid();
*
* @access public
* @param none
* @return int
*
*/
public function lastid()
{
self::$counter++;
return $this->link->insert_id;
}
/**
* Return the number of rows affected by a given query
*
* Example usage:
* $database->insert( 'users_table', $user );
* $database->affected();
*
* @access public
* @param none
* @return int
*/
public function affected()
{
return $this->link->affected_rows;
}
/**
* Get number of fields
*
* Example usage:
* echo $database->num_fields( "SELECT * FROM users_table" );
*
* @access public
* @param query
* @return int
*/
public function num_fields( $query )
{
self::$counter++;
$query = $this->link->query( $query );
$fields = $query->field_count;
return $fields;
}
/**
* Get field names associated with a table
*
* Example usage:
* $fields = $database->list_fields( "SELECT * FROM users_table" );
* echo '<pre>';
* print_r( $fields );
* echo '</pre>';
*
* @access public
* @param query
* @return array
*/
public function list_fields( $query )
{
self::$counter++;
$query = $this->link->query( $query );
$listed_fields = $query->fetch_fields();
return $listed_fields;
}
/**
* Truncate entire tables
*
* Example usage:
* $remove_tables = array( 'users_table', 'user_data' );
* echo $database->truncate( $remove_tables );
*
* @access public
* @param array database table names
* @return int number of tables truncated
*
*/
public function truncate( $tables = array() )
{
if( !empty( $tables ) )
{
$truncated = 0;
foreach( $tables as $table )
{
$truncate = "TRUNCATE TABLE `".trim($table)."`";
$this->link->query( $truncate );
if( !$this->link->error )
{
$truncated++;
self::$counter++;
}
}
return $truncated;
}
}
/**
* Output results of queries
*
* @access public
* @param string variable
* @param bool echo [true,false] defaults to true
* @return string
*
*/
public function display( $variable, $echo = true )
{
$out = '';
if( !is_array( $variable ) )
{
$out .= $variable;
}
else
{
$out .= '<pre>';
$out .= print_r( $variable, TRUE );
$out .= '</pre>';
}
if( $echo === true )
{
echo $out;
}
else
{
return $out;
}
}
/**
* Output the total number of queries
* Generally designed to be used at the bottom of a page after
* scripts have been run and initialized as needed
*
* Example usage:
* echo 'There were '. $database->total_queries() . ' performed';
*
* @access public
* @param none
* @return int
*/
public function total_queries()
{
return self::$counter;
}
/**
* Singleton function
*
* Example usage:
* $database = DB::getInstance();
*
* @access private
* @return self
*/
static function getInstance()
{
if( self::$inst == null )
{
self::$inst = new DB();
}
return self::$inst;
}
/**
* Disconnect from db server
* Called automatically from __destruct function
*/
public function disconnect()
{
$this->link->close();
}
} //end class DB
?>
<?php
if(isset($_POST['id'])){
require_once("lib/schnittstellen/".$_POST['id'] .".php");
}
class ein_aus_zahlung{
private $uid;
private $betrag;
private $pass;
private $schnitt;
private $m_konto;
private $art;
private $db;
private $session = array();
private $error = 0;
private $meldung;
private $array = array();
function __construct(){
global $datenbank,$_SESSION;
$this->db = $datenbank;
$this->session = $this->db->escape($_SESSION);
}
public function set_art($art){
$this->art = $art;
}
public function set_uid($uid){
if(!is_numeric($uid)){ $this->uid = 0; $error = 1;}else{ $this->uid = $uid;}
}
public function set_betrag($betrag){
if(!is_numeric($betrag)){ $this->betrag = 0; $this->error = 1;}else{ $this->betrag = $betrag;}
}
public function set_pass($pass){
$this->pass = $pass;
}
public function set_schnitt($id){
$this->schnitt = $id;
}
public function auszahlen($post){
$array = $this->make_array($post);
$this->kontostand($array['betrag']);
$this->schnitt_erlaubt();
$this->multi_konto();
$this->schnitt_kont();
if($this->error == 0){
$this->zahlung();
}
}
public function einzahlen($post){
$array = $this->make_array($post);
$this->kontostand($array['betrag']);
$this->schnitt_erlaubt();
$this->multi_konto();
$this->schnitt_kont();
if($this->error == 0){
$this->zahlung();
}
}
protected function zahlung(){
global $k_buchung,$trans_ausgabe;
$schnitt = $this->db->get_row("SELECT schnittstelle,betreiber_id,betreiber_passwort,betreiber_kennung,auszahltext,einzahltext,punktewert,wertepunkt FROM ". PREFIX . SCHNITT ." WHERE schnittstelle = '$this->schnitt' ",true);
if(file_exists($_SERVER['DOCUMENT_ROOT']."/lib/schnittstellen/" . $schnitt->schnittstelle . ".php")){
require_once($_SERVER['DOCUMENT_ROOT']."/lib/schnittstellen/" . $schnitt->schnittstelle . ".php");
if($this->art == 2){
$ausgabe = auszahlen ($schnitt->betreiber_id,$schnitt->betreiber_passwort,$this->m_konto,$this->pass,$schnitt->betreiber_kennung,$this->betrag * $schnitt->punktewert ,$schnitt->auszahltext,'');
}else{
$ausgabe = einzahlen($schnitt->betreiber_id,$schnitt->betreiber_passwort,$this->m_konto,$this->pass,$schnitt->betreiber_kennung,$this->betrag,$schnitt->einzahltext,'');
}
$this->db->insert(PREFIX . S_ANF , array("zeit" => time(), "uid" => $this->uid, "betrag" => $this->betrag, "art" => $this->art) );
if($this->error == 0 && $ausgabe == "Alles OK"){
if($this->art == 2){
$k_buchung->set_var($this->uid,$this->betrag,'-',"Auszahlung");
$this->meldung = AUSZAHLUNG_TRUE;
}else{
$k_buchung->set_var($this->uid,$this->betrag / $schnitt->wertepunkt,'+',"Einzahlung");
$this->meldung = EINZAHLUNG_TRUE;
}
}else{
$this->error = 1;
$this->meldung = $trans_ausgabe;
}
}else{
$this->error = 1;
$this->meldung = 'Ladefehler';
}
meldung($this->error,$this->meldung);
}
private function schnitt_kont(){
$schnitt = $this->db->get_row("SELECT auszahlsumme,einzahlsumme,anfragen_user FROM ". PREFIX . SCHNITT ." WHERE schnittstelle = '$this->schnitt' ",true);
if($schnitt->anfragen_user != 0){ $error = 1; $meldung .= AUSZAHLUNG_ANFRAGEN_USER_FALSE;}
if($this->art == 2){
if($schnitt->auszahlsumme != 0){ if($schnitt->auszahlsumme > $this->betrag){ $this->error = 1; $this->meldung .= AUSZAHLUNG_BETRAG_HIGHT;}}
}else{
if($schnitt->einzahlsumme != 0){ if($schnitt->einzahlsumme > $this->betrag){ $this->error = 1; $this->meldung .= EINZAHLUNG_BETRAG_HIGHT;}}
}
meldung($this->error,$this->meldung);
}
private function multi_konto(){
$results = $this->db->get_results("SELECT kontoid FROM ". PREFIX . MULTIK ." WHERE uid='$this->uid' AND waehrung='$this->schnitt' LIMIT 1 ");
if(count((array)$results) != 1){
$this->error = 1; $this->meldung .= AUSZAHLUNG_MULTI_KONTO_FALSE;
}else{
$this->m_konto = $results->{1}->kontoid;
}
meldung($this->error,$this->meldung);
}
private function schnitt_erlaubt(){
$stelle = $this->db->get_row("SELECT aktiv_aus FROM ". PREFIX . SCHNITT ." WHERE schnittstelle = '$this->schnitt' ",true);
if($stelle->aktiv_aus != 1){ $this->error = 1; $this->meldung .= AUSZAHLUNG_SCHNITT_STELLE_FALSE;}
meldung($this->error,$this->meldung);
}
private function kontostand($betrag){
$konto = $this->db->get_row("SELECT kontostand_a,auszahlung_sperre FROM ". PREFIX . KONTO . " WHERE uid = '$this->uid' ",true);
if($konto->kontostand_a < $betrag){ $this->error = 1; $this->meldung .= AUSZAHLUNG_KONTO_FALSE;}
if($konto->auszahlung_sperre == 0 && $this->art == 2){ $this->error = 1; $this->meldung .= AUSZAHLUNG_SPERRE_TRUE;}
meldung($this->error,$this->meldung);
}
private function make_array($post){
foreach($_POST AS $key => $value){
if($key != 'auszahlen' && $key != '' && $key != 'veri'){
$this->array[$key] = $this->db->escape($value);
}
}
}
public function veri($post){
$this->make_array($post);
$row = $this->db->get_row("SELECT * FROM " . PREFIX . SCHNITT . " WHERE schnittstelle='" . $this->array['schnittstelle'] . "' AND aktiv > 0 LIMIT 1",true);
// User beim Betreiber prüfen
$this->db->insert(PREFIX . SCHNITTA, array("zeit" => time(), "uid" => $this->session['uid']));
if(file_exists($_SERVER['DOCUMENT_ROOT']."/lib/schnittstellen/" . $row->schnittstelle . ".php")){
require_once ($_SERVER['DOCUMENT_ROOT']."/lib/schnittstellen/" . $row->schnittstelle . ".php");
$ausgabe = uservalidate($row->betreiber_id, $row->betreiber_passwort, $this->array['veri_id'], $this->array['veri_pw']);
if ($ausgabe == 'Alles OK'){
$this->db->insert(PREFIX . MK ,array("uid" => $this->session['uid'], "kontoid" => $this->db->escape($this->array['veri_id']),"waehrung" => $this->db->escape($this->array['schnittstelle'])));
meldung(0,MK_SAVE_TRUE);
}else{
meldung(1,MK_SAVE_FALSE.$error);
}
}
}
}