define( 'PRINT_ALL_BUG_OPTIONS_INC_ALLOW', true ); include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'print_all_bug_options_inc.php' ); form_security_validate( 'print_all_bug_options_update' ); auth_ensure_user_authenticated(); $f_user_id = gpc_get_int( 'user_id' ); $f_redirect_url = gpc_get_string( 'redirect_url' ); # the check for the protected state is already done in the form, there is # no need to duplicate it here. # get the fields list $t_field_name_arr = get_field_names(); $field_name_count = count($t_field_name_arr); # check the checkboxes for ($i=0 ; $i <$field_name_count ; $i++) { $t_name='print_'.utf8_strtolower(str_replace(' ','_',$t_field_name_arr[$i])); $t_flag = gpc_get( $t_name, null ); if ( $t_flag === null ) { $t_prefs_arr[$i] = 0; } else { $t_prefs_arr[$i] = 1; } } # get user id
} if (!$pos) { $pos = 0; } if (!$id) { $id = get_newid("referenz"); } for ($x = 0; $x < 6; $x++) { if (${"f_pic_title_".$x}) { $pic_tits[$x] = ${"f_pic_title_".$x}; } else { $pic_tits[$x] = "---"; } } $pic_titstr = implode("#",$pic_tits); $fields = implode(",",get_field_names("referenz")); $vals = "'".$id."','".addslashes($f_name)."','".addslashes($f_txt)."','".addslashes($pic_titstr)."','".$picstr."','".$pos."'"; replace_data("referenz",$fields,$vals); echo "<script language=\"javascript\">self.location.href='list.php'</script>"; exit; } } if ($init == "do") { $data = get_row("referenz","id,name,txt,img_titles,imgs,pos","id=".$id); $f_name = $data['name']; $f_txt = $data['txt']; $pos = $data['pos']; if ($data['img_titles']) { $pic_tits = explode("#",$data['img_titles']); for ($x = 0; $x < count($pic_tits); $x++) {
/** * Edit Printing preferences * @param int $p_user_id user id * @param bool $p_error_if_protected error if account protected * @param string $p_redirect_url redirect url */ function edit_printing_prefs($p_user_id = null, $p_error_if_protected = true, $p_redirect_url = '') { if (null === $p_user_id) { $p_user_id = auth_get_current_user_id(); } $c_user_id = db_prepare_int($p_user_id); # protected account check if ($p_error_if_protected) { user_ensure_unprotected($p_user_id); } $t_user_print_pref_table = db_get_table('user_print_pref'); if (is_blank($p_redirect_url)) { $p_redirect_url = 'print_all_bug_page.php'; } # get the fields list $t_field_name_arr = get_field_names(); $field_name_count = count($t_field_name_arr); # Grab the data $query = "SELECT print_pref\n\t\t\tFROM {$t_user_print_pref_table}\n\t\t\tWHERE user_id=" . db_param(); $result = db_query_bound($query, array($c_user_id)); ## OOPS, No entry in the database yet. Lets make one if (0 == db_num_rows($result)) { # create a default array, same size than $t_field_name for ($i = 0; $i < $field_name_count; $i++) { $t_default_arr[$i] = 1; } $t_default = implode('', $t_default_arr); # all fields are added by default $query = "INSERT\n\t\t\t\tINTO {$t_user_print_pref_table}\n\t\t\t\t(user_id, print_pref)\n\t\t\t\tVALUES\n\t\t\t\t(" . db_param() . "," . db_param() . ")"; $result = db_query_bound($query, array($c_user_id, $t_default)); # Rerun select query $query = "SELECT print_pref\n\t\t\t\tFROM {$t_user_print_pref_table}\n\t\t\t\tWHERE user_id=" . db_param(); $result = db_query_bound($query, array($c_user_id)); } # putting the query result into an array with the same size as $t_fields_arr $row = db_fetch_array($result); $t_prefs = $row['print_pref']; # Account Preferences Form BEGIN $t_index_count = 0; ?> <br /> <div> <form method="post" action="print_all_bug_options_update.php"> <?php echo form_security_field('print_all_bug_options_update'); ?> <input type="hidden" name="user_id" value="<?php echo $p_user_id; ?> " /> <input type="hidden" name="redirect_url" value="<?php echo string_attribute($p_redirect_url); ?> " /> <table class="width75" cellspacing="1"> <tr> <td class="form-title"> <?php echo lang_get('printing_preferences_title'); ?> </td> <td class="right"> </td> </tr> <?php # display the checkboxes for ($i = 0; $i < $field_name_count; $i++) { echo '<tr>'; ?> <th class="category"> <?php echo lang_get($t_field_name_arr[$i]); ?> </th> <td> <input type="checkbox" name="<?php echo 'print_' . $t_field_name_arr[$i]; ?> " <?php if (isset($t_prefs[$i]) && $t_prefs[$i] == 1) { echo 'checked="checked"'; } ?> /> </td> </tr> <?php } ?> <tr> <td> </td> <td> <input type="submit" class="button" value="<?php echo lang_get('update_prefs_button'); ?> " /> </td> </tr> </table> </form> </div> <br /> <div class="border center"> <form method="post" action="print_all_bug_options_reset.php"> <?php echo form_security_field('print_all_bug_options_reset'); ?> <input type="submit" class="button" value="<?php echo lang_get('reset_prefs_button'); ?> " /> </form> </div> <?php }
<?php require_once '../php/firephp/fb.php'; require_once '../functions/db_lib.php'; $table_name = null; if (isset($_REQUEST['table_name']) && $_REQUEST['table_name'] != '') { $table_name = $_REQUEST['table_name']; } fb($table_name, '$table_name'); $field_names = get_field_names($table_name); fb($field_names, '$field_names'); header('content-type:application/json'); echo json_encode($field_names);