Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd92fa6031 | ||
|
|
6606f30ceb | ||
|
|
e1255e0872 | ||
|
|
5c53621f96 | ||
|
|
581518963b | ||
|
|
23735eba92 | ||
|
|
9eb78f40fd | ||
|
|
f599033a38 | ||
|
|
61f1b92bad | ||
|
|
1dfe246e0f | ||
|
|
d64e40ca2c | ||
|
|
6810c030e8 | ||
|
|
d7a6abd5b9 | ||
|
|
2a2221af31 | ||
|
|
03be3a317f | ||
|
|
bdcd83c579 | ||
|
|
f4f84bdd67 | ||
|
|
86535c23f1 | ||
|
|
5d146c1dfd | ||
|
|
82ca78d8b3 | ||
|
|
55f35868bd | ||
|
|
e0805c9dc6 |
12
4dev/database/function/set_generic.sql
Normal file
12
4dev/database/function/set_generic.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- adds the created or updated date tags
|
||||
|
||||
CREATE OR REPLACE FUNCTION set_generic() RETURNS TRIGGER AS '
|
||||
BEGIN
|
||||
IF TG_OP = ''INSERT'' THEN
|
||||
NEW.date_created := ''now'';
|
||||
ELSIF TG_OP = ''UPDATE'' THEN
|
||||
NEW.date_updated := ''now'';
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
' LANGUAGE 'plpgsql';
|
||||
@@ -9,7 +9,5 @@
|
||||
CREATE TABLE edit_generic (
|
||||
eg_status INT,
|
||||
date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT clock_timestamp(),
|
||||
date_updated TIMESTAMP WITHOUT TIME ZONE,
|
||||
user_created VARCHAR(25) DEFAULT CURRENT_USER,
|
||||
user_updated VARCHAR(25)
|
||||
date_updated TIMESTAMP WITHOUT TIME ZONE
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ CREATE TABLE edit_log (
|
||||
edit_log_id SERIAL PRIMARY KEY,
|
||||
username VARCHAR,
|
||||
password VARCHAR,
|
||||
event_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
event_date TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
ip VARCHAR,
|
||||
error TEXT,
|
||||
event TEXT,
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
|
||||
-- DROP TABLE edit_generic;
|
||||
CREATE TABLE generic (
|
||||
row_status INT,
|
||||
date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT clock_timestamp(),
|
||||
date_updated TIMESTAMP WITHOUT TIME ZONE,
|
||||
user_created VARCHAR(25) DEFAULT CURRENT_USER,
|
||||
user_updated VARCHAR(25)
|
||||
date_updated TIMESTAMP WITHOUT TIME ZONE
|
||||
);
|
||||
|
||||
1
4dev/debug/jquery-3.1.0.min.map
Normal file
1
4dev/debug/jquery-3.1.0.min.map
Normal file
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
<?
|
||||
$DEBGU_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
@@ -54,9 +54,6 @@
|
||||
print "DEBUG OUT ALL: ".$basic->debug_output_all."<br>";
|
||||
print "ECHO OUT ALL: ".$basic->echo_output_all."<br>";
|
||||
print "PRINT OUT ALL: ".$basic->print_output_all."<br>";
|
||||
// file name (logging)
|
||||
print "FILENAME EXT: ".$basic->file_name_ext."<br>";
|
||||
print "MAX FILESIZE: ".$basic->max_filesize."<br>";
|
||||
|
||||
print "CALLER BACKTRACE: ".$basic->get_caller_method()."<br>";
|
||||
$basic->debug('SOME MARK', 'Some error output');
|
||||
@@ -77,12 +74,17 @@
|
||||
}
|
||||
|
||||
$status = $basic->db_exec("INSERT INTO foo (test) VALUES ('FOO TEST ".time()."') RETURNING test");
|
||||
print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id."<br>";
|
||||
print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
|
||||
print "DIRECT INSERT PREVIOUS INSERTED: ".print_r($basic->db_return_row("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), 1)."<br>";
|
||||
$basic->db_prepare("ins_foo", "INSERT INTO foo (test) VALUES ($1)");
|
||||
$status = $basic->db_execute("ins_foo", array('BAR TEST '.time()));
|
||||
print "PREPARE INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id."<br>";
|
||||
print "PREPARE INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
|
||||
print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($basic->db_return_row("SELECT foo_id, test FROM foo WHERE foo_id = ".$basic->insert_id), 1)."<br>";
|
||||
// returning test with multiple entries
|
||||
// $status = $basic->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id");
|
||||
$status = $basic->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id, test");
|
||||
print "DIRECT MULTIPLE INSERT STATUS: $status | PRIMARY KEYS: ".print_r($basic->insert_id, 1)." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."<br>";
|
||||
|
||||
|
||||
# async test queries
|
||||
/* $basic->db_exec_async("SELECT test FROM foo, (SELECT pg_sleep(10)) as sub WHERE foo_id IN (27, 50, 67, 44, 10)");
|
||||
@@ -125,7 +127,7 @@
|
||||
print "DB Version bigger than $to_db_version: ".$basic->db_compare_version('>='.$to_db_version)."<br>";
|
||||
print "DB Version bigger $to_db_version: ".$basic->db_compare_version('>'.$to_db_version)."<br>";
|
||||
|
||||
$q = "SELECT FOO FRO BAR";
|
||||
/* $q = "SELECT FOO FRO BAR";
|
||||
// $q = "Select * from foo";
|
||||
$foo = $basic->db_exec_async($q);
|
||||
print "[ERR] Query: ".$q."<br>";
|
||||
@@ -134,7 +136,7 @@
|
||||
{
|
||||
print "[ERR]: $ret<br>";
|
||||
// sleep(5);
|
||||
}
|
||||
} */
|
||||
|
||||
// search path check
|
||||
$q = "SHOW search_path";
|
||||
@@ -156,6 +158,11 @@
|
||||
print $basic->magic_links('user@bubu.at').'<br>';
|
||||
print $basic->magic_links('http://test.com/foo/bar.php?foo=1').'<br>';
|
||||
|
||||
// compare date
|
||||
$date_1 = '2017/1/5';
|
||||
$date_2 = '2017-01-05';
|
||||
print "COMPARE DATE: ".$basic->CompareDate($date_1, $date_2)."<br>";
|
||||
|
||||
// print error messages
|
||||
print $basic->print_error_msg();
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@
|
||||
$smarty = new SmartyML($lang);
|
||||
// create new DB class
|
||||
$cms = new AdminBackend($DB_CONFIG[MAIN_DB], $lang);
|
||||
// set daily rotation
|
||||
$cms->file_name_ext = '_'.date('Y-m-d').'.log';
|
||||
// set search path to the default DB schema
|
||||
$cms->db_exec("SET search_path TO ".DB_SCHEMA);
|
||||
// the menu show flag (what menu to show)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
$DB_DEBUG = 1;
|
||||
$LOG_PER_RUN = 1;
|
||||
|
||||
define('USE_DATABASE', true);
|
||||
require("header.inc");
|
||||
|
||||
1
www/layout/admin/default/javascript/datepickr/datepickr.min.css
vendored
Normal file
1
www/layout/admin/default/javascript/datepickr/datepickr.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.datepickr-wrapper{display:inline-block;position:relative}.datepickr-calendar{font-family:'Trebuchet MS',Tahoma,Verdana,Arial,sans-serif;font-size:12px;background-color:#eee;color:#333;border:1px solid #ddd;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;padding:2px;display:none;position:absolute;top:100%;left:0;z-index:100}.open .datepickr-calendar{display:block}.datepickr-calendar .datepickr-months{background-color:#f6af3a;border:1px solid #e78f08;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;color:#fff;padding:2px;text-align:center;font-size:120%}.datepickr-calendar .datepickr-next-month,.datepickr-calendar .datepickr-prev-month{color:#fff;text-decoration:none;padding:0 .4em;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;cursor:pointer}.datepickr-calendar .datepickr-prev-month{float:left}.datepickr-calendar .datepickr-next-month{float:right}.datepickr-calendar .datepickr-current-month{padding:0 .5em}.datepickr-calendar .datepickr-next-month:hover,.datepickr-calendar .datepickr-prev-month:hover{background-color:#fdf5ce;color:#c77405}.datepickr-calendar table{border-collapse:collapse;padding:0;width:100%}.datepickr-calendar thead{font-size:90%}.datepickr-calendar td,.datepickr-calendar th{width:14.3%}.datepickr-calendar th{text-align:center;padding:5px}.datepickr-calendar td{text-align:right;padding:1px}.datepickr-calendar .datepickr-day{display:block;color:#1c94c4;background-color:#f6f6f6;border:1px solid #ccc;padding:5px;cursor:pointer}.datepickr-calendar .datepickr-day:hover{color:#C77405;background-color:#fdf5ce;border:1px solid #fbcb09}.datepickr-calendar .today .datepickr-day{background-color:#fff0A5;border:1px solid #fed22f;color:#363636}.datepickr-calendar .selected .datepickr-day{background-color:#1c94c4;color:#f6f6f6}.datepickr-calendar .disabled .datepickr-day,.datepickr-calendar .disabled .datepickr-day:hover{background-color:#eee;border:1px dotted #ccc;color:#bbb;cursor:default}
|
||||
13
www/layout/admin/default/javascript/datepickr/datepickr.min.js
vendored
Normal file
13
www/layout/admin/default/javascript/datepickr/datepickr.min.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var datepickr=function(d,c){var f,h,a=[],k;datepickr.prototype=datepickr.init.prototype;h=function(a){a._datepickr&&a._datepickr.destroy();a._datepickr=new datepickr.init(a,c);return a._datepickr};if(d.nodeName)return h(d);f=datepickr.prototype.querySelectorAll(d);if(1===f.length)return h(f[0]);for(k=0;k<f.length;k++)a.push(h(f[k]));return a};
|
||||
datepickr.init=function(d,c){var f,h,a=this,k={dateFormat:"F j, Y",altFormat:null,altInput:null,minDate:null,maxDate:null,shorthandCurrentMonth:!1},l=document.createElement("div"),t=document.createElement("span"),u=document.createElement("table"),v=document.createElement("tbody"),g,m=new Date,B,n,p,w,C,r,x,D,E,s,F,G,y,H,z,A,I;l.className="datepickr-calendar";t.className="datepickr-current-month";c=c||{};B=function(){g=document.createElement("div");g.className="datepickr-wrapper";a.element.parentNode.insertBefore(g,
|
||||
a.element);g.appendChild(a.element)};f={year:function(){return m.getFullYear()},month:{integer:function(){return m.getMonth()},string:function(a){var e=m.getMonth();return p(e,a)}},day:function(){return m.getDate()}};h={string:function(){return p(a.currentMonthView,a.config.shorthandCurrentMonth)},numDays:function(){return 1===a.currentMonthView&&(0===a.currentYearView%4&&0!==a.currentYearView%100||0===a.currentYearView%400)?29:a.l10n.daysInMonth[a.currentMonthView]}};n=function(b,e){var q="",d=new Date(e),
|
||||
c={d:function(){var a=c.j();return 10>a?"0"+a:a},D:function(){return a.l10n.weekdays.shorthand[c.w()]},j:function(){return d.getDate()},l:function(){return a.l10n.weekdays.longhand[c.w()]},w:function(){return d.getDay()},F:function(){return p(c.n()-1,!1)},m:function(){var a=c.n();return 10>a?"0"+a:a},M:function(){return p(c.n()-1,!0)},n:function(){return d.getMonth()+1},U:function(){return d.getTime()/1E3},y:function(){return String(c.Y()).substring(2)},Y:function(){return d.getFullYear()}},f=b.split("");
|
||||
a.forEach(f,function(a,b){c[a]&&"\\"!==f[b-1]?q+=c[a]():"\\"!==a&&(q+=a)});return q};p=function(b,e){return!0===e?a.l10n.months.shorthand[b]:a.l10n.months.longhand[b]};w=function(b,e,c,d){return b===d&&a.currentMonthView===e&&a.currentYearView===c};C=function(){var b=document.createElement("thead"),e=a.l10n.firstDayOfWeek,c=a.l10n.weekdays.shorthand;0<e&&e<c.length&&(c=[].concat(c.splice(e,c.length),c.splice(0,e)));b.innerHTML="<tr><th>"+c.join("</th><th>")+"</th></tr>";u.appendChild(b)};r=function(){var b=
|
||||
(new Date(a.currentYearView,a.currentMonthView,1)).getDay(),c=h.numDays(),d=document.createDocumentFragment(),g=document.createElement("tr"),k,l="",p="",m="",n,b=b-a.l10n.firstDayOfWeek;0>b&&(b+=7);k=b;v.innerHTML="";0<b&&(g.innerHTML+='<td colspan="'+b+'"> </td>');for(b=1;b<=c;b++){7===k&&(d.appendChild(g),g=document.createElement("tr"),k=0);l=w(f.day(),f.month.integer(),f.year(),b)?" today":"";a.selectedDate&&(p=w(a.selectedDate.day,a.selectedDate.month,a.selectedDate.year,b)?" selected":"");
|
||||
if(a.config.minDate||a.config.maxDate)n=(new Date(a.currentYearView,a.currentMonthView,b)).getTime(),m="",a.config.minDate&&n<a.config.minDate&&(m=" disabled"),a.config.maxDate&&n>a.config.maxDate&&(m=" disabled");g.innerHTML+='<td class="'+l+p+m+'"><span class="datepickr-day">'+b+"</span></td>";k++}d.appendChild(g);v.appendChild(d)};x=function(){t.innerHTML=a.currentYearView+" "+h.string()};D=function(){var a=document.createElement("div");a.className="datepickr-months";a.innerHTML='<span class="datepickr-prev-month"><</span><span class="datepickr-next-month">></span>';
|
||||
a.appendChild(t);x();l.appendChild(a)};E=function(){0>a.currentMonthView&&(a.currentYearView--,a.currentMonthView=11);11<a.currentMonthView&&(a.currentYearView++,a.currentMonthView=0)};s=function(b){if(b.target!==a.element&&b.target!==g&&(b=b.target.parentNode,b!==g))for(;b!==g;)if(b=b.parentNode,null===b){A();break}};F=function(b){b=b.target;var c=b.className;c&&("datepickr-prev-month"===c||"datepickr-next-month"===c?("datepickr-prev-month"===c?a.currentMonthView--:a.currentMonthView++,E(),x(),r()):
|
||||
"datepickr-day"!==c||a.hasClass(b.parentNode,"disabled")||(a.selectedDate={day:parseInt(b.innerHTML,10),month:a.currentMonthView,year:a.currentYearView},b=(new Date(a.currentYearView,a.currentMonthView,a.selectedDate.day)).getTime(),a.config.altInput&&(a.config.altInput.value=a.config.altFormat?n(a.config.altFormat,b):n(a.config.dateFormat,b)),a.element.value=n(a.config.dateFormat,b),A(),r()))};G=function(){D();C();r();u.appendChild(v);l.appendChild(u);g.appendChild(l)};y=function(){return"INPUT"===
|
||||
a.element.nodeName?"focus":"click"};H=function(){a.addEventListener(a.element,y(),z);a.addEventListener(l,"click",F)};z=function(){a.addEventListener(document,"click",s);a.addClass(g,"open")};A=function(){a.removeEventListener(document,"click",s);a.removeClass(g,"open")};I=function(){var b,c;a.removeEventListener(document,"click",s);a.removeEventListener(a.element,y(),z);b=a.element.parentNode;b.removeChild(l);c=b.removeChild(a.element);b.parentNode.replaceChild(c,b)};(function(){var b,e;a.config=
|
||||
{};a.destroy=I;for(b in k)a.config[b]=c[b]||k[b];a.element=d;a.element.value&&(e=Date.parse(a.element.value));e&&!isNaN(e)?(e=new Date(e),a.selectedDate={day:e.getDate(),month:e.getMonth(),year:e.getFullYear()},a.currentYearView=a.selectedDate.year,a.currentMonthView=a.selectedDate.month,a.currentDayView=a.selectedDate.day):(a.selectedDate=null,a.currentYearView=f.year(),a.currentMonthView=f.month.integer(),a.currentDayView=f.day());B();G();H()})();return a};
|
||||
datepickr.init.prototype={hasClass:function(d,c){return d.classList.contains(c)},addClass:function(d,c){d.classList.add(c)},removeClass:function(d,c){d.classList.remove(c)},forEach:function(d,c){[].forEach.call(d,c)},querySelectorAll:document.querySelectorAll.bind(document),isArray:Array.isArray,addEventListener:function(d,c,f,h){d.addEventListener(c,f,h)},removeEventListener:function(d,c,f,h){d.removeEventListener(c,f,h)},l10n:{weekdays:{shorthand:"Sun Mon Tue Wed Thu Fri Sat".split(" "),longhand:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")},
|
||||
months:{shorthand:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),longhand:"January February March April May June July August September October November December".split(" ")},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0}};
|
||||
10346
www/layout/admin/default/javascript/jquery-1.11.2.js
vendored
10346
www/layout/admin/default/javascript/jquery-1.11.2.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
4
www/layout/admin/default/javascript/jquery-3.1.0.min.js
vendored
Normal file
4
www/layout/admin/default/javascript/jquery-3.1.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
jquery-2.1.3.min.js
|
||||
jquery-3.1.0.min.js
|
||||
@@ -1 +1 @@
|
||||
jquery-2.1.3.js
|
||||
jquery-3.1.0.js
|
||||
62
www/layout/frontend/default/templates/main_body.old.tpl
Normal file
62
www/layout/frontend/default/templates/main_body.old.tpl
Normal file
@@ -0,0 +1,62 @@
|
||||
{*
|
||||
********************************************************************
|
||||
* AUTHOR: Clemens Schwaighofer
|
||||
* DATE: 2008/12/24
|
||||
* DESCRIPTION:
|
||||
* main body
|
||||
* HISTORY:
|
||||
********************************************************************
|
||||
*}
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{$HTML_TITLE}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={$DEFAULT_ENCODING}">
|
||||
{if $STYLESHEET}
|
||||
<link rel=stylesheet type="text/css" href="{$CSS}{$STYLESHEET}">
|
||||
{/if}
|
||||
<script language="JavaScript">
|
||||
<!--
|
||||
var DEBUG = {$JS_DEBUG};
|
||||
//-->
|
||||
</script>
|
||||
<script language="JavaScript" src="{$js}/firebug.js"></script>
|
||||
<script language="JavaScript" src="{$js}/debug.js"></script>
|
||||
{if $JAVASCRIPT}
|
||||
<script language="JavaScript" src="{$JS}{$JAVASCRIPT}"></script>
|
||||
{/if}
|
||||
{if $ajax_javascript}
|
||||
<script language="JavaScript">
|
||||
{$ajax_javascript}
|
||||
</script>
|
||||
{/if}
|
||||
{if $JS_INCLUDE}
|
||||
<script language="JavaScript" src="{$JS_INCLUDE}"></script>
|
||||
{/if}
|
||||
{* for including datepickr *}
|
||||
{if $JS_DATEPICKR}
|
||||
<link rel=stylesheet type="text/css" href="{$js}/datepickr/datepickr.min.css">
|
||||
<script language="JavaScript" src="{$js}/datepickr/datepickr.min.js"></script>
|
||||
{/if}
|
||||
{* {popup_init src="`$js`/overlib/overlib.js"} *}
|
||||
</head>
|
||||
<body>
|
||||
<form name="product_search" method="get">
|
||||
<div style="border: 1px solid black; margin: 15px; padding: 5px;">
|
||||
{include file="top_menu.tpl"}
|
||||
</div>
|
||||
<div>
|
||||
{include file="$INCLUDE_TEMPLATE"}
|
||||
</div>
|
||||
</form>
|
||||
{* debug info *}
|
||||
{if $DEBUG}
|
||||
<div style="width:{$table_width}px;" class="debug_message">
|
||||
{$Id}<br>
|
||||
<b>{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}</b><br>
|
||||
{$debug_error_msg}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,57 +1,52 @@
|
||||
{*
|
||||
********************************************************************
|
||||
* AUTHOR: Clemens Schwaighofer
|
||||
* DATE: 2008/12/24
|
||||
* DATE: 2005/06/23
|
||||
* DESCRIPTION:
|
||||
* main body
|
||||
* edit body part
|
||||
* HISTORY:
|
||||
********************************************************************
|
||||
*}
|
||||
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>{$HTML_TITLE}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={$DEFAULT_ENCODING}">
|
||||
{if $STYLESHEET}
|
||||
<link rel=stylesheet type="text/css" href="{$CSS}{$STYLESHEET}">
|
||||
<link rel=stylesheet type="text/css" href="{$css}{$STYLESHEET}">
|
||||
{/if}
|
||||
{if $CSS_INCLUDE}
|
||||
<link rel=stylesheet type="text/css" href="{$CSS_INCLUDE}">
|
||||
{/if}
|
||||
{if $CSS_SPECIAL_INCLUDE}
|
||||
<link rel=stylesheet type="text/css" href="{$CSS_SPECIAL_INCLUDE}">
|
||||
{/if}
|
||||
<script language="JavaScript">
|
||||
<!--
|
||||
var DEBUG = {$JS_DEBUG};
|
||||
//-->
|
||||
</script>
|
||||
<script language="JavaScript" src="{$js}/firebug.js"></script>
|
||||
<script language="JavaScript" src="{$js}/debug.js"></script>
|
||||
{if $JAVASCRIPT}
|
||||
<script language="JavaScript" src="{$JS}{$JAVASCRIPT}"></script>
|
||||
<script language="JavaScript" src="{$js}{$JAVASCRIPT}"></script>
|
||||
{/if}
|
||||
{if $ajax_javascript}
|
||||
<script language="JavaScript">
|
||||
{$ajax_javascript}
|
||||
</script>
|
||||
{* declare prototype everywhere *}
|
||||
<script src="{$js}/scriptaculous/prototype.js" type="text/javascript"></script>
|
||||
{if $USE_SCRIPTACULOUS}
|
||||
<script src="{$js}/scriptaculous/scriptaculous.js" type="text/javascript"></script>
|
||||
{/if}
|
||||
{if $JS_INCLUDE}
|
||||
<script language="JavaScript" src="{$JS_INCLUDE}"></script>
|
||||
{/if}
|
||||
{* {popup_init src="`$js`/overlib/overlib.js"} *}
|
||||
{if $JS_SPECIAL_INCLUDE}
|
||||
<script language="JavaScript" src="{$JS_SPECIAL_INCLUDE}"></script>
|
||||
{/if}
|
||||
{* for including datepickr *}
|
||||
{if $JS_DATEPICKR}
|
||||
<link rel=stylesheet type="text/css" href="{$js}/datepickr/datepickr.min.css">
|
||||
<script language="JavaScript" src="{$js}/datepickr/datepickr.min.js"></script>
|
||||
{/if}
|
||||
{if $USE_OVERLIB}
|
||||
{popup_init src="`$js`/overlib/overlib.js"}
|
||||
{/if}
|
||||
</head>
|
||||
<body>
|
||||
<form name="product_search" method="get">
|
||||
<div style="border: 1px solid black; margin: 15px; padding: 5px;">
|
||||
{include file="top_menu.tpl"}
|
||||
</div>
|
||||
<div>
|
||||
{include file="$INCLUDE_TEMPLATE"}
|
||||
</div>
|
||||
</form>
|
||||
{* debug info *}
|
||||
{if $DEBUG}
|
||||
<div style="width:{$table_width}px;" class="debug_message">
|
||||
{$Id}<br>
|
||||
<b>{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}</b><br>
|
||||
{$debug_error_msg}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{include file="$TEMPLATE_NAME"}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
$q .= "(".@$_SESSION['EUID'].", NOW(), '".$this->db_escape_string($event)."', '".$data."', '".$data_binary."', '".$this->page_name."', ";
|
||||
$q .= "'".@$_SERVER["REMOTE_ADDR"]."', '".$this->db_escape_string(@$_SERVER['HTTP_USER_AGENT'])."', '".$this->db_escape_string(@$_SERVER['HTTP_REFERER'])."', '".$this->db_escape_string(@$_SERVER['SCRIPT_FILENAME'])."', '".$this->db_escape_string(@$_SERVER['QUERY_STRING'])."', '".$this->db_escape_string(@$_SERVER['SERVER_NAME'])."', '".$this->db_escape_string(@$_SERVER['HTTP_HOST'])."', '".$this->db_escape_string(@$_SERVER['HTTP_ACCEPT'])."', '".$this->db_escape_string(@$_SERVER['HTTP_ACCEPT_CHARSET'])."', '".$this->db_escape_string(@$_SERVER['HTTP_ACCEPT_ENCODING'])."', '".session_id()."', ";
|
||||
$q .= "'".$this->db_escape_string($this->action)."', '".$this->db_escape_string($this->action_id)."', '".$this->db_escape_string($this->action_yes)."', '".$this->db_escape_string($this->action_flag)."', '".$this->db_escape_string($this->action_menu)."', '".$this->db_escape_string($this->action_loaded)."', '".$this->db_escape_string($this->action_value)."', '".$this->db_escape_string($this->action_error)."')";
|
||||
$this->db_exec($q, 'edit_log_id');
|
||||
$this->db_exec($q, 'NULL');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
private $error_id; // error ID for errors in classes
|
||||
private $error_string; // error strings in classes (for error_id)
|
||||
public $error_msg = array (); // the "connection" to the outside errors
|
||||
private $error_msg = array (); // the "connection" to the outside errors
|
||||
|
||||
public $debug_output; // if this is true, show debug on desconstructor
|
||||
public $debug_output_not;
|
||||
@@ -115,15 +115,16 @@
|
||||
public $print_output_not;
|
||||
public $print_output_all;
|
||||
|
||||
// file rotate flags, if they are over this, file gets rotated
|
||||
// old files are named print_file_YYYY-MM-DD_ddddd, where ddddd is a per day increasing number
|
||||
public $file_name_ext = ''; // use this for date rotate
|
||||
public $max_filesize = 0; // set in kilobytes
|
||||
// log file name
|
||||
public $print_file = 'error_msg##LEVEL####CLASS####PAGENAME##';
|
||||
public $one_file = 0; // if this is set to true, all log dat is written to one file
|
||||
public $per_page = 0;
|
||||
public $per_class = 0;
|
||||
private $log_file_name_ext = 'log'; // use this for date rotate
|
||||
public $log_max_filesize = 0; // set in kilobytes
|
||||
private $log_print_file = 'error_msg##LEVEL####CLASS####PAGENAME####DATE##';
|
||||
private $log_file_unique_id; // a unique ID set only once for call derived from this class
|
||||
public $log_print_file_date = 1; // if set add Y-m-d and do automatic daily rotation
|
||||
public $log_per_level = 0; // set, it will split per level (first parameter in debug call)
|
||||
public $log_per_class = 0; // set, will split log per class
|
||||
public $log_per_page = 0; // set, will split log per called file
|
||||
public $log_per_run = 0; // create a new log file per run (time stamp + unique ID)
|
||||
|
||||
public $starttime; // start time if time debug is used
|
||||
public $endtime; // end time if time debug is used
|
||||
@@ -165,9 +166,6 @@
|
||||
{
|
||||
// set per run UID for logging
|
||||
$this->running_uid = hash($this->hash_algo, uniqid(rand(), true));
|
||||
// set core file extension for logging with Y M D date
|
||||
if (!$this->file_name_ext)
|
||||
$this->file_name_ext = '_'.date('Y-m-d').'.log';
|
||||
|
||||
// internal info var
|
||||
$this->class_info["basic"] = array (
|
||||
@@ -219,19 +217,17 @@
|
||||
if (isset($GLOBALS['PRINT_ALL']))
|
||||
$this->print_output_all = $GLOBALS['PRINT_ALL'];
|
||||
|
||||
if (isset($GLOBALS['FILE_NAME_EXT']) && !$this->file_name_ext)
|
||||
$this->file_name_ext = $GLOBALS['FILE_NAME_EXT'];
|
||||
if (isset($GLOBALS['MAX_FILESIZE']))
|
||||
$this->max_filesize = $GLOBALS['MAX_FILESIZE'];
|
||||
|
||||
// check the file_ext and max size
|
||||
if (!preg_match("/\w/", $this->file_name_ext))
|
||||
$this->file_name_ext = '';
|
||||
if (!preg_match("/\d/", $this->max_filesize))
|
||||
$this->max_filesize = 0;
|
||||
// set default extension
|
||||
if (!$this->file_name_ext)
|
||||
$this->file_name_ext = '.log';
|
||||
// GLOBAL rules for log writing
|
||||
if (isset($GLOBALS['LOG_PRINT_FILE_DATE']))
|
||||
$this->log_print_file_date = $GLOBALS['LOG_PRINT_FILE_DATE'];
|
||||
if (isset($GLOBALS['LOG_PER_LEVEL']))
|
||||
$this->log_per_level = $GLOBALS['LOG_PER_LEVEL'];
|
||||
if (isset($GLOBALS['LOG_PER_CLASS']))
|
||||
$this->log_per_class = $GLOBALS['LOG_PER_CLASS'];
|
||||
if (isset($GLOBALS['LOG_PER_PAGE']))
|
||||
$this->log_per_page = $GLOBALS['LOG_PER_PAGE'];
|
||||
if (isset($GLOBALS['LOG_PER_RUN']))
|
||||
$this->log_per_run = $GLOBALS['LOG_PER_RUN'];
|
||||
|
||||
// set the regex for checking emails
|
||||
$this->email_regex = "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,6}){1}$";
|
||||
@@ -344,7 +340,7 @@
|
||||
// this has to be changed, not returned here, this is the last class to close
|
||||
// return $this->error_msg;
|
||||
// close open file handles
|
||||
$this->fdebug_fp('c');
|
||||
// $this->fdebug_fp('c');
|
||||
}
|
||||
|
||||
// *************************************************************
|
||||
@@ -610,34 +606,53 @@
|
||||
// $error_string = preg_replace("/(<\/?)(\w+)([^>]*>)/", "", $error_string);
|
||||
// replace special line break tag
|
||||
// $error_string = str_replace('<!--#BR#-->', "\n", $error_string);
|
||||
|
||||
// init output variable
|
||||
$output = $error_string; // output formated error string to output file
|
||||
$rpl_string = (!$this->one_file) ? '' : '_'.$level; // if request to write to one file
|
||||
$fn = ROOT.LOG.str_replace('##LEVEL##', $rpl_string, $this->print_file.$this->file_name_ext); // create output filename
|
||||
$rpl_string = (!$this->per_class) ? '' : '_'.get_class($this); // set sub class settings
|
||||
// init base file path
|
||||
$fn = ROOT.LOG.$this->log_print_file.'.'.$this->log_file_name_ext;
|
||||
|
||||
if ($this->log_per_run)
|
||||
{
|
||||
if ($GLOBALS['LOG_FILE_UNIQUE_ID'])
|
||||
$this->log_file_unique_id = $GLOBALS['LOG_FILE_UNIQUE_ID'];
|
||||
if (!$this->log_file_unique_id)
|
||||
$GLOBALS['LOG_FILE_UNIQUE_ID'] = $this->log_file_unique_id = date('Y-m-d_His').'_U_'.substr(hash('sha1', uniqid(mt_rand(), true)), 0, 8);
|
||||
$rpl_string = '_'.$this->log_file_unique_id; // add 8 char unique string
|
||||
}
|
||||
else
|
||||
{
|
||||
$rpl_string = !$this->log_print_file_date ? '' : '_'.date('Y-m-d'); // add date to file
|
||||
}
|
||||
$fn = str_replace('##DATE##', $rpl_string, $fn); // create output filename
|
||||
|
||||
$rpl_string = !$this->log_per_level ? '' : '_'.$level; // if request to write to one file
|
||||
$fn = str_replace('##LEVEL##', $rpl_string, $fn); // create output filename
|
||||
|
||||
$rpl_string = !$this->log_per_class ? '' : '_'.get_class($this); // set sub class settings
|
||||
$fn = str_replace('##CLASS##', $rpl_string, $fn); // create output filename
|
||||
$rpl_string = (!$this->per_page) ? '' : '_'.$this->get_page_name(1); // if request to write to one file
|
||||
|
||||
$rpl_string = !$this->log_per_page ? '' : '_'.$this->get_page_name(1); // if request to write to one file
|
||||
$fn = str_replace('##PAGENAME##', $rpl_string, $fn); // create output filename
|
||||
|
||||
// write to file
|
||||
// first check if max file size is is set and file is bigger
|
||||
if ($this->max_filesize > 0 && ((filesize($fn) / 1024) > $this->max_filesize))
|
||||
if ($this->log_max_filesize > 0 && ((filesize($fn) / 1024) > $this->log_max_filesize))
|
||||
{
|
||||
// for easy purpose, rename file only to attach timestamp, nur sequence numbering
|
||||
rename($fn, $fn.'.'.date("YmdHis"));
|
||||
// check list of "fn"* and see if we have alrady an extension one, if not add 00001, if yes, take this and add +1
|
||||
/* if (is_array(glob($fn."*")))
|
||||
{
|
||||
foreach (glob($fn."*") as $_filename)
|
||||
{
|
||||
if (preg_match("/\.(\d{5})$/", $_filename, $matches))
|
||||
{
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
$fp = fopen($fn, 'a');
|
||||
fwrite($fp, $output);
|
||||
fclose($fp);
|
||||
if ($fp !== false)
|
||||
{
|
||||
fwrite($fp, $output);
|
||||
fclose($fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<!-- could not open file: $fn //-->";
|
||||
}
|
||||
|
||||
} // do write to file
|
||||
}
|
||||
}
|
||||
@@ -1224,8 +1239,8 @@
|
||||
return FALSE;
|
||||
|
||||
// splits the data up with / or -
|
||||
list ($start_year, $start_month, $start_day) = split('[/-]', $start_date);
|
||||
list ($end_year, $end_month, $end_day) = split('[/-]', $end_date);
|
||||
list ($start_year, $start_month, $start_day) = preg_split('/[\/-]/', $start_date);
|
||||
list ($end_year, $end_month, $end_day) = preg_split('/[\/-]/', $end_date);
|
||||
// check that month & day are two digits and then combine
|
||||
foreach (array('start', 'end') as $prefix)
|
||||
{
|
||||
@@ -1271,9 +1286,10 @@
|
||||
// dummy -> empty, or file_type to show an icon instead of nothing if file is not found
|
||||
// path -> if source start is not ROOT path, if empty ROOT is choosen
|
||||
// cache -> cache path, if not given TMP is used
|
||||
// clear cache -> if set to true, will create thumb all the tame
|
||||
// RETURN: thumbnail name
|
||||
// DESC: converts picture to a thumbnail with max x and max y size
|
||||
public static function CreateThumbnail($pic, $size_x, $size_y, $dummy = "", $path = "", $cache_source = "")
|
||||
public static function CreateThumbnail($pic, $size_x, $size_y, $dummy = "", $path = "", $cache_source = "", $clear_cache = false)
|
||||
{
|
||||
// get image type flags
|
||||
$image_types = array (
|
||||
@@ -1300,20 +1316,46 @@
|
||||
$tmp = explode('/', $pic);
|
||||
$pic = $tmp[(count($tmp) - 1)];
|
||||
}
|
||||
// echo "[$pic] IN: $filename - ".strstr($pic, '/')." || ".file_exists($filename)." && ".is_file($filename)."<br>";
|
||||
// does this picture exist and is it a picture
|
||||
if (file_exists($filename) && is_file($filename))
|
||||
{
|
||||
list($width, $height, $type) = getimagesize($filename);
|
||||
$convert_prefix = '';
|
||||
$create_file = false;
|
||||
// check if we can skip the PDF creation: if we have size, if do not have type, we assume type png
|
||||
if (!$type && is_numeric($size_x) && is_numeric($size_y))
|
||||
{
|
||||
$check_thumb = $tmp_src.'thumb_'.$pic.'_'.$size_x.'x'.$size_y.'.'.$image_types[3];
|
||||
if (!is_file($check_thumb))
|
||||
$create_file = true;
|
||||
else
|
||||
$type = 3;
|
||||
}
|
||||
// if type is not in the list, but returns as PDF, we need to convert to JPEG before
|
||||
if (!$type)
|
||||
{
|
||||
// is this a PDF, if no, return from here with nothing
|
||||
$convert_prefix = 'png:';
|
||||
# TEMP convert to PNG, we then override the file name
|
||||
$convert_string = CONVERT.' '.$filename.' '.$convert_prefix.$filename.'_TEMP';
|
||||
$status = exec($convert_string, $output, $return);
|
||||
$filename .= '_TEMP';
|
||||
// for delete, in case we need to glob
|
||||
$delete_filename = $filename;
|
||||
// find file, if we can't find base name, use -0 as the first one (ignore other pages in multiple ones)
|
||||
if (!is_file($filename))
|
||||
$filename .= '-0';
|
||||
list($width, $height, $type) = getimagesize($filename);
|
||||
}
|
||||
// if no size given, set size to original
|
||||
if (!$size_x)
|
||||
if (!$size_x || $size_x < 1 || !is_numeric($size_x))
|
||||
$size_x = $width;
|
||||
if (!$size_y)
|
||||
if (!$size_y || $size_y < 1 || !is_numeric($size_y))
|
||||
$size_y = $height;
|
||||
$thumb = 'thumb_'.$pic.'_'.$size_x.'x'.$size_y.'.'.$image_types[$type];
|
||||
$thumbnail = $tmp_src.$thumb;
|
||||
// check if we already have this picture converted
|
||||
if (!is_file($thumbnail))
|
||||
if (!is_file($thumbnail) || $clear_cache == true)
|
||||
{
|
||||
// convert the picture
|
||||
if ($width > $size_x)
|
||||
@@ -1330,11 +1372,16 @@
|
||||
$status = exec($convert_string, $output, $return);
|
||||
}
|
||||
}
|
||||
if (!file_exists($thumbnail))
|
||||
if (!is_file($thumbnail))
|
||||
{
|
||||
copy($filename, $thumbnail);
|
||||
}
|
||||
$return_data = $thumb;
|
||||
// if we have a delete filename, delete here with glob
|
||||
if ($delete_filename)
|
||||
{
|
||||
array_map('unlink', glob($delete_filename.'*'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -272,6 +272,7 @@
|
||||
public $num_fields; // how many fields has the query
|
||||
public $field_names; // array with the field names of the current query
|
||||
public $insert_id; // last inserted ID
|
||||
public $insert_id_ext; // extended insert ID (for data outside only primary key)
|
||||
// other vars
|
||||
private $nbsp = ''; // used by print_array recursion function
|
||||
// error & warning id
|
||||
@@ -331,7 +332,7 @@
|
||||
$this->error_string['14'] = 'Can\'t connect to DB server';
|
||||
$this->error_string['15'] = 'Can\'t select DB';
|
||||
$this->error_string['16'] = 'No DB Handler found / connect or reconnect failed';
|
||||
$this->error_string['17'] = 'all db_return* methods work only with SELECT statements, please use db_exec for everything else';
|
||||
$this->error_string['17'] = 'All db_return* methods work only with SELECT statements, please use db_exec for everything else';
|
||||
$this->error_string['18'] = 'Query not found in cache. Nothing has been reset';
|
||||
$this->error_string['19'] = 'Wrong PK name given or no PK name given at all, can\'t get Insert ID';
|
||||
$this->error_string['20'] = 'Found given Prepare Statement Name in array, Query not prepared, will use existing one';
|
||||
@@ -342,6 +343,8 @@
|
||||
$this->error_string['25'] = 'Prepare query data is not in array format.';
|
||||
$this->error_string['30'] = 'Query call in a possible endless loop. Was called more than '.$this->MAX_QUERY_CALL.' times';
|
||||
$this->error_string['31'] = 'Could not fetch PK after query insert';
|
||||
$this->error_string['32'] = 'Multiple PK return as array';
|
||||
$this->error_string['33'] = 'Returning PK was not found';
|
||||
$this->error_string['40'] = 'Query async call failed.';
|
||||
$this->error_string['41'] = 'Connection is busy with a different query. Cannot execute.';
|
||||
$this->error_string['42'] = 'Cannot check for async query, none has been started yet.';
|
||||
@@ -648,9 +651,9 @@
|
||||
if ($this->_check_query_for_insert($this->query, true))
|
||||
{
|
||||
$this->pk_name = $pk_name;
|
||||
if ($pk_name != 'NULL')
|
||||
if ($this->pk_name != 'NULL')
|
||||
{
|
||||
if (!$pk_name)
|
||||
if (!$this->pk_name)
|
||||
{
|
||||
// TODO: get primary key from table name
|
||||
list($schema, $table) = $this->_db_return_table($this->query);
|
||||
@@ -658,7 +661,7 @@
|
||||
{
|
||||
$this->pk_name_table[$table] = $this->db_functions->_db_primary_key($table, $schema);
|
||||
}
|
||||
$pk_name = $this->pk_name_table[$table];
|
||||
$this->pk_name = $this->pk_name_table[$table];
|
||||
}
|
||||
if (!preg_match("/ returning /i", $this->query) && $this->pk_name)
|
||||
{
|
||||
@@ -667,11 +670,12 @@
|
||||
}
|
||||
elseif (preg_match("/ returning (.*)/i", $this->query, $matches) && $this->pk_name)
|
||||
{
|
||||
// add the primary key if it is not in the returning set
|
||||
if (!preg_match("/$this->pk_name/", $matches[1]))
|
||||
{
|
||||
$this->query .= " , ".$this->pk_name;
|
||||
$this->returning_id = true;
|
||||
}
|
||||
$this->returning_id = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -741,16 +745,55 @@
|
||||
if ($this->_check_query_for_insert($this->query, true) && $this->pk_name != 'NULL')
|
||||
{
|
||||
// set insert_id
|
||||
// if we do not have a returning, we try to get it via the primary key and another select
|
||||
if (!$this->returning_id)
|
||||
{
|
||||
$this->insert_id = $this->db_functions->_db_insert_id($this->query, $this->pk_name);
|
||||
}
|
||||
else
|
||||
$this->insert_id = $this->db_functions->_db_fetch_array($this->cursor)[$this->pk_name];
|
||||
// this error handling is only for pgsql
|
||||
{
|
||||
$this->insert_id = array ();
|
||||
$this->insert_id_ext = array ();
|
||||
// echo "** PREPARE RETURNING FOR CURSOR: ".$this->cursor."<br>";
|
||||
// we have returning, now we need to check if we get one or many returned
|
||||
// we'll need to loop this, if we have multiple insert_id returns
|
||||
while ($_insert_id = $this->db_functions->_db_fetch_array($this->cursor, PGSQL_ASSOC))
|
||||
{
|
||||
// echo "*** RETURNING: ".print_r($_insert_id, 1)."<br>";
|
||||
$this->insert_id[] = $_insert_id;
|
||||
}
|
||||
// if we have only one, revert from array to single
|
||||
if (count($this->insert_id) == 1)
|
||||
{
|
||||
// echo "* SINGLE DATA CONVERT: ".count($this->insert_id[0])." => ".array_key_exists($this->pk_name, $this->insert_id[0])."<br>";
|
||||
// echo "* PK DIRECT: ".$this->insert_id[0][$this->pk_name]."<Br>";
|
||||
// if this has only the pk_name, then only return this, else array of all data (but without the position)
|
||||
// example if insert_id[0]['foo'] && insert_id[0]['bar'] it will become insert_id['foo'] & insert_id['bar']
|
||||
// if only ['foo_id'] and it is the PK then the PK is directly written to the insert_id
|
||||
if (count($this->insert_id[0]) > 1 || !array_key_exists($this->pk_name, $this->insert_id[0]))
|
||||
{
|
||||
$this->insert_id_ext = $this->insert_id[0];
|
||||
$this->insert_id = $this->insert_id[0][$this->pk_name];
|
||||
}
|
||||
elseif ($this->insert_id[0][$this->pk_name])
|
||||
{
|
||||
$this->insert_id = $this->insert_id[0][$this->pk_name];
|
||||
}
|
||||
}
|
||||
elseif (count($this->insert_id) == 0)
|
||||
{
|
||||
// failed to get insert id
|
||||
$this->insert_id = '';
|
||||
$this->warning_id = 33;
|
||||
$this->_db_error($this->cursor, '[db_exec]');
|
||||
}
|
||||
}
|
||||
// this warning handling is only for pgsql
|
||||
// we returned an array of PKs instread of a single one
|
||||
if (is_array($this->insert_id))
|
||||
{
|
||||
$this->warning_id = 19;
|
||||
$this->_db_error($this->insert_id[1], '[db_exec]');
|
||||
unset($this->insert_id);
|
||||
$this->warning_id = 32;
|
||||
$this->_db_error($this->cursor, '[db_exec]');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -762,6 +805,26 @@
|
||||
// PUBLIC METHODS
|
||||
// *************************************************************
|
||||
|
||||
// METHOD db_set_debug
|
||||
// PARAMS true/false or none
|
||||
// RETURN new set debug flag
|
||||
// DESC switches the debug flag on or off
|
||||
// if none given, then the debug flag auto switches from
|
||||
// the previous setting to either then on or off
|
||||
// else override with boolean true/false
|
||||
public function db_set_debug($debug = '')
|
||||
{
|
||||
if ($debug === true)
|
||||
$this->db_debug = 1;
|
||||
elseif ($debug === false)
|
||||
$this->db_debug = 0;
|
||||
elseif ($this->db_debug)
|
||||
$this->db_debug = 0;
|
||||
elseif (!$this->db_debug)
|
||||
$this->db_debug = 1;
|
||||
return $this->db_debug;
|
||||
}
|
||||
|
||||
// METHOD db_reset_query_called
|
||||
// PARAMS query
|
||||
// RETURN none
|
||||
@@ -1328,34 +1391,41 @@
|
||||
// if this is an insert query, check if we can add a return
|
||||
if ($this->_check_query_for_insert($query, true))
|
||||
{
|
||||
// set primary key name
|
||||
// current: only via parameter
|
||||
if (!$pk_name)
|
||||
if ($pk_name != 'NULL')
|
||||
{
|
||||
// read the primary key from the table, if we do not have one, we get nothing in return
|
||||
list($schema, $table) = $this->_db_return_table($query);
|
||||
if (!$this->pk_name_table[$table])
|
||||
// set primary key name
|
||||
// current: only via parameter
|
||||
if (!$pk_name)
|
||||
{
|
||||
$this->pk_name_table[$table] = $this->db_functions->_db_primary_key($table, $schema);
|
||||
// read the primary key from the table, if we do not have one, we get nothing in return
|
||||
list($schema, $table) = $this->_db_return_table($query);
|
||||
if (!$this->pk_name_table[$table])
|
||||
{
|
||||
$this->pk_name_table[$table] = $this->db_functions->_db_primary_key($table, $schema);
|
||||
}
|
||||
$pk_name = $this->pk_name_table[$table];
|
||||
}
|
||||
$pk_name = $this->pk_name_table[$table];
|
||||
}
|
||||
if ($pk_name)
|
||||
$this->prepare_cursor[$stm_name]['pk_name'] = $pk_name;
|
||||
// if no returning, then add it
|
||||
if (!preg_match("/ returning /i", $query) && $this->prepare_cursor[$stm_name]['pk_name'])
|
||||
{
|
||||
$query .= " RETURNING ".$this->prepare_cursor[$stm_name]['pk_name'];
|
||||
$this->prepare_cursor[$stm_name]['returning_id'] = true;
|
||||
}
|
||||
// if returning exists but not pk_name, add it
|
||||
else if (preg_match("/ returning (.*)/i", $query, $matches) && $this->prepare_cursor[$stm_name]['pk_name'])
|
||||
{
|
||||
if (!preg_match("/{$this->prepare_cursor[$stm_name]['pk_name']}/", $matches[1]))
|
||||
if ($pk_name)
|
||||
$this->prepare_cursor[$stm_name]['pk_name'] = $pk_name;
|
||||
// if no returning, then add it
|
||||
if (!preg_match("/ returning /i", $query) && $this->prepare_cursor[$stm_name]['pk_name'])
|
||||
{
|
||||
$query .= " , ".$this->prepare_cursor[$stm_name]['pk_name'];
|
||||
$query .= " RETURNING ".$this->prepare_cursor[$stm_name]['pk_name'];
|
||||
$this->prepare_cursor[$stm_name]['returning_id'] = true;
|
||||
}
|
||||
// if returning exists but not pk_name, add it
|
||||
else if (preg_match("/ returning (.*)/i", $query, $matches) && $this->prepare_cursor[$stm_name]['pk_name'])
|
||||
{
|
||||
if (!preg_match("/{$this->prepare_cursor[$stm_name]['pk_name']}/", $matches[1]))
|
||||
{
|
||||
$query .= " , ".$this->prepare_cursor[$stm_name]['pk_name'];
|
||||
}
|
||||
$this->prepare_cursor[$stm_name]['returning_id'] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->prepare_cursor[$stm_name]['pk_name'] = $pk_name;
|
||||
}
|
||||
}
|
||||
// search for $1, $2, in the query and push it into the control array
|
||||
@@ -1421,20 +1491,56 @@ $this->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[
|
||||
$this->_db_error($this->prepare_cursor[$stm_name]['result']);
|
||||
$this->_db_debug('db', '<span style="color: red;"><b>DB-Error</b> '.$stm_name.': Execution failed</span>', 'DB_ERROR');
|
||||
}
|
||||
if ($this->_check_query_for_insert($this->prepare_cursor[$stm_name]['query'], true))
|
||||
if ($this->_check_query_for_insert($this->prepare_cursor[$stm_name]['query'], true) && $this->prepare_cursor[$stm_name]['pk_name'] != 'NULL')
|
||||
{
|
||||
if (!$this->prepare_cursor[$stm_name]['returning_id'])
|
||||
{
|
||||
$this->insert_id = $this->db_functions->_db_insert_id($this->prepare_cursor[$stm_name]['query'], $this->prepare_cursor[$stm_name]['pk_name']);
|
||||
}
|
||||
elseif ($code)
|
||||
$this->insert_id = $this->db_functions->_db_fetch_array($code)[$this->prepare_cursor[$stm_name]['pk_name']];
|
||||
{
|
||||
$this->insert_id = array ();
|
||||
$this->insert_id_ext = array ();
|
||||
// we have returning, now we need to check if we get one or many returned
|
||||
// we'll need to loop this, if we have multiple insert_id returns
|
||||
while ($_insert_id = $this->db_functions->_db_fetch_array($code, PGSQL_ASSOC))
|
||||
{
|
||||
$this->insert_id[] = $_insert_id;
|
||||
}
|
||||
// if we have only one, revert from arry to single
|
||||
if (count($this->insert_id) == 1)
|
||||
{
|
||||
// echo "+ SINGLE DATA CONVERT: ".count($this->insert_id[0])." => ".array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0])."<br>";
|
||||
// echo "+ PK DIRECT: ".$this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']]."<Br>";
|
||||
// if this has only the pk_name, then only return this, else array of all data (but without the position)
|
||||
// example if insert_id[0]['foo'] && insert_id[0]['bar'] it will become insert_id['foo'] & insert_id['bar']
|
||||
// if only ['foo_id'] and it is the PK then the PK is directly written to the insert_id
|
||||
if (count($this->insert_id[0]) > 1 || !array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0]))
|
||||
{
|
||||
$this->insert_id_ext = $this->insert_id[0];
|
||||
$this->insert_id = $this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']];
|
||||
}
|
||||
elseif ($this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']])
|
||||
{
|
||||
$this->insert_id = $this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// failed to get insert id
|
||||
$this->insert_id = '';
|
||||
$this->warning_id = 33;
|
||||
$this->_db_error('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': insert id returned no data</span>', 'DB_WARNING');
|
||||
}
|
||||
}
|
||||
// this error handling is only for pgsql
|
||||
if (is_array($this->insert_id))
|
||||
{
|
||||
$this->warning_id = 19;
|
||||
$this->_db_error($this->insert_id[1]);
|
||||
$this->_db_debug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': Could not get insert id</span>', 'DB_WARNING');
|
||||
unset($this->insert_id);
|
||||
$this->warning_id = 32;
|
||||
$this->_db_error();
|
||||
$this->_db_debug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': insert id data returned as array</span>', 'DB_WARNING');
|
||||
}
|
||||
// NOTE should we keep this inside
|
||||
elseif (!$this->insert_id)
|
||||
{
|
||||
$this->warning_id = 31;
|
||||
|
||||
@@ -90,6 +90,9 @@
|
||||
// DESC : cunstroctuor, does ALL, opens db, works through connection checks, closes itself
|
||||
public function __construct($db_config, $lang = 'en_utf8', $debug = 0, $db_debug = 0, $echo = 1, $print = 0)
|
||||
{
|
||||
// log login data for this class only
|
||||
$this->log_per_class = 1;
|
||||
|
||||
// create db connection and init base class
|
||||
parent::__construct($db_config, $debug, $db_debug, $echo, $print);
|
||||
|
||||
@@ -100,9 +103,6 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
// set log file name
|
||||
$this->file_name_ext = '_login_'.date('Y-m-d').'.log';
|
||||
|
||||
// get the language sub class & init it
|
||||
_spl_autoload('Class.l10n.inc');
|
||||
$this->l = new l10n($lang);
|
||||
@@ -405,7 +405,7 @@
|
||||
while ($res = $this->db_return($q))
|
||||
{
|
||||
// read edit access data fields and drop them into the unit access array
|
||||
$q_sub ="SELECT name, value FROM edit_access_data WHERE enabled = 1 edit_access_id = ".$res['edit_access_id'];
|
||||
$q_sub ="SELECT name, value FROM edit_access_data WHERE enabled = 1 AND edit_access_id = ".$res['edit_access_id'];
|
||||
$ea_data = array ();
|
||||
while ($res_sub = $this->db_return($q_sub))
|
||||
{
|
||||
@@ -1015,7 +1015,7 @@ EOM;
|
||||
}
|
||||
$q .= "'".session_id()."', ";
|
||||
$q .= "'".$this->db_escape_string($this->action)."', '".$this->db_escape_string($this->username)."', NULL, '".$this->db_escape_string($this->login_error)."', NULL, NULL, '".$this->db_escape_string($this->permission_okay)."', NULL)";
|
||||
$this->db_exec($q);
|
||||
$this->db_exec($q, 'NULL');
|
||||
}
|
||||
|
||||
// METHOD: login_check_edit_access_id
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
public function __construct($lang = '', $path = '')
|
||||
{
|
||||
foreach (array('streas.php', 'gettext.php') as $include_file)
|
||||
foreach (array('streams.php', 'gettext.php') as $include_file)
|
||||
_spl_autoload($include_file);
|
||||
|
||||
if (!$lang)
|
||||
|
||||
@@ -152,12 +152,25 @@
|
||||
}
|
||||
|
||||
// METHOD: _db_fetch_array
|
||||
// PARAMS: cursor
|
||||
// PARAMS: cursor, opt result type
|
||||
// RETURN: row
|
||||
// DESC : wrapper for pg_fetch_array
|
||||
public function _db_fetch_array($cursor)
|
||||
public function _db_fetch_array($cursor, $result_type = '')
|
||||
{
|
||||
return pg_fetch_array($cursor);
|
||||
// result type is passed on as is [should be checked]
|
||||
if ($result_type)
|
||||
return pg_fetch_array($cursor, NULL, $result_type);
|
||||
else
|
||||
return pg_fetch_array($cursor);
|
||||
}
|
||||
|
||||
// METHOD: _db_fetch_all
|
||||
// PARAMS: cursor
|
||||
// RETURN: all rows as array
|
||||
// DESC : wrapper for pg_fetch_array
|
||||
public function _db_fetch_all($cursor)
|
||||
{
|
||||
return pg_fetch_all($cursor);
|
||||
}
|
||||
|
||||
// METHOD: _db_affected_ros
|
||||
|
||||
Reference in New Issue
Block a user