$tpl = new MSDTemplate(); $tpl->set_filenames(array('show' => './tpl/sqlbrowser/sql_record_update_inputmask.tpl')); $target = $mode == "searchedit" ? '?mode=searchedit' : '?mode=update'; // jump back to search hit list after saving $fields = getExtendedFieldInfo($db, $tablename); $sqledit = "SELECT * FROM `{$tablename}` WHERE " . $recordkey; $res = MSD_query($sqledit); $record = mysqli_fetch_array($res, MYSQLI_ASSOC); // get the record $num = sizeof($record); // get the nr of fields of the record // iterate fields $x = 0; $fieldnames = ''; foreach ($record as $field => $fieldvalue) { $fieldnames .= $field . '|'; $tpl->assign_block_vars('ROW', array('CLASS' => $x % 2 ? 1 : 2, 'FIELD_NAME' => $field, 'FIELD_VALUE' => my_quotes($fieldvalue), 'FIELD_ID' => correct_post_index($field))); if ('YES' == $fields[$field]['null']) { //field is nullable - precheck checkbox if value is null $tpl->assign_block_vars('ROW.IS_NULLABLE', array('NULL_CHECKED' => is_null($fieldvalue) ? ' checked="checked"' : '')); } $type = strtoupper($fields[$field]['type']); if (in_array($type, array('BLOB', 'TEXT'))) { $tpl->assign_block_vars('ROW.IS_TEXTAREA', array()); } else { $tpl->assign_block_vars('ROW.IS_TEXTINPUT', array()); } $x++; } $tpl->assign_vars(array('HIDDEN_FIELDS' => FormHiddenParams(), 'FIELDNAMES' => substr($fieldnames, 0, strlen($fieldnames) - 1), 'SQL_STATEMENT' => my_quotes($sql['sql_statement']), 'RECORDKEY' => my_quotes($recordkey), 'TARGET' => $target)); $tpl->pparse('show');
$file_htaccess = @fopen('.htaccess', 'w'); if ($file_htaccess) { $saved = fputs($file_htaccess, $htaccess); fclose($file_htaccess); } else { $saved = false; } } if (false !== $saved) { $msg = $lang['L_HTACC_CREATED']; $tpl->assign_block_vars('CREATE_SUCCESS', array('HTACCESS' => nl2br(my_quotes($htaccess)), 'HTPASSWD' => nl2br(my_quotes($htpasswd)))); @chmod($config['paths']['root'], 0755); } else { $tpl->assign_block_vars('CREATE_ERROR', array('HTACCESS' => nl2br(my_quotes($htaccess)), 'HTPASSWD' => nl2br(my_quotes($htpasswd)))); } } } if (sizeof($error) > 0 || !isset($_POST['username'])) { $tpl->assign_vars(array('PASSWORDS_UNEQUAL' => my_addslashes($lang['L_PASSWORDS_UNEQUAL']), 'HTACC_CONFIRM_DELETE' => my_addslashes($lang['L_HTACC_CONFIRM_DELETE']))); $tpl->assign_block_vars('INPUT', array('USERNAME' => my_quotes($username), 'USERPASS1' => my_quotes($userpass1), 'USERPASS2' => my_quotes($userpass2), 'TYPE0_CHECKED' => $type == 0 ? ' checked="checked"' : '', 'TYPE1_CHECKED' => $type == 1 ? ' checked="checked"' : '', 'TYPE2_CHECKED' => $type == 2 ? ' checked="checked"' : '', 'TYPE3_CHECKED' => $type == 3 ? ' checked="checked"' : '')); } if (sizeof($error) > 0) { $msg = '<span class="error">' . implode('<br>', $error) . '</span>'; } if ($msg > '') { $tpl->assign_block_vars('MSG', array('TEXT' => $msg)); } $tpl->pparse('show'); echo MSDFooter(); ob_end_flush(); die;
<?php // insert a new record $tpl = new MSDTemplate(); $tpl->set_filenames(array('show' => './tpl/sqlbrowser/sql_record_insert_inputmask.tpl')); $sqledit = "SHOW FIELDS FROM `{$tablename}`"; $res = MSD_query($sqledit); $num = mysql_numrows($res); $feldnamen = ""; for ($x = 0; $x < $num; $x++) { $row = mysql_fetch_object($res); $feldnamen .= $row->Field . '|'; $tpl->assign_block_vars('ROW', array('CLASS' => $x % 2 ? 1 : 2, 'FIELD_NAME' => $row->Field, 'FIELD_ID' => correct_post_index($row->Field))); $type = strtoupper($row->Type); if (strtoupper($row->Null) == 'YES') { //field is nullable $tpl->assign_block_vars('ROW.IS_NULLABLE', array()); } if (in_array($type, array('BLOB', 'TEXT'))) { $tpl->assign_block_vars('ROW.IS_TEXTAREA', array()); } else { $tpl->assign_block_vars('ROW.IS_TEXTINPUT', array()); } } $tpl->assign_vars(array('HIDDEN_FIELDS' => FormHiddenParams(), 'FIELDNAMES' => substr($feldnamen, 0, strlen($feldnamen) - 1), 'SQL_STATEMENT' => my_quotes($sql['sql_statement']))); $tpl->pparse('show');