public function import_item($stream, $id) { switch ($id) { case 0x0: // mailbox passwords $mailbox = trim(Utf8ToWin($stream->read_str())); $user = trim(Utf8ToWin($stream->read_str())); $pass = trim(Utf8ToWin($stream->read_str())); if (strlen($user) && strlen($pass) && strlen($mailbox)) { $this->mailboxes[$mailbox] = array($user, $pass); } break; case 0x1: // server settings file $js_conf_file = $stream->read_str(); $this->process_conf($js_conf_file); break; default: $this->log->add("ERR_UNKNOWN_ITEM_TYPE"); return false; } return true; }
function unicode_to_ansi($string) { if (!strlen($string)) { return ''; } // check for unicode length validness if (strlen($string) % 2 != 0) { return ''; } else { return Utf8ToWin(unicode_to_utf8($string)); } // alternative //return mb_convert_encoding($string, "cp1251", "UTF-16LE"); }
$byte2 = false; for ($c = 0; $c < strlen($fcontents); $c++) { $i = ord($fcontents[$c]); if ($i <= 127) { $out .= $fcontents[$c]; } if ($byte2) { $new_c2 = ($c1 & 3) * 64 + ($i & 63); $new_c1 = $c1 >> 2 & 5; $new_i = $new_c1 * 256 + $new_c2; if ($new_i == 1025) { $out_i = 168; } else { if ($new_i == 1105) { $out_i = 184; } else { $out_i = $new_i - 848; } } $out .= chr($out_i); $byte2 = false; } if ($i >> 5 == 6) { $c1 = $i; $byte2 = true; } } return $out; } echo Utf8ToWin($out_txt); //echo $out_txt;
flock($fp, LOCK_EX); fputs($fp, "{$text}\r\n"); fflush($fp); flock($fp, LOCK_UN); fclose($fp); print "<br><br><br><center><font size=2 face=tahoma><b>Сообщение отправленно!</b></font></center><meta HTTP-EQUIV='Refresh' CONTENT='1; URL=comments.php?event=message'>"; exit; } print "<form action=\"/comments.php?event=message&action=write&function=submit\" method=post><table cellpadding=2 align=center>\n<tr><td align=right><font size=2 face=tahoma>Ваше имя:</font> <input type=text maxlength=25 name=from class='inputname' style='width:420' title='Не более 25 символов'></td></tr>\n<tr><td align=right><font size=2 face=tahoma>Заголовок:</font> <input type=hidden name=who value='{$go}'><input type=text maxlength=120 name=theme class='inputname' style='width:420' title='от 3 до 120 символов'></td></tr>\n<tr><td><textarea name=msg cols=90 rows=10 class='com' style='width:500px;height:150px' title='от 3 до 2000 символов'></textarea></td></tr>\n<tr><td align=center><input type=reset value='Очистить' class='inputbutton' style='width:90px'> <input type=submit value='Отправить' class='inputbutton' style='width:90px'></td></tr></table></form>"; } exit; } } if (isset($_REQUEST['add'])) { $name = Utf8ToWin(substr(replacer(strip_tags($_REQUEST['name'])), 0, $maxname)); $comment = Utf8ToWin(str_replace("\n", '<br>', substr(replacer($_REQUEST['comment']), 0, $maxmes))); $name = wordwrap($name, $namewrap, ' ', 1); $comment = wordwrap($comment, $comwrap, ' ', 1); $timezone = floor($timezone); if ($timezone < -12 || $timezone > 12) { $timezone = 0; } $date = gmdate('d.m.Y', time() + 3600 * ($timezone + (date('I') == 1 ? 0 : 1))); $time = gmdate('H:i', time() + 3600 * ($timezone + (date('I') == 1 ? 0 : 1))); //$datetime=date('d.m.Y H:i'); //if ($liteurl==1) {$comment=preg_replace("#([^\[img\]])(http|https|ftp|goper):\/\/([a-zA-Z0-9\.\?&=\;\-\/_]+)([\W\s<\[]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>\\4", $comment);} if ($liteurl == 1) { $comment = autolink($comment); } if ($antimat == 1) { $name = removeBadWords($name);
function nzshpcrt_getproductform($prodid) { global $wpdb, $nzshpcrt_imagesize_info, $current_user; /* * makes the product form * has functions inside a function */ //$sql = "SELECT * FROM `wp_product_list` WHERE `id`=$prodid LIMIT 1"; $sql = "SELECT wp_product_list.*, wp_product_files.width, wp_product_files.height, wp_product_files.mimetype FROM wp_product_list, wp_product_files WHERE wp_product_files.id=wp_product_list.file AND wp_product_list.id={$prodid} LIMIT 1"; $product_data = $wpdb->get_results($sql, ARRAY_A); $product = $product_data[0]; /* * for security reason add to url for hires images sid - last 6 simbols of idhash * */ $sql = "SELECT `idhash` FROM `wp_product_files` WHERE `id`=" . $product['file']; $idhash_data = $wpdb->get_results($sql, ARRAY_A); if ($idhash_data != null) { $idhash = "&sid=" . substr($idhash_data[0]['idhash'], -6); } $output = "<table>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Автор: "; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= brandslist($product['brand']); $approved = 0; //pokazh($product,"product: "); //pokazh($current_user); if ($product['approved'] == '1') { $approved = " checked='checked'"; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утверждено."; } else { if (isset($current_user->wp_capabilities['editor']) && $current_user->wp_capabilities['editor'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утвержено."; } } $output .= "<div style='color:#669900'>Картинка находится в <b>хранилище банка</b></div>"; } elseif ($product['approved'] == '0') { $approved = ""; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утверждено."; } $output .= "<div style='color:#9900CC'>Картинка может находиться в <b>Рабочем столе</b></div>"; } else { $approved = ""; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утверждено."; } $output .= "<div style='color:#FF6600'>Картинка находится в <b>прихожей банка</b> в ожидании приёма</div>"; } $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Название рисунка: "; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<input id='productnameedit' type='text' style='width:300px;' name='title' value='" . stripslashes($product['name']) . "' /> # <a href='" . SITEURL . "/?page_id=29&cartoonid=" . $product['id'] . "' target=_blank>" . $product['id'] . "</a>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Краткое описание: "; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<textarea id='productdescredit' name='description' cols='50' rows='4' >" . stripslashes($product['description']) . "</textarea>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Ключевые слова,<br />разделённые запятыми:<br>"; $output .= "<a href='" . SITEURL . "/ales/wordassociations/words.php?id=" . $product['id'] . "' target=_blank>добавить<br>ассоциаций</a>"; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<textarea id='tagsedit' name='additional_description' cols='50' rows='4' >" . stripslashes($product['additional_description']) . "</textarea>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $visible = ""; if ($product['visible'] == '1') { $visible = " checked='checked'"; } $output .= "<tr>\n\r"; $output .= "</tr>\n\r"; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Видно всем:"; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<input type='checkbox' name='visible'" . $visible . "/> <span style='color:#999;'>Если выключить — не будет видно покупателям</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; } $colored = ""; if ($product['color'] == '1') { $colored = " checked='checked' "; } $temadnya = ""; $istemadnya_sql = "SELECT * FROM `wp_item_category_associations` where `category_id` = '777' and `product_id` = " . $product['id']; //pokazh ($istemadnya_sql); $istemadnya = $wpdb->get_results($istemadnya_sql); if ($istemadnya != null) { $temadnya = " checked='checked' "; } //pokazh($istemadnya,"istemadnya: "); $not_for_sale = ""; if ($product['not_for_sale'] == '1') { $not_for_sale = " checked='checked' "; } $license1checked = ""; if ($product['l1_price'] != '0') { $license1checked = " checked='checked' "; } $license2checked = ""; if ($product['l2_price'] != '0') { $license2checked = " checked='checked' "; } $license3checked = ""; if ($product['l3_price'] != '0') { $license3checked = " checked='checked' "; } $output .= "<tr>\n\r"; $output .= "<td class='ralt'>"; $output .= "Цветной рисунок:"; $output .= "</td>\n\r"; $output .= "<td style='background-color:#FFFF33;'>"; $output .= "<input type='checkbox' name='colored'" . $colored . "/> <span style='color:#999;'>Отключите для ч/б рисунков</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Не для продажи:"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= "<input type='checkbox' name='not_for_sale'" . $not_for_sale . "/> <span style='color:#999;'>Не продаётся, если включено</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td>"; $basepath = str_replace("/wp-admin", "", getcwd()); if (file_exists($basepath . "/wp-content/plugins/wp-shopping-cart/product_images/" . $product['image'])) { $image_location = "product_images/" . $product['image']; } else { $image_location = "images/" . $product['image']; } $preview_location = "product_images/" . $product['image']; $icon_location = "images/" . $product['image']; $m_image_link = SITEURL . "/wp-content/plugins/wp-shopping-cart/" . $preview_location; $output .= "<a href='" . $m_image_link . "' target=_blank><img id='previewimage' src='" . SITEURL . "/wp-content/plugins/wp-shopping-cart/{$icon_location}' alt='" . TXT_WPSC_PREVIEW . "' title='" . TXT_WPSC_PREVIEW . "' /></a>"; $output .= "Ш х В: " . $product['width'] . "x" . $product['height'] . "<br>" . $product['mimetype']; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= categorylist($product['id']); /* if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator']==1) { $output .= categorylist($product['id']); } else { $output .= "После утверждения рисунка модераторами Категория может быть изменена администратором"; $output .= "<div style='display:none;'>".categorylist($product['id'])."</div>"; } */ $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='ralt'>"; $output .= "Тема дня::"; $output .= "</td>\n\r"; $output .= "<td class='lalt'>"; $output .= "<input type='checkbox' name='temadnya'" . $temadnya . "/> <span style='color:#999;'>считаю актуальной темой</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; //if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator']==1){ $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Доступны лицензии:"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= " Огр: <input id='license1' type='checkbox' name='license1'" . $license1checked . "> Станд: <input id='license2' type='checkbox' name='license2'" . $license2checked . "> Расш: <input id='license3' type='checkbox' name='license3'" . $license3checked . "><br />"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; //} $output .= "<tr>\n\r"; $output .= "<td colspan='2'>"; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<a href='admin.php?page=wp-shopping-cart/display-items.php&deleteid=" . $product['id'] . "' onclick='return conf();'><img src='../img/trash.gif' title='удалить'></a>"; } $output .= "<a href='admin.php?page=wp-shopping-cart/display-items.php&updateimage=" . $product['id'] . "' ><img src='" . SITEURL . "/img/reload.gif' title='Обновить иконку и слайд с водяными знаками'></a>"; $output .= " <a href='index.php?admin_preview=true&product_id=" . $product['id'] . $idhash . "' style='float: left;' ><img src='http://th.cartoonbank.ru/download.gif' title='Скачать оригинальный файл' /></a>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; // download original image if ($product['file'] > 0) { if (is_numeric($product['file']) && $product['file'] > 0) { $file_data = $wpdb->get_results("SELECT * FROM `wp_product_files` WHERE `id`='" . $product['file'] . "' LIMIT 1", ARRAY_A); if ($file_data != null && $file_data[0]['mimetype'] == 'audio/mpeg' && function_exists('listen_button')) { $output .= " " . listen_button($file_data[0]['idhash']); } } $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Заменить файл:"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= "<input type='file' name='file' value='' /> <div style='color:#999;'>Это тот файл, ссылка на который<br />будет отправлена заказчику</div>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; } $output .= "<tr>\n\r"; $output .= "<td>\n\r"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= "<input type='hidden' name='prodid' value='" . $product['id'] . "' />"; $output .= "<input type='hidden' name='submit_action' value='edit' />"; $output .= "<br /><input type=\"button\" class='edit_button' style='padding:6px; background-color:#84DF88;' name='sendit' value='Сохранить изменения' onclick=\"checkthefieldsEditForm();\"/>"; if ($product['approved'] != '1' && isset($current_user->wp_capabilities['editor']) && $current_user->wp_capabilities['editor'] == 1) { $output .= "<br /><br /><br /><br /><a class='button' href='admin.php?page=wp-shopping-cart/display-items.php&deleteid=" . $product['id'] . "' onclick=\"return conf();\" ><img src='" . SITEURL . "/img/trash.gif'> стереть изображение!</a>"; } if ($product['approved'] == '1' && isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<br /><br /><br /><br /><a class='button' href='admin.php?page=wp-shopping-cart/display-items.php&deleteid=" . $product['id'] . "' onclick=\"return conf();\" ><img src='" . SITEURL . "/img/trash.gif'> стереть изображение</a>"; } $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "</table>\n\r"; // TODO: Remove before upload to the server! temp! local debug only! if ($_SERVER['SERVER_NAME'] == 'localhost') { $output = Utf8ToWin($output); } return $output; }
function processText($text) { $text = str_replace('&', '&', $text); $text = str_replace('<', '<', $text); $text = str_replace('>', '>', $text); $SOAPBody = '<?xml version="1.0" encoding="' . $this->_encoding . '"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ProcessText xmlns="http://typograf.artlebedev.ru/webservices/"> <text>' . $text . '</text> <entityType>' . $this->_entityType . '</entityType> <useBr>' . $this->_useBr . '</useBr> <useP>' . $this->_useP . '</useP> <maxNobr>' . $this->_maxNobr . '</maxNobr> </ProcessText> </soap:Body> </soap:Envelope>'; $host = 'typograf.artlebedev.ru'; $SOAPRequest = 'POST /webservices/typograf.asmx HTTP/1.1 Host: typograf.artlebedev.ru Content-Type: text/xml Content-Length: ' . strlen($SOAPBody) . ' SOAPAction: "http://typograf.artlebedev.ru/webservices/ProcessText" ' . $SOAPBody; function Utf8ToWin($fcontents) { $out = $c1 = ''; $byte2 = false; for ($c = 0; $c < strlen($fcontents); $c++) { $i = ord($fcontents[$c]); if ($i <= 127) { $out .= $fcontents[$c]; } if ($byte2) { $new_c2 = ($c1 & 3) * 64 + ($i & 63); $new_c1 = $c1 >> 2 & 5; $new_i = $new_c1 * 256 + $new_c2; if ($new_i == 1025) { $out_i = 168; } else { if ($new_i == 1105) { $out_i = 184; } else { $out_i = $new_i - 848; } } $out .= chr($out_i); $byte2 = false; } if ($i >> 5 == 6) { $c1 = $i; $byte2 = true; } } return $out; } $remoteTypograf = fsockopen($host, 80); fwrite($remoteTypograf, $SOAPRequest); $typografResponse = ''; while (!feof($remoteTypograf)) { $typografResponse .= fread($remoteTypograf, 8192); } fclose($remoteTypograf); $startsAt = strpos($typografResponse, '<ProcessTextResult>') + 19; $endsAt = strpos($typografResponse, '</ProcessTextResult>'); $typografResponse = substr($typografResponse, $startsAt, $endsAt - $startsAt - 1); $typografResponse = Utf8ToWin($typografResponse); $typografResponse = str_replace('&', '&', $typografResponse); $typografResponse = str_replace('<', '<', $typografResponse); $typografResponse = str_replace('>', '>', $typografResponse); return $typografResponse; }
} else { if ($_POST['format'] == 'xls') { header('Content-type: application/vnd.ms-excel'); header(sprintf('Content-disposition: attachment; filename="%s_%s_%s.xls"', $_POST['type'], $t['tourTitle'], $t['tourStartDate'])); $out = $smarty->fetch("tourinfo_list_SHABLON_XLS.html"); echo $out; } else { if ($_POST['format'] == 'xml') { header('Content-type: application/xml'); header(sprintf('Content-disposition: attachment; filename="%s\\_%s\\_%s.xml"', $_POST['type'], $t['tourTitle'], $t['tourStartDate'])); $out = $smarty->fetch("tourinfo_list_SHABLON_XLS.html"); echo $out; } else { if ($_POST['format'] == 'txt') { header('Content-type: text/plain;charset=CP1251'); header(sprintf('Content-disposition: attachment; filename="%s\\_%s\\_%s.txt"', $_POST['type'], $t['tourTitle'], $t['tourStartDate'])); $out = $smarty->fetch("tourinfo_list_SHABLON_TXT.html"); $out = Utf8ToWin($out); echo $out; } else { $smarty->display("tourinfo_list_SHABLON.html"); } } } } } } else { $smarty->display("tourinfo.html"); } } }
<td><img src="/comments.php?secpic" id="secpic_img" onclick="document.getElementById('secpic_img').src = '/comments.php?secpic&' + Math.random(); return false" /><br /><small>Для смены картинки щелкните на ней</small></td> <td><input type="text" name="secpic" id="secpic" style="width:200" maxlength="6" /><br /><small>Введите символы с картинки</small></td> </tr> <tr> <td> </td> <td><input type="submit" /></td> </tr> </table> </form> EOD; echo $form; exit; } if (isset($_REQUEST['add'])) { $name = Utf8ToWin(strip_tags($_REQUEST['name'])); $comment = Utf8ToWin(str_replace("\n", '<br />', substr(strip_tags($_REQUEST['comment']), 0, 500))); $datetime = date('Y.m.d H:i'); $page_id = str_replace(array('\\', '//'), '', strip_tags($_REQUEST['page_id'])); if (strtolower($_REQUEST['secpic']) != $_SESSION['secpic']) { if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) { header("Content-type: application/xhtml+xml;charset=windows-1251"); } else { header("Content-type: text/xml;charset=windows-1251"); } $et = '>'; echo "<?xml version='1.0' encoding='windows-1251'?{$et}\n"; echo "\n <answer>\n <result>error</result>\n <error>Не верно введен защитный код!</error>\n </answer>\n "; exit; } if (isset($_COOKIE['postdate'])) { if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
// kill the carriage returns and tabs in the descriptions, they're killing me! if (EP_PRESERVE_TABS_CR_LF == false || $dltype == 'froogle') { $thetext = str_replace("\r", ' ', $thetext); $thetext = str_replace("\n", ' ', $thetext); $thetext = str_replace("\t", ' ', $thetext); } if (EP_EXCEL_SAFE_OUTPUT == true && $dltype != 'froogle') { // use quoted values and escape the embedded quotes for excel safe output. $therow .= '"' . str_replace('"', '""', $thetext) . '"' . $ep_separator; } else { // and put the text into the output separated by $ep_separator defined above $therow .= $thetext . $ep_separator; } } if ($_GET['export_charset'] == 'cp1251') { $therow = Utf8ToWin($therow); } // lop off the trailing separator, then append the end of row indicator $therow = substr($therow, 0, strlen($therow) - 1) . $endofrow; if ($_GET['download'] == 'activestream') { echo $therow; } else { $filestring .= $therow; } // grab the next row from the db $row = vam_db_fetch_array($result); } // now either stream it to them or put it in the temp directory if ($_GET['download'] == 'activestream') { die; } elseif ($_GET['download'] == 'stream') {