function driver_manufacturer_model($msg) { $msg = stri_replace('{align_center}', '', $msg); $msg = stri_replace('{align_left}', '', $msg); $msg = stri_replace('{barcode_code39}', '', $msg); $msg = stri_replace('{/barcode_code39}', '', $msg); $msg = stri_replace('{dashes_row}', '', $msg); $msg = stri_replace('{feed_reverse}', '', $msg); $msg = stri_replace('{feed_reverse2}', '', $msg); $msg = stri_replace('{init}', '', $msg); $msg = stri_replace('{height_double}', '', $msg); $msg = stri_replace('{/height_double}', '', $msg); $msg = stri_replace('{highlight}', '', $msg); $msg = stri_replace('{/highlight}', '', $msg); $msg = stri_replace('{no_paper_print_disabler}', '', $msg); $msg = stri_replace('{page_cut}', '', $msg); $msg = stri_replace('{paper_release}', '', $msg); $msg = stri_replace('{size_double}', '', $msg); $msg = stri_replace('{/size_double}', '', $msg); $msg = stri_replace('{size_normal}', '', $msg); $msg = stri_replace('{size_triple}', '', $msg); $msg = stri_replace('{/size_triple}', '', $msg); $msg = stri_replace('{tab_define}', '', $msg); $msg = stri_replace('{unknown}', '', $msg); return $msg; }
/** * My Handy Restaurant * * http://www.myhandyrestaurant.org * * My Handy Restaurant is a restaurant complete management tool. * Visit {@link http://www.myhandyrestaurant.org} for more info. * Copyright (C) 2003-2005 Fabio De Pascale * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @author Fabio 'Kilyerd' De Pascale <*****@*****.**> * @package MyHandyRestaurant * @copyright Copyright 2003-2005, Fabio De Pascale */ function driver_tm($msg) { $msg = stri_replace('{align_center}', '', $msg); $msg = stri_replace('{align_left}', '', $msg); $msg = stri_replace('{barcode_code39}', '', $msg); $msg = stri_replace('{/barcode_code39}', '', $msg); $msg = stri_replace('{dashes_row}', '', $msg); $msg = stri_replace('{feed_reverse}', '', $msg); $msg = stri_replace('{feed_reverse2}', '', $msg); $msg = stri_replace('{init}', '', $msg); $msg = stri_replace('{height_double}', chr(0x1b) . chr(33) . chr(8), $msg); $msg = stri_replace('{/height_double}', chr(0x1b) . chr(33) . chr(8), $msg); $msg = stri_replace('{highlight}', '', $msg); $msg = stri_replace('{/highlight}', '', $msg); $msg = stri_replace('{no_paper_print_disabler}', '', $msg); $msg = stri_replace('{page_cut}', chr(0x1d) . chr(0x56) . chr(0x31), $msg); $msg = stri_replace('{paper_release}', '', $msg); $msg = stri_replace('{size_double}', chr(0x1d) . chr(0x21) . chr(0x1), $msg); $msg = stri_replace('{/size_double}', chr(0x1b) . chr(0x21) . chr(0), $msg); $msg = stri_replace('{size_normal}', '', $msg); $msg = stri_replace('{size_triple}', chr(0x1d) . chr(0x21) . chr(0x30), $msg); $msg = stri_replace('{/size_triple}', chr(0x1d) . chr(0x21) . chr(0), $msg); $msg = stri_replace('{tab_define}', '', $msg); $msg = stri_replace('{unknown}', '', $msg); return $msg; }
/** * My Handy Restaurant - Star printer driver * * http://www.myhandyrestaurant.org * * My Handy Restaurant is a restaurant complete management tool. * Visit {@link http://www.myhandyrestaurant.org} for more info. * Copyright (C) 2003-2005 Fabio De Pascale * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @author Fabio 'Kilyerd' De Pascale <*****@*****.**> * @package MyHandyRestaurant * @copyright Copyright 2003-2005, Fabio De Pascale */ function driver_star($msg) { $msg = stri_replace("é", chr(176), $msg); $msg = stri_replace("è", chr(177), $msg); $msg = stri_replace("à", chr(207), $msg); $msg = stri_replace("ù", chr(192), $msg); $msg = stri_replace("ò", chr(187), $msg); $msg = stri_replace("ì", chr(182), $msg); $msg = stri_replace('{dashes_row}', "-------------------------------", $msg); $msg = stri_replace('{height_double}', chr(27) . 'i10', $msg); $msg = stri_replace('{/height_double}', chr(27) . 'i00', $msg); $msg = stri_replace('{size_triple}', chr(27) . 'i22', $msg); $msg = stri_replace('{/size_triple}', chr(27) . 'i00', $msg); $msg = stri_replace('{size_double}', chr(27) . 'i11', $msg); $msg = stri_replace('{/size_double}', chr(27) . 'i00', $msg); $msg = stri_replace('{size_normal}', chr(27) . 'i00', $msg); //$msg = stri_replace ('{align_center}',"\n".chr(27).chr(29)."a1",$msg); $msg = stri_replace('{align_left}', "\n" . chr(27) . chr(29) . "a0", $msg); $msg = stri_replace('{highlight}', chr(27) . '4', $msg); $msg = stri_replace('{/highlight}', chr(27) . '5', $msg); $msg = stri_replace('{paper_release}', '{page_cut}', $msg); $msg = stri_replace('{page_cut}', "\n" . chr(27) . 'd2', $msg); $msg = stri_replace('{barcode_code39}', chr(27) . "b422" . chr(100), $msg); $msg = stri_replace('{/barcode_code39}', chr(30), $msg); return $msg; }
function replaceHelper(&$dbi, &$request, $pagename, $from, $to, $case_exact = true, $regex = false) { $page = $dbi->getPage($pagename); if ($page->exists()) { // don't replace default contents $current = $page->getCurrentRevision(); $version = $current->getVersion(); $text = $current->getPackedContent(); if ($regex) { $newtext = preg_replace("/" . $from . "/" . ($case_exact ? '' : 'i'), $to, $text); } else { if ($case_exact) { $newtext = str_replace($from, $to, $text); } else { //not all PHP have this enabled. use a workaround if (function_exists('str_ireplace')) { $newtext = str_ireplace($from, $to, $text); } else { // see eof $newtext = stri_replace($from, $to, $text); } } } if ($text != $newtext) { $meta = $current->_data; $meta['summary'] = sprintf(_("Replace '%s' by '%s'"), $from, $to); $meta['is_minor_edit'] = 0; $meta['author'] = $request->_user->UserName(); unset($meta['mtime']); // force new date return $page->save($newtext, $version + 1, $meta); } } return false; }
/** * My Handy Restaurant - Star printer driver * * http://www.myhandyrestaurant.org * * My Handy Restaurant is a restaurant complete management tool. * Visit {@link http://www.myhandyrestaurant.org} for more info. * Copyright (C) 2003-2005 Fabio De Pascale * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @author Fabio 'Kilyerd' De Pascale <*****@*****.**> * @package MyHandyRestaurant * @copyright Copyright 2003-2005, Fabio De Pascale */ function epson_fp90($msg) { /* $msg = stri_replace ("é", chr(176), $msg); $msg = stri_replace ("è", chr(177), $msg); $msg = stri_replace ("à", chr(207), $msg); $msg = stri_replace ("ù", chr(192), $msg); $msg = stri_replace ("ò", chr(187), $msg); $msg = stri_replace ("ì", chr(182), $msg); */ $msg = stri_replace('{dashes_row}', "-------------------------------", $msg); $msg = stri_replace('{height_double}', chr(29) . '!12', $msg); $msg = stri_replace('{/height_double}', '{size_normal}', $msg); $msg = stri_replace('{size_triple}', chr(29) . '!33', $msg); $msg = stri_replace('{/size_triple}', '{size_normal}', $msg); $msg = stri_replace('{size_double}', chr(29) . '!22', $msg); $msg = stri_replace('{/size_double}', '{size_normal}', $msg); $msg = stri_replace('{size_normal}', chr(29) . '!11', $msg); $msg = stri_replace('{align_left}', "\n" . chr(27) . 'a0', $msg); $msg = stri_replace('{align_center}', "\n" . chr(27) . 'a1', $msg); $msg = stri_replace('{align_right}', "\n" . chr(27) . 'a2', $msg); $msg = stri_replace('{highlight}', chr(29) . 'B1', $msg); $msg = stri_replace('{/highlight}', chr(29) . 'B0', $msg); $msg = stri_replace('{paper_release}', '{page_cut}', $msg); $msg = stri_replace('{page_cut}', "\n" . chr(29) . 'V0', $msg); $msg = stri_replace('{barcode_code39}', "\n" . chr(29) . "k4", $msg); $msg = stri_replace('{/barcode_code39}', "", $msg); return $msg; }
function replaceHelper(&$dbi, $pagename, $from, $to, $case_exact = true, $regex = false) { $page = $dbi->getPage($pagename); if ($page->exists()) { // don't replace default contents $current = $page->getCurrentRevision(); $version = $current->getVersion(); $text = $current->getPackedContent(); if ($regex) { $newtext = preg_replace("/" . $from . "/" . ($case_exact ? '' : 'i'), $to, $text); } else { if ($case_exact) { $newtext = str_replace($from, $to, $text); } else { //not all PHP have this enabled. use a workaround if (function_exists('str_ireplace')) { $newtext = str_ireplace($from, $to, $text); } else { // see eof $newtext = stri_replace($from, $to, $text); } } } if ($text != $newtext) { $meta = $current->_data; $meta['summary'] = sprintf(_("WikiAdminSearchReplace %s by %s"), $from, $to); return $page->save($newtext, $version + 1, $meta); } } return false; }
function driver_custom_sprints($msg) { $msg = stri_replace('{paper_release}', '{page_cut}', $msg); $msg = stri_replace('{size_triple}', '{size_double}', $msg); $msg = stri_replace('{/size_triple}', '{/size_double}', $msg); $msg = stri_replace('{init}', "\n", $msg); $msg = stri_replace('{height_double}', "\n" . chr(0x2), $msg); $msg = stri_replace('{/height_double}', "\n" . chr(0x4), $msg); $msg = stri_replace('{size_double}', "\n" . chr(0x3), $msg); $msg = stri_replace('{/size_double}', "\n" . chr(0x4), $msg); $msg = stri_replace('{page_cut}', "\n--CUT_PAGE--\n", $msg); $msg = stri_replace('{dashes_row}', "------------------------", $msg); $msg = stri_replace('{barcode_code39}', chr(0x1b) . "N" . chr(0x1b) . 'cC' . chr(0x50) . chr(0x3c) . chr(0x14) . chr(0x6) . "SPRINT", $msg); $msg = stri_replace('{/barcode_code39}', "\n", $msg); return $msg; }
function driver_epson_tmu295($msg) { $msg = stri_replace('{init}', chr(0x1b) . "@", $msg); $msg = stri_replace('{feed_reverse}', chr(0x1b) . 'F1', $msg); $msg = stri_replace('{feed_reverse2}', chr(0x1b) . "f" . chr(0) . chr(10), $msg); $msg = stri_replace('{no_paper_print_disabler}', chr(0x1b) . "c4" . chr(48), $msg); //$msg = stri_replace ('{unknown}',chr(0x1B)."D".chr(2).chr(4).chr(20).chr(0),$msg); $msg = stri_replace('{tab_define}', '', $msg); $msg = stri_replace('{dashes_row}', "-------------------------------", $msg); $msg = stri_replace('{paper_release}', "\n\n" . chr(0xc) . chr(27) . "q", $msg); $msg = stri_replace('{height_double}', chr(27) . 'h1', $msg); $msg = stri_replace('{/height_double}', chr(27) . 'h0', $msg); $msg = stri_replace('{align_center}', "\n" . chr(27) . chr(29) . 'a1', $msg); $msg = stri_replace('{align_left}', "\n" . chr(27) . chr(29) . 'a0', $msg); return $msg; }
<?php ini_set('display_errors', 1); define('EQDKP_WIKITOOLS', true); include_once 'keys.php'; $strInPassword = isset($_GET['key']) ? $_GET['key'] : false; $strPingMethod = "GET"; if ($strInPassword === $strPurgeKey) { $arrHeaders = getallheaders(); $strEvent = $arrHeaders['X-Github-Event']; echo "Event: " . $strEvent . "; "; $arrRepo = isset($_POST['repository']) ? $_POST['repository'] : false; if ($arrRepo) { $strRepo = strtolower($arrRepo['full_name']); $strRepo = stri_replace('EQdkpPlus/', '', $strRepo); echo "Found Repo " . $strRepo . '; '; } else { echo "No Repo found; "; } if ($strEvent === 'create' && $strRepo != "") { $strPingURL = false; switch ($strRepo) { case 'plugin-awards': $strPingURL = 'https://eqdkp-plus.eu/wiki/Plugin:_Awards?action=purge'; $strPingMethod = "POST"; break; } if ($strPingURL !== false) { if ($strPingMethod === "GET") { $result = get_fopen($strPingURL, "", 5, 15); } else {
function substitute_data_input_data($string, $graph, $local_data_id, $max_chars = 0) { if (empty($local_data_id)) { if (isset($graph['local_graph_id'])) { $local_data_ids = array_rekey(db_fetch_assoc("SELECT DISTINCT local_data_id\r\n\t\t\t\tFROM data_template_rrd\r\n\t\t\t\tINNER JOIN graph_templates_item\r\n\t\t\t\tON data_template_rrd.id=graph_templates_item.task_item_id\r\n\t\t\t\tWHERE local_graph_id=" . $graph["local_graph_id"]), "local_data_id", "local_data_id"); if (sizeof($local_data_ids)) { $data_template_data_id = db_fetch_cell("SELECT id FROM data_template_data WHERE local_data_id IN (" . implode(",", $local_data_ids) . ")"); } else { $data_template_data_id = 0; } } else { $data_template_data_id = 0; } } else { $data_template_data_id = db_fetch_cell("SELECT id FROM data_template_data WHERE local_data_id={$local_data_id}"); } if (!empty($data_template_data_id)) { $data = db_fetch_assoc("SELECT\r\n\t\t\tdif.data_name, did.value\r\n\t\t\tFROM data_input_fields AS dif\r\n\t\t\tINNER JOIN data_input_data AS did\r\n\t\t\tON dif.id=did.data_input_field_id\r\n\t\t\tWHERE data_template_data_id={$data_template_data_id}\r\n\t\t\tAND input_output='in'"); if (sizeof($data)) { foreach ($data as $item) { if ($item["value"] != "") { if ($max_chars > 0) { $item["value"] = substr($item["field_value"], 0, $max_chars); } $string = stri_replace("|input_" . $item["data_name"] . "|", $item["value"], $string); } } } } return $string; }
function parseEmoticons($shout) { $imgString = '<img src="' . $_SESSION['YPath'] . 'smileys/%s.gif" />'; $shout = str_replace( array('8)', '8-)', '8]'), sprintf($imgString, 'cool'), $shout); $shout = str_replace( array(':?', ':-?'), sprintf($imgString, 'confused'), $shout); $shout = str_replace( array(':|', ':-|'), sprintf($imgString, 'neutral'), $shout); $shout = str_replace( array(':(', ':-(', '=(', '=-(', ':[', ':-[', '=[', ':{', ':-{'), sprintf($imgString, 'sad'), $shout); $shout = str_replace( array(':)', ':-)', '=)', '=-)', ':]', ':-]', '=]', ':}', ':-}'), sprintf($imgString, 'smile'), $shout); $shout = str_replace( array(';)', ';-)', ';]', ';-]', ';}', ';-}'), sprintf($imgString, 'wink'), $shout); $shout = stri_replace( array(':D', ':-D', '=D') , sprintf($imgString, 'biggrin'), $shout); $shout = stri_replace( array(':p', ':-p', '=p', '=-p'), sprintf($imgString, 'razz'), $shout); $shout = stri_replace( array(':o', ':-o', '=o', '=-o', ':0', ':-0', '=0', '=-0'), sprintf($imgString, 'surprised'), $shout); $shout = stri_replace(':cry:', sprintf($imgString, 'cry'), $shout); $shout = stri_replace(':shock:', sprintf($imgString, 'eek'), $shout); $shout = stri_replace(':evil:', sprintf($imgString, 'evil'), $shout); $shout = stri_replace(':lol:', sprintf($imgString, 'lol'), $shout); $shout = stri_replace(':x', sprintf($imgString, 'mad'), $shout); $shout = stri_replace(':mrgreen:', sprintf($imgString, 'mrgreen'), $shout); $shout = stri_replace(':oops:', sprintf($imgString, 'redface'), $shout); $shout = stri_replace(':roll:', sprintf($imgString, 'rolleyes'), $shout); $shout = stri_replace(':twisted:', sprintf($imgString, 'twisted'), $shout); return $shout; }
function substitute_data_query_variables($string, $host_id, $data_query_id, $data_query_index, $max_chars = 0) { require_once(CACTI_BASE_PATH . "/lib/sys/string.php"); $data_query_cache = db_fetch_assoc("select field_name,field_value from host_data_query_cache where host_id = " . sql_sanitize($host_id) . " and data_query_id = " . sql_sanitize($data_query_id) . " and index_value = '" . sql_sanitize($data_query_index) . "'"); if (sizeof($data_query_cache) > 0) { foreach ($data_query_cache as $item) { if ($item["field_value"] != "") { if ($max_chars > 0) { $item["field_value"] = substr($item["field_value"], 0, $max_chars); } $string = stri_replace("|query_" . $item["field_name"] . "|", $item["field_value"], $string); } } } return $string; }
function get_tablename($t) { global $restore; $ersetzen = array('CREATE TABLE', 'IF NOT EXISTS'); $t = trim(stri_replace($t, $ersetzen)); $t = trim(str_replace('(', ' ', $t)); $w = explode(' ', $t); $tn = $w[0]; if (substr($tn, 0, 1) == '`') { $tn = substr($tn, 1, strlen($tn) - 2); } return $tn; }
/** substitute_snmp_query_data - takes a string and substitutes all data query variables contained in it @param string $string - the original string that contains the data query variables @param int $device_id - (int) the device ID to match @param int $snmp_query_id - (int) the data query ID to match @param int $snmp_index - the data query index to match @param int $max_chars - the maximum number of characters to substitute @return string - the original string with all of the variable substitutions made */ function substitute_snmp_query_data($string, $device_id, $snmp_query_id, $snmp_index, $max_chars = 0, $quote=true) { $snmp_cache_data = db_fetch_assoc("select field_name,field_value from device_snmp_cache where device_id=$device_id and snmp_query_id=$snmp_query_id and snmp_index='$snmp_index'"); if (sizeof($snmp_cache_data) > 0) { foreach ($snmp_cache_data as $data) { if ($data["field_value"] != "") { if ($max_chars > 0) { $data["field_value"] = substr($data["field_value"], 0, $max_chars); } $string = stri_replace("|query_" . $data["field_name"] . "|", cacti_escapeshellarg($data["field_value"], $quote), $string); } } } return $string; }
function substitute_snmp_query_data($string, $host_id, $snmp_query_id, $snmp_index, $max_chars = 0) { $snmp_cache_data = db_fetch_assoc("select field_name,field_value from host_snmp_cache where host_id=$host_id and snmp_query_id=$snmp_query_id and snmp_index='$snmp_index'"); if (sizeof($snmp_cache_data) > 0) { foreach ($snmp_cache_data as $data) { if ($data["field_value"] != "") { if ($max_chars > 0) { $data["field_value"] = substr($data["field_value"], 0, $max_chars); } $string = stri_replace("|query_" . $data["field_name"] . "|", $data["field_value"], $string); } } } return $string; }
function substitute_data_input_data($string, $graph, $local_data_id, $max_chars = 0) { if (empty($local_data_id)) { if (isset($graph['local_graph_id'])) { $local_data_ids = array_rekey(db_fetch_assoc_prepared('SELECT DISTINCT local_data_id FROM data_template_rrd INNER JOIN graph_templates_item ON data_template_rrd.id = graph_templates_item.task_item_id WHERE local_graph_id = ?', array($graph['local_graph_id'])), 'local_data_id', 'local_data_id'); if (sizeof($local_data_ids)) { $data_template_data_id = db_fetch_cell('SELECT id FROM data_template_data WHERE local_data_id IN (' . implode(',', $local_data_ids) . ')'); } else { $data_template_data_id = 0; } } else { $data_template_data_id = 0; } } else { $data_template_data_id = db_fetch_cell_prepared('SELECT id FROM data_template_data WHERE local_data_id = ?', array($local_data_id)); } if (!empty($data_template_data_id)) { $data = db_fetch_assoc_prepared("SELECT\n\t\t\tdif.data_name, did.value\n\t\t\tFROM data_input_fields AS dif\n\t\t\tINNER JOIN data_input_data AS did\n\t\t\tON dif.id = did.data_input_field_id\n\t\t\tWHERE data_template_data_id = ?\n\t\t\tAND input_output = 'in'", array($data_template_data_id)); if (sizeof($data)) { foreach ($data as $item) { if ($item['value'] != '') { if ($max_chars > 0) { $item['value'] = substr($item['field_value'], 0, $max_chars); } $string = stri_replace('|input_' . $item['data_name'] . '|', $item['value'], $string); } } } } return $string; }
function unlink_attach($filename, $mode = FALSE) { global $upload_dir, $attach_config, $lang; if (!intval($attach_config['allow_ftp_upload'])) { if ($mode == MODE_THUMBNAIL) { $filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $filename; } else { $filename = $upload_dir . '/' . $filename; } $deleted = @unlink($filename); if (@file_exists(@realpath($filename))) { $filesys = stri_replace('/', '\\', $filename); $deleted = @system("del {$filesys}"); if (@file_exists(@realpath($filename))) { $deleted = @chmod($filename, 0775); $deleted = @unlink($filename); $deleted = @system("del {$filesys}"); } } } else { $conn_id = attach_init_ftp($mode); if ($mode == MODE_THUMBNAIL) { $filename = 't_' . $filename; } $res = @ftp_delete($conn_id, $filename); if (!$res) { if (ATTACH_DEBUG) { $add = $mode == MODE_THUMBNAIL ? '/' . THUMB_DIR : ''; message_die(GENERAL_ERROR, sprintf($lang['Ftp_error_delete'], $attach_config['ftp_path'] . $add)); } return $deleted; } @ftp_quit($conn_id); $deleted = TRUE; } return $deleted; }
function print_line_win($value, $dest) { $debug = _FUNCTION_ . ' - Windows Printing to dest ' . $dest . ' - line ' . $value . ' ' . "\n"; debug_msg(__FILE__, __LINE__, $debug); $title = 'SmartRestaurant'; $handle = printer_open(stripslashes($dest)); if (!$handle) { return ERR_COULD_NOT_OPEN_PRINTER; } $debug = __FUNCTION__ . ' - Windows Printing to dest ' . $dest . ' - line ' . $value . ' ' . "\n"; debug_msg(__FILE__, __LINE__, $debug); printer_set_option($handle, PRINTER_MODE, "RAW"); $value = stri_replace("\n", "\n\r", $value); printer_start_doc($handle, $title); printer_start_page($handle); if (!printer_write($handle, $value)) { return ERR_PRINTING_ERROR; } printer_end_page($handle); printer_end_doc($handle); printer_close($handle); return 0; }