示例#1
0
<form action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" name="barcode_drawer" method="post">
<?php 
$table = new LSTable(8, 2, '500', $null);
$table->setTitle('Configs for ' . $filename);
$table->addRowAttribute(0, 'class', 'table_title');
$table->addCellAttribute(0, 0, 'colspan', '2');
$table->addCellAttribute(0, 0, 'align', 'center');
$table->setText(0, 0, '<font color="#ffffff"><b>General Configs</b></font>');
$table->addCellAttribute(1, 0, 'width', '100');
$table->setText(1, 0, 'Type');
$table->setText(1, 1, display_select($filename));
$table->setText(2, 0, 'Output');
$table->setText(2, 1, display_output($output));
$table->setText(3, 0, 'Thickness');
$table->setText(3, 1, display_thickness($thickness));
$table->setText(4, 0, 'Resolution');
$table->setText(4, 1, display_res($res));
$table->setText(5, 0, 'Font Size');
$table->setText(5, 1, display_font($font));
$table->setText(6, 0, 'Text');
$table->setText(6, 1, display_text($text2display));
$table->addCellAttribute(7, 0, 'align', 'center');
$table->addCellAttribute(7, 0, 'colspan', '2');
$table->setText(7, 0, '<input type="submit" value="Generate" />');
if (!empty($text2display)) {
    $table->insertRows(8, 1);
    $table->addCellAttribute(8, 0, 'align', 'center');
    $table->addCellAttribute(8, 0, 'colspan', '2');
示例#2
0
/**
 * Callback function for PHP error handling (not to be used directly - it will be called by PHP when needed)
 * @param int $errno Error number
 * @param string $errstr Error text
 * @param string $errfile File containing the error
 * @param int $errline Line number containing the error
 * @return bool False if the default PHP internal error handler should handle the error
 */
function fn_error_handler($errno, $errstr, $errfile, $errline)
{
    if (!(error_reporting() & $errno)) {
        return true;
    }
    $errfile = str_replace(FNEWS_ROOT_PATH, '', str_replace('\\', '/', $errfile));
    switch ($errno) {
        // Very bad error indeed...
        // Show a complete failure page.
        case E_USER_ERROR:
        case E_ERROR:
            ob_end_clean();
            echo '<!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">', '<head>', '	<meta http-equiv="content-type" content="text/html; charset=utf-8" />', '	<title>Fusion News &bull; Error</title>', '	<style type="text/css">', '	<!--', '	body { background-color:#fff; color:#000; line-height:140%; font-size:100%; font-family:"Trebuchet MS", Helvetica, sans-serif }', '	blockquote { padding:0; margin: 0 30px }', '	#wrapper { width:95%; margin:0 auto }', '	//-->', '	</style>', '</head>', '<body>', '<h1>Fusion News has encountered a fatal error</h1>', '<div id="wrapper">', '<p>A fatal error was encountered by Fusion News, and cannot continue to run.</p>', '<p>The error message is as follows:</p>', '<blockquote><i>', $errstr, '</i></blockquote>', '<p>If there are any instructions in the error message above, please follow them to try to solve the problem. If the error repeats itself, after refreshing the page after 30 seconds, please create a new topic at the <a href="http://www.fusionnews.net/">Fusion News Support Forum</a>, and copy and paste the text below:</p>', '<blockquote><code>Error: ', $errstr, '<br />', 'File: ', $errfile, '<br />', 'Line No.: ', $errline, '<br />', 'Version: ', FNEWS_CURVE, '</code></blockquote>', '</div>', '</body>', '</html>';
            exit;
            return true;
            break;
        case E_USER_NOTICE:
        case E_USER_WARNING:
            global $title, $ind17, $skin, $userdata;
            if (!$title) {
                $title = $ind17;
            }
            echo '<div id="fn_warning">', '<li class="title">' . $ind17 . '</li>', '<li>' . $errstr . '</li>', '</div>', "\n";
            $errored_out = true;
            display_output($title, $skin, $userdata);
            exit;
            return true;
            break;
        case E_NOTICE:
            global $notice_buffer;
            $notice_buffer .= '<li> ' . $errstr . ' in /' . $errfile . ' on line ' . $errline . '</li>' . "\n";
            return true;
            break;
        case E_WARNING:
            global $warning_buffer;
            $warning_buffer .= '<li>' . $errstr . ' in /' . $errfile . ' on line ' . $errline . '</li>' . "\n";
            return true;
            break;
        default:
            break;
    }
    return true;
}
示例#3
0
/**
 * Generates JSON response and terminates the script
 *
 * @param $output
 */
function display_output($output)
{
    $output = json_encode($output);
    header('Content-Type: application/json');
    echo $output;
    die;
}
if (!is_file($filename) || is_file($filename) && filemtime($filename) + $update_period < time()) {
    update_cache();
}
if (isset($_POST['s']) && strlen($_POST['s'] >= $min_strlen)) {
    $search_str = $_POST['s'];
} else {
    display_output(['error', 'No search parameters in request']);
}
$json = json_decode(file_get_contents($filename), true);
$found_keys = array();
foreach ((array) $json as $key => $record) {
    foreach ((array) $record as $value) {
        if (strpos($value, $search_str) !== false) {
            $found_keys[$key] = $key;
        }
    }
}
display_output($found_keys);
die;
示例#4
0
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
/**
 * And finally display the output
 */
display_output($title, $skin, $userdata);