function nuPDForPHPParameters($hashData, $validate = '', $saveToFile = false) { $hash = array(); if ($validate == '') { //-- (runphp or printpdf) $theID = $hashData['parent_record_id']; } else { //-- just validate user access nuV('call_type', $validate); $theID = nuV('code'); } foreach ($hashData as $key => $val) { //-- add current hash variables $hash[$key] = $val; } if (nuV('call_type') == 'runphp') { //-- add php record to hash variables $s = "SELECT * FROM zzzsys_php WHERE slp_code = '{$theID}'"; $t = nuRunQuery($s); if (nuErrorFound()) { return; } $r = db_fetch_object($t); $r->slp_php = nuGetSafePHP('slp_php', $r->zzzsys_php_id, $r->slp_php); if (!nuPHPAccess($r->zzzsys_php_id)) { nuDisplayError("Access denied to PHP - ({$theID})"); return; } foreach ($r as $key => $v) { //-- add php hash variables $hash[$key] = $v; } } if (nuV('call_type') == 'printpdf') { //-- add report record to hash variables $s = "SELECT * FROM zzzsys_report LEFT JOIN zzzsys_php ON sre_zzzsys_php_id = zzzsys_php_id WHERE sre_code = '{$theID}'"; $t = nuRunQuery($s); if (nuErrorFound()) { return; } $r = db_fetch_object($t); $r->slp_php = nuGetSafePHP('slp_php', $r->zzzsys_php_id, $r->slp_php); if (!nuReportAccess($r->zzzsys_report_id)) { nuDisplayError("Access denied to Report - ({$theID})"); return; } foreach ($r as $key => $v) { //-- add pdf hash variables $hash[$key] = $v; } } if ($validate != '' and $saveToFile == false) { return; } //-- just check $i = nuID(); $hash['sfi_blob'] = null; $j = json_encode($hash); $d = date('Y-m-d h:i:s'); nuRunQuery("INSERT INTO zzzsys_debug (zzzsys_debug_id, deb_message, deb_added) VALUES(?, ?, ?)", array($i, $j, $d)); if (nuErrorFound()) { return; } if (nuV('call_type') == 'printpdf' and nuV('filename') != '') { //-- save pdf to server return nuEmailGetReportFile($i); } return $i; }
function nuRemoveTempTables($hashData) { $t = $hashData['TABLE_ID']; $a = 'abcdefghijklmnopqrstuvwxyz'; nuRunQuery('DROP TABLE IF EXISTS ' . $t); if (nuErrorFound()) { return; } for ($i = 0; $i < 26; $i++) { nuRunQuery('DROP TABLE IF EXISTS ' . $t . $a[$i]); if (nuErrorFound()) { return; } } }