function main() { // First pull the report $row_rep = SQL_OneRow("SELECT * from reports where skey=" . gp('gp_skey')); $sreport = SQL_Format('char', $row_rep['report']); // Now the tables $rows_tab = SQL_AllRows("SELECT * From reporttables WHERE report={$sreport}"); $rows_tab = KeyRowsFromRows($rows_tab, 'table_id'); // Now all columns $rows_col = SQL_AllRows("SELECT * From reportcolumns WHERE report={$sreport}\n ORDER BY uicolseq "); // Go get the joins $SQL_FROMJOINS = $this->ehProcessFromJoins(array_keys($rows_tab)); // Build a list of columns, and order-by columns, and filters $SQL_COLSA = array(); $SQL_COLSOBA = array(); $SQL_COLSWHA = array(); foreach ($rows_col as $row_col) { $SQL_COLSA[] = $row_col['table_id'] . '.' . $row_col['column_id']; if ($row_col['uisort'] != 0) { $SQL_COLSOBA[$row_col['uisort']] = $row_col['table_id'] . '.' . $row_col['column_id']; } if ($row_col['compoper'] != '' && $row_col['compval'] != '') { $table_dd = DD_TableRef($row_col['table_id']); $ddcol =& $table_dd['flat'][$row_col['column_id']]; $colval = SQL_Format($ddcol['type_id'], $row_col['compval']); $SQL_COLSWHA[] = $row_col['table_id'] . '.' . $row_col['column_id'] . $row_col['compoper'] . $colval; } } // Collapse the lists into strings $SQL_COLS = implode("\n ,", $SQL_COLSA); $SQL_COLSOB = ''; if (count($SQL_COLSOBA) > 0) { ksort($SQL_COLSOBA); $SQL_COLSOB = "\n ORDER BY " . implode(',', $SQL_COLSOBA); } $SQL_WHERE = ''; if (count($SQL_COLSWHA) > 0) { $SQL_WHERE = "\n WHERE " . implode("\n ", $SQL_COLSWHA); } // Now build the final SQL $SQ = " SELECT " . $SQL_COLS . $SQL_FROMJOINS . $SQL_WHERE . $SQL_COLSOB; //echo $SQ; // Display $this->ehProcessDisplay($SQ, $rows_col, $row_rep); }
/** * Takes a list of tables and JOINs them together * and builds the complete query for them. * * Returns: A SQL SELECT statement */ function genSQLSectionJoin($yamlP2) { $page = $this->page; $uifilter = a($this->yamlP2, 'uifilter', array()); // Go get the joins $SQL_FROMJOINS = $this->genSQLFromJoins($yamlP2); $SQL_COLSWHA = array(); // See if any of the columns have a GROUP setting, // if so, all others must get group: Y $yamlP2['groupby'] = array(); $group = false; foreach ($yamlP2['table'] as $table_id => $tabinfo) { foreach ($tabinfo['column'] as $colname => $colinfo) { if (ArraySafe($colinfo, 'group', '') != '') { $group = true; break; } } } if ($group) { foreach ($yamlP2['table'] as $table_id => $tabinfo) { foreach ($tabinfo['column'] as $colname => $colinfo) { if (ArraySafe($colinfo, 'group', '') == '') { //if(ArraySafe($colinfo,'uino','N')=='N') { $yamlP2['groupby'][] = "{$table_id}.{$colname}"; //} } } } } // Build various lists of columns $SQL_COLSA = array(); $SQL_COLSOBA = array(); foreach ($yamlP2['table'] as $table => $table_info) { $table_dd = dd_TableRef($table); foreach ($table_info['column'] as $colname => $colinfo) { // order by if (ArraySafe($colinfo, 'order', 'N') == 'Y') { $SQL_COLSOBA[] = "{$table}.{$colname}"; } // comparison if (isset($colinfo['compare'])) { $compare = $this->SQLCompare($table, $colname, $colinfo); if ($compare != '') { $SQL_COLSWHA[] = $compare; } } // group by if (a($colinfo, 'group', '') != '') { //$coldef = str_replace("as $colname","",$coldef); $coldef = $colinfo['group'] . "({$table}.{$colname})"; } else { $coldef = "{$table}.{$colname}"; } // If not in output, stop now // KFD 5/31/08, no, keep going and filter out at // output. We need all columns in case they // are orderby columns if (a($colinfo, 'uino', 'N') == 'Y') { continue; } // if a constant, add the constant and skip the rest $constant = a($colinfo, 'constant', ''); if (ArraySafe($table_info, 'left_join', 'N') == 'Y') { $z = SQL_Format($table_dd['flat'][$colname]['type_id'], ''); $cval = $constant == '' ? $coldef : "'{$constant}'"; $coldef = "COALESCE({$cval},{$z}) as {$colname}"; } else { $coldef = $constant == '' ? "{$coldef} as {$colname}" : "'{$constant}' as {$colname}"; } $SQL_COLSA[] = $coldef; } } // Collapse the lists into strings $SQL_COLS = implode("\n ,", $SQL_COLSA); # KFD 4/9/09. Slip in skey and source from first table. $tables = array_keys($yamlP2['table']); $skeytable = $tables[0]; $SQL_COLS = $skeytable . ".skey,'{$skeytable}' as _source," . $SQL_COLS; $SQL_COLSOB = ''; if (isset($yamlP2['orderby'])) { $SQL_COLSOB = "\n ORDER BY " . $yamlP2['orderby']; } else { if (count($SQL_COLSOBA) > 0) { ksort($SQL_COLSOBA); $SQL_COLSOB = "\n ORDER BY " . implode(',', $SQL_COLSOBA); } } // For the UI Filter values, add in the values provided by the user $SQL_WHERE = ''; if (count($SQL_COLSWHA) > 0) { $SQL_WHERE = "\n WHERE " . implode("\n AND ", $SQL_COLSWHA); } // Collapse the group by $SQL_GROUPBY = ''; if (count($yamlP2['groupby']) > 0) { $SQL_GROUPBY = "\n GROUP BY " . implode(',', $yamlP2['groupby']); } // Now build the final SQL $SQ = " SELECT " . $SQL_COLS . $SQL_FROMJOINS . $SQL_WHERE . $SQL_GROUPBY . $SQL_COLSOB; if (gp('gp_post') == 'onscreen') { $SQ .= " LIMIT 300"; } return $SQ; }
function SpecDDL_Triggers_ColConsMinMax() { $this->LogEntry("Building Min/Max column constraints"); $results = $this->SQLREAD("Select table_id,column_id,type_id,value_min,value_max \n FROM zdd.tabflat\n\t\t WHERE value_min<>'' OR value_max<>''"); while ($row = pg_fetch_array($results)) { if ($row['value_min'] != '') { $c = $row['column_id']; $msg = "Value must be at least " . $row['value_min']; $compare = "new." . trim($row['column_id']) . ' < ' . SQL_Format($row['type_id'], $row['value_min']); $s1 = "\n" . " -- 7010 Column Minimum Constraint\n" . " IF ({$compare}) THEN \n" . " ErrorCount = ErrorCount + 1;\n" . " ErrorList = ErrorList || ##{$c},6010,{$msg};##;\n" . " END IF;\n"; $this->SpecDDL_TriggerFragment($row["table_id"], "INSERT", "BEFORE", "7010", $s1); $this->SpecDDL_TriggerFragment($row["table_id"], "UPDATE", "BEFORE", "7010", $s1); } if ($row['value_max'] != '') { $c = $row['column_id']; $msg = "Value must be less than or equal to " . $row['value_max']; $compare = "new." . trim($row['column_id']) . ' > ' . SQL_Format($row['type_id'], $row['value_max']); $s1 = "\n" . " -- 7010 Column Maximum Constraint\n" . " IF ({$compare}) THEN \n" . " ErrorCount = ErrorCount + 1;\n" . " ErrorList = ErrorList || ##{$c},6011,{$msg};##;\n" . " END IF;\n"; $this->SpecDDL_TriggerFragment($row["table_id"], "INSERT", "BEFORE", "7010", $s1); $this->SpecDDL_TriggerFragment($row["table_id"], "UPDATE", "BEFORE", "7010", $s1); } } }
function scDBUpdateOrInsert($table, $colvals) { $table_id = $table["table_id"]; $tabflat =& $table["flat"]; // First query for the pk value. If not found we will // just do an insert // $abort = false; $a_pk = explode(',', $table['pks']); $s_where = ''; foreach ($a_pk as $colname) { if (!isset($colvals[$colname])) { $abort = true; break; } $a_where[] = $colname . ' = ' . SQL_Format($tabflat[$colname]['type_id'], $colvals[$colname]); } if ($abort) { $skey = false; } else { $s_where = implode(' AND ', $a_where); $sql = 'SELECT skey FROM ' . DDTable_IDResolve($table_id) . ' WHERE ' . $s_where; $skey = SQL_OneValue('skey', $sql); } // STD says on 12/15/2006 that this routine should not put errors on screen //if (Errors()) echo HTMLX_Errors(); if (!$skey) { //echo "insert into ".$table_id."\n"; $retval = SQLX_Insert($table, $colvals, false); if (Errors()) { // STD says on 12/15/2006 that this routine should not put errors on screen //echo HTMLX_Errors(); //echo $sql; $retval = 0; } } else { //echo "update ".$table_id." on $skey\n"; $colvals['skey'] = $skey; $retval = -$skey; SQLX_Update($table, $colvals); if (Errors()) { // STD says on 12/15/2006 that this routine should not put errors on screen //echo HTMLX_Errors(); //echo $sql; $retval = 0; } } return $retval; }
/** * Go get FETCH values from other tables * */ function fetch() { // Get the list of columns from the dd $column_id = gp('column'); $table_id = $this->dd['table_id']; $table_id_fko = $this->dd['flat'][$column_id]['table_id_fko']; $match = $table_id . '_' . $table_id_fko . '_'; $collist = $this->dd['FETCHDIST'][$match]; // Build the SQL to fetch the row $colsc = array(); $colsp = array(); foreach ($collist as $idx => $info) { $colsp[] = $info['column_id_par'] . ' as ' . $info['column_id']; } $type_id = $this->dd['flat'][$column_id]['type_id']; $value = SQL_Format($type_id, gp('value')); $sql = "SELECT " . implode(',', $colsp) . " FROM " . ddTable_idResolve($table_id_fko) . " WHERE " . $this->dd['fk_parents'][$table_id_fko]['cols_par'] . "= {$value}"; $answer = SQL_OneRow($sql); x4Data('fetch', $answer); }
function main() { // ------------------------------------------------ // Branch out to ajax handling functions if (gpExists('fwajax')) { return $this->FWAjax(); } // ...early return // ------------------------------------------------ // Public sites can turn off table maintenance pages if (vgfGet('suppress_maintenance', false)) { return; } vgfset('maintenance', true); # KFD 2/17/09 Sourceforge 2546056 # If we are in default main code branch, and # there is no data dictionary, the user has # called a bad page. if (!isset($this->table['projections'])) { ?> <h1>Bad Page Request</h1> <p>There is no page <?php echo hx(gp('gp_page')); ?> <?php return; } // If a "fk jump", retrieve skey and make it look // like an edit call. if (gp('gp_pk') != '') { $pkval = gp("gp_pk"); $pkcol = $this->table["pks"]; $pktyp = $this->table['flat'][$pkcol]["type_id"]; $table_id = $this->table["table_id"]; // KFD 10/26/06, used to be $table_id $sq = "SELECT skey FROM " . $this->view_id . " WHERE " . $pkcol . " = " . SQL_Format($pktyp, $pkval); gpSet('gp_skey', SQL_OneValue('skey', $sq)); gpSet('gp_mode', 'upd'); } // If we were invoked by a child table, don't do this if (is_null($this->table_obj_child)) { // KFD 10/26/06, keep as $table_id Hidden('gp_page', $this->table_id); // always return to same page Hidden('gp_mode', ''); Hidden('gp_skey', ''); Hidden('gp_action', ''); Hidden('gp_save', ''); hidden('gp_copy', ''); } // Work out what to do if mode is blank. Might mean // upd, might mean browse. $mode = gp('gp_mode'); $skey = gp('gp_skey'); if ($mode == '') { $mode = $this->MainCheckForMover(); if ($mode == '') { $mode = $skey == '' ? 'browse' : 'upd'; gpSet('gp_mode', $mode); } } $this->mode = $mode; // KFD 8/13/07, Experimental COPY ability if (gp('gp_action') == 'copy') { $mode = 'ins'; gpSet('gp_mode', 'ins'); } switch ($mode) { case 'search': $this->PageSubtitle .= " (Lookup Mode)"; break; case 'ins': $this->PageSubtitle .= " (New Entry)"; break; } // ---------------------------------------------- // Generate the main HTML elements if ($mode == 'browse') { $this->hBrowse(); } elseif ($mode == 'mover') { $this->hMover(); } else { $this->hBoxes($mode); } if ($mode != "mover") { $this->hButtonBar($mode); } $this->hLinks($mode); $this->hExtra($mode); // Now if this is a child table in a 1:M, it will not actually // output its own stuff, it will invoke its parent, so let's // buffer the output if ($this->table_id_parent != '') { ob_start(); } // Echo out the HTML $this->ehMain(); // Put this out at end, after all HTML has been output if ($mode == "search") { //$controls=vgfGet('gpControls'); $controls = ContextGet('OldRow'); $hScript = ''; foreach ($controls as $key => $info) { $hScript .= "\nob('x2t_{$key}').value='';"; } jqDocReady("function clearBoxes() { \n" . $hScript . "}\n\n"); } // Again, if this is a child table in a 1:M, capture the output and // make it the responsibility of the parent if ($this->table_id_parent != '') { $this->h['Complete'] = ob_get_clean(); // Wipe out and replace all gp variables, fool the parent object $OldRow = ContextGet('OldRow', array()); $gpsave = aFromGP('gp_'); gpUnsetPrefix('gp_'); $dd = ContextGet('drilldown', array()); $dd1 = array_pop($dd); gpSet('gp_skey', $dd1['skey']); // Now invoke the parent object, tell it about us $object = objPage($this->table_id_parent); $object->table_obj_child = $this; $object->main(); // Replace the wiped out gp variables gpUnsetPrefix('gp_'); gpSetFromArray('gp_', $gpsave); ContextSet('OldRow', $OldRow); // Force the menu to come from the parent vgaSet('menu_selected', $this->table_id_parent); } }
function profile_conventional() { # KFD 2/17/09 Sourceforge 2546056. The dispatching system # sends page requests here by default. This is # where we have to work out if there is a bad # page request. if (!isset($this->dd['table_id'])) { ?> <h1>No Page By That Name</h1> <p>There is no page <b><?php echo hx(gp('x6page')); ?> </b>. <?php return; } # KFD 2/9/09, new feature for Jeff/wholdist. If "table_id_par" # was passed in, load a certain row from the parent # table into the bulletin board. Specifically this # is so the table can act like a child table # w/respect to loading FETCH and FETCHDEF values. # Maybe we'll do more with it later. $tid_par = gp('table_id_par', ''); if ($tid_par != '') { $ddpar = ddTable($tid_par); $pks = explode(',', $ddpar['pks']); $aWhere = array(); foreach ($pks as $pk) { $type_id = $ddpar['flat'][$pk]['type_id']; if (($pkval = gp('pre_' . $pk)) != '') { $aWhere[] = $pk . '=' . SQL_Format($type_id, $pkval); } } $sql = 'select * from ' . ddView($tid_par) . ' where ' . implode('AND', $aWhere); $row = sql_oneRow($sql); x6Script("x6bb.fwSet('dbRow_{$tid_par}'," . json_encode($row) . ')'); } # Grab the data dictionary for this table $dd = $this->dd; $table_id = $this->dd['table_id']; # KFD 4/15/09 Sourceforge 2765788, handle no kids gracefully, # work out how many kids there are to display $kidCount = 0; foreach ($dd['fk_children'] as $child => $info) { if (trim(arr($info, 'x6display', '')) != 'none') { $kidCount++; } } # Create the top level div as a table controller $top = new androHTMLTableController($table_id); $top->addClass('fadein'); # Various heights. Assume all borders are the same and get # only one. $hinside = x6cssDefine('insideheight'); $hh1 = x6cssHeight('h1'); $htabs = x6cssHeight('.ui-tabs-nav li'); $hborder = x6cssRuleSize('ui-tabs-panel', 'border-top'); $pad0 = x6cssDefine('pad0'); $hlh = x6CssDefine('lh0'); # $hpane1 is the outer, it is what is left after removing # h1, one row of tabs, and padding at bottom. # KFD 4/15/09 Sourceforge 2765788, if no kids, correct height if ($kidCount == 0) { $htabs = 0; } $hpane1 = $hinside - $hh1 - $htabs - $pad0 * 2; # $hchild is the height of the empty nested tab # pane, hardcoded at pad0. This is where the child # tables are initially displayed -- at the bottom of the # detail pane. They are initially slid all of the way down, # that is why their height is only pad0. $hempty = $pad0; # $hdetail is the height of the detail pane inside of the # detail tab. It is the $hpane1 less another tab (the # nested one), and $hempty, and a double padding $hdetail = $hpane1 - $htabs - $hempty - $pad0 * 2; # Begin with title and tabs $top->h('h1', $dd['description']); if (method_exists($this, 'insert_belowh1')) { $this->insert_belowh1($top); } $options = array('x6profile' => 'conventional', 'x6table' => $table_id); $tabs = $top->addTabs('tabs_' . $table_id, $hpane1, $options); $lookup = $tabs->addTab('Lookup'); $detail = $tabs->addTab('Detail', true); # Make a generic grid, which will show all uisearch # columns, and add a row of lookup inputs to it. # Enclose it in a div that gives some padding on top # and bottom. Divide up the left-right free space to # put 1/3 on the left and the remaining on the right. $divgrid = $lookup->h('div'); $grid = $divgrid->addGrid($hpane1 - $hlh * 2, $table_id, true, true); $grid->hp['x6profile'] = 'conventional'; $gridWidth = $this->gridGeneric($grid, $dd); # Work out the available free width after making the grid $wAvail = x6cssDefine('insidewidth') - 2 - x6cssDefine('pad0') * 2 - $gridWidth; $divgrid->hp['style'] = "padding-left: " . intval($wAvail / 3) . "px;\n padding-top: " . x6CSSDefine('lh0') . "px;"; # tell the browse tab object to focus when it is selected $lookup->hp['x6objectFocusId'] = $grid->hp['id']; # This is kind of a hack for forcing exact matches when # a maintenance screen is invoked with pre-set parameters if (gp('x6exactPre') == 1) { $grid->hp['x6exactPre'] = 1; } # We are making # the assumption that there will *always* be child tables # because otherwise the programmer would have selected # a different profile. # $divDetail = $detail->addDetail($dd['table_id'], true, $hdetail, $tid_par); $divDetail->addCustomButtons($this->customButtons()); $divDetail->ap['xTabSelector'] = $tabs->ul->hp['id']; $divDetail->ap['xTabIndex'] = 1; $divDetail->ap['x6profile'] = 'conventional'; $detail->hp['x6objectFocusId'] = $divDetail->hp['id']; # KFD 5/27/09 Google #21 Allow user to override the detail if (method_exists($this, $table_id . '_detail')) { $method = $table_id . '_detail'; $this->{$method}($divDetail); } # The div kids is a tabbar of child tables. Notice that we # put nothing into them. They are loaded dynamically when # the user picks them. $options = array('x6slideUp' => $divDetail->hp['id'], 'x6slideUpInner' => $divDetail->innerId, 'x6parentTable' => $table_id, 'x6profile' => 'kids', 'x6table' => $table_id, 'styles' => array('overflow' => 'hidden')); # KFD 4/15/09 Sourcefroge 2765788 no kids handle gracefully if ($kidCount > 0) { $tabKids = $detail->addTabs('kids_' . $table_id, $hempty, $options); $tabKids->ul->hp['xOffset'] = 2; $tab = $tabKids->addTab("Hide"); $idx = 0; foreach ($dd['fk_children'] as $child => $info) { # KFD 1/2/09. If x6display is 'none', skip it if (trim(arr($info, 'x6display', '')) == 'none') { continue; } $tc = $top->addTableController($child); $tc->hp['x6tablepar'] = $table_id; $tab = $tabKids->addTab($info['description']); $tab->ap['x6tablePar'] = $table_id; $tab->ap['x6table'] = $child; if ($info['x6childwrites'] == 'detail') { # Create the basic detail $modal = new androHTMLDetail($child, true, 700, $table_id); # KFD 5/27/09 Google #21 Allow user to override if (method_exists($this, $child . '_detail')) { $method = $child . '_detail'; $this->{$method}($modal); } # Now see if we need to add buttons if (file_exists(fsDirtop() . "application/x6{$child}.php")) { include_once fsDirtop() . "application/x6{$child}.php"; $childClass = 'x6' . $child; $objChild = new $childClass(); $custom = $objChild->customButtons(); $modal->addCustomButtons($custom); } # Tell framework to add it to the output. addModal($modal); } } # And then loop through extra tabs foreach ($this->appTabs as $child => $caption) { $top->addTableController($child); $tab = $tabKids->addTab($caption); $tab->hp['x6tablePar'] = $table_id; $tab->hp['x6table'] = $child; } } # tell the screen to start out by focusing on # the browse jqDocReady("x6events.fireEvent('objectFocus','{$grid->hp['id']}')"); # KFD 3/20/09 Sourceforge 2697962 # index_hidden calls this now #$this->hldOut($top); $top->render(); }
function index_hidden_ajx1ctable() { // First fetch the values $table_id = gp('ajxc1table'); $colname = gp('ajxcol'); $colvalue = gp('ajxval'); $skey = gp('ajxskey'); // Now prepare the data dictionary and issue the update $dd = dd_tableref($table_id); $colvalue = SQL_Format($dd['flat'][$colname]['type_id'], $colvalue); SQL("UPDATE {$table_id} SET {$colname} = {$colvalue} WHERE skey = {$skey}"); // Errors will appear as a popup if (Errors()) { echo "echo|" . hErrors(); return; } // If they requested values back, provide those now if (gp('ajxlist') != '' && gp('ajxlist') != 'X') { // Initialize the array of information about the queries we will make $info = array($table_id => array('skey' => $skey)); // Split the list and build the arrays of information we need to // run queries and generate return values for display $raw = explode(',', gp('ajxlist')); $returns = array(); foreach ($raw as $rawone) { // Parse each value into the three values it contains list($control, $table, $column) = explode(".", $rawone); if ($control == '-skey-') { // this is magic value that tells us its the skey $info[$table]['skey'] = $column; //column actually is skey here } else { // normal case, we've been told a control, table, and column. // If no table given, assume the table we updated $table = $table == '' ? $table_id : $table; $info[$table]['columns'][] = $column; $info[$table]['controls'][] = $control; } } // Now go through each table, pull the data, and build the returns foreach ($info as $table => $tabinfo) { if (!isset($tabinfo['skey'])) { $returns[] = "echo|No skey passed for table {$table}"; } else { $sk = $tabinfo['skey']; $cols = implode(',', $tabinfo['columns']); $row = SQL_OneRow("SELECT {$cols} FROM {$table} WHERE skey = {$sk}"); foreach ($tabinfo['columns'] as $index => $colname) { $returns[] = '_value' . '|' . $tabinfo['controls'][$index] . '|' . $row[$colname]; } } } echo implode("|-|", $returns); } }
function main() { $x_app = trim(gp('txt_application')); session_write_close(); ob_start(); echo "<h1>Build in progress</h1>"; echo "<hr>"; echo "<p>The system is now building the application: <b>" . $x_app . "</b>.</p>"; echo "<p>If you are testing and expect to build several times in a row, do not "; echo "close this window, just hit REFRESH and the build will start again.</p>"; echo "<p>All information below this line is from the build log.</p>"; echo "<hr>"; // Get everything we need from the database, use it to build // a "do" program. // $GLOBALS["x_password"] = trim(gp("supassword")); $tsql = 'SELECT * from applications ' . ' WHERE application = ' . SQL_Format('char', $x_app); $row_a = SQL_OneRow($tsql); $tsql = 'SELECT * from webpaths ' . ' WHERE webpath = ' . SQL_Format('char', $row_a['webpath']); $row_n = SQL_OneRow($tsql); $dirws = trim($row_n["dir_pub"]); if (substr($dirws, -1, 1) != "/") { $dirws .= "/"; } $row["webserver_dir_pub"] = $dirws; $string = ' <?php // To run this program from the command line, you must // be logged in as a user that has superuser priveleges, such // as root or postgres. When running from the web app, // the current user\'s priveleges are used. $GLOBALS["parm"] = array( "DBSERVER_URL"=>"localhost" ,"UID"=>"' . SessionGet('UID') . '" ,"DIR_PUBLIC"=>"' . trim($row_n["dir_pub"]) . '" ,"DIR_PUBLIC_APP"=>"' . $x_app . '" ,"LOCALHOST_SUFFIX"=>"' . ArraySafe($row_n, 'dir_local', '') . '" ,"APP"=>"' . $x_app . '" ,"APPDSC"=>"' . trim($row_a["description"]) . '" ,"XDIRS"=>"' . trim($row_a['xdirs']) . '" ,"ROLE_LOGIN"=>"' . ArraySafe($row_a, 'flag_rolelogin', 'Y') . '" ,"FLAG_PWMD5"=>"' . ArraySafe($row_a, 'flag_pwmd5', 'N') . '" ,"TEMPLATE"=>"' . trim($row_a['template']) . '" ,"SPEC_BOOT"=>"' . trim($row_a["appspec_boot"]) . '" ,"SPEC_LIB"=>"' . trim($row_a["appspec_lib"]) . '" ,"SPEC_LIST"=>"' . trim($row_a["appspec"]) . '"); include("androBuild.php"); ?> '; $t = pathinfo(__FILE__); $dircur = AddSlash($t["dirname"]) . "../tmp/"; $file = $dircur . "do" . $x_app . ".php"; $FILE = fopen($file, "w"); fwrite($FILE, $string); fclose($FILE); x_EchoFlush(""); include $file; echo ob_get_clean(); }
function ehTab_Filters_OLD() { $skey = SQL_Format('numb', gp('gp_skey')); $sq = "SELECT rc.table_id,rc.column_id\n ,rc.compoper,rc.compval\n ,t.description as tdesc\n ,f.description as cdesc\n ,rc.skey\n FROM reportcolumns rc \n JOIN reports r ON r.report = rc.report\n JOIN tables t ON rc.table_id = t.table_id\n JOIN tabflat f ON rc.table_id = f.table_id\n AND rc.column_id= f.column_id\n WHERE r.skey={$skey}\n ORDER BY rc.uicolseq"; $rows = SQL_AllRows($sq); $opts = array('', '=', '!=', '>', '<', '>=', '<='); ob_start(); foreach ($rows as $row) { $row['compoper'] = trim($row['compoper']); $hSelBase = "'&gp_ajax=colsave&gp_colsk=" . $row['skey'] . "&gp_val='+this.value+'&gp_col="; $hSel1 = $hSelBase . "compoper'"; $hSel2 = $hSelBase . "compval'"; $hOpts = ''; foreach ($opts as $opt) { $sel = $row['compoper'] == $opt ? ' SELECTED ' : ''; $hOpts .= "\n<option {$sel} value=\"{$opt}\">" . htmlentities($opt) . "</option>"; } ?> <tr> <td><?php echo '(' . $row['tdesc'] . ') ' . $row['cdesc']; ?> <td><select onchange="sndReq(<?php echo $hSel1; ?> )" value="<?php echo $row['compoper']; ?> "> <?php echo $hOpts; ?> </select> <td><input onblur="sndReq(<?php echo $hSel2; ?> )" value="<?php echo $row['compval']; ?> " size=70 maxlength=100> </tr> <?php } $hHTML = ob_get_clean(); ?> <table width=100%> <tr> <td class="dhead" style="width:25%">Column <td class="dhead" style="width:10%">Operator <td class="dhead" style="width:65%">Value </tr> <?php echo $hHTML; ?> </table> <?php }