本文整理汇总了PHP中stripHTML函数的典型用法代码示例。如果您正苦于以下问题:PHP stripHTML函数的具体用法?PHP stripHTML怎么用?PHP stripHTML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stripHTML函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getVendors
function getVendors( )
{
global $db;
$query = "select * from Vendors";
if (!$result = $db->sql_query($query))
{
RestLog("Error 16522 in query: $query\n".$db->sql_error());
RestUtils::sendResponse(500, "16522 - There was a problem attempting to locate the PO"); //Internal Server Error
return false;
}
$i = 0;
while ( $row = $db->sql_fetchrow( $result ) )
{
$vendors[$i]['VendorID'] = $row['VendorID'];
$vendors[$i]['VendorName'] = $row['VendorName'];
$i++;
}
RestLog("Successful Request\n");
//08.10.2012 naj - return code 200 OK.
RestUtils::sendResponse(200,json_encode( stripHTML( $vendors ) ));
return true;
}
示例2: printMobileEntryListView
function printMobileEntryListView($entries, $listid, $title, $paging, $count = 0, $header = true)
{
$context = Model_Context::getInstance();
$itemsView = '<ul data-role="listview" class="posts" id="' . $listid . '" title="' . $title . '" selected="false" data-inset="true">' . CRLF;
if ($header) {
$itemsView .= '<li class="group ui-bar ui-bar-e">' . CRLF;
$itemsView .= ' <h3>' . $title . '</h3>' . CRLF;
$itemsView .= ' <span class="ui-li-count">' . $count . '</span>' . CRLF;
$itemsView .= ' <span class="ui-li-aside">' . _text('페이지') . ' ' . $paging['page'] . ' / ' . $paging['pages'] . '</span>' . CRLF;
$itemsView .= '</li>' . CRLF;
}
foreach ($entries as $item) {
$author = User::getName($item['userid']);
if ($imageName = printMobileAttachmentExtract($item['content'])) {
$imageSrc = printMobileImageResizer($context->getProperty('blog.id'), $imageName, 80);
} else {
$imageSrc = $context->getProperty('service.path') . '/resources/style/iphone/images/noPostThumb.png';
}
$itemsView .= '<li data-role="list-divider" role="heading" class="ui-li ui-li-divider ui-bar-b ui-btn-up-c" style="font-size:8pt;font-weight:normal">';
$itemsView .= ' ' . Timestamp::format5($item['published']) . '</li>' . CRLF;
$itemsView .= '<li class="post_item">' . CRLF;
$itemsView .= ' <a href="' . $context->getProperty('uri.blog') . '/entry/' . $item['id'] . '" class="link">' . CRLF;
$itemsView .= ' <img src="' . $imageSrc . '" />' . CRLF;
$itemsView .= ' <h3>' . fireEvent('ViewListTitle', htmlspecialchars($item['title'])) . '</h3>' . CRLF;
$itemsView .= ' <p class="ui-li-count"> ' . _textf('댓글 %1개', $item['comments'] > 0 ? $item['comments'] : 0) . '</p>' . CRLF;
if (!empty($item['content'])) {
$itemsView .= ' <p>' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($item['content'])), 150)) . '</p>' . CRLF;
}
$itemsView .= ' </a>' . CRLF;
$itemsView .= '</li>' . CRLF;
}
$itemsView .= '</ul>' . CRLF;
return $itemsView;
}
示例3: FM_TTML_summary
function FM_TTML_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true)
{
global $blog;
$view = FM_TTML_format($blogid, $id, $content, $keywords, $useAbsolutePath, true);
if (!$blog['publishWholeOnRSS']) {
$view = Utils_Unicode::lessen(removeAllTags(stripHTML($view)), 255);
}
return $view;
}
示例4: FM_Textile_summary
function FM_Textile_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true)
{
$context = Model_Context::getInstance();
$view = FM_Textile_format($blogid, $id, $content, $keywords, $useAbsolutePath, true);
if (!$context->getProperty("blog.publishWholeOnRSS")) {
$view = Utils_Unicode::lessen(removeAllTags(stripHTML($view)), 255);
}
return $view;
}
示例5: getItemInfo
function getItemInfo($vars, $responsetype)
{
global $db;
$ar = $vars;
if (empty($ar) || !isset($ar['VendorID']) || !isset($ar['ItemNumber'])) {
RestLog("16584 - Insufficient data provided for creating order \n" . print_r($vars, true) . "\n");
RestUtils::sendResponse(400, "16584 - Insufficient data provided");
//Internal Server Error
return false;
}
//now we grab inventory records for the requested item and build up our package to return
//to the dealer
//08.28.2015 ghh - added weight field
$query = "select Items.ItemID, Items.MSRP, NLA, CloseOut,\n\t\t\t\tPriceCode, Cost, MAP, Category, \n\t\t\t\tManufItemNumber, ManufName, SupersessionID, Weight\n\t\t\t\tfrom Items\n\t\t\t\twhere \n\t\t\t\tItemNumber='{$ar['ItemNumber']}' and\n\t\t\t\tVendorID={$ar['VendorID']}";
if (!($result = $db->sql_query($query))) {
RestLog("Error 16585 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16585 - There was a problem getting item information.");
//Internal Server Error
return false;
}
$row = $db->sql_fetchrow($result);
$item['OrigManufName'] = $row['ManufName'];
$item['OrigManufNumber'] = $row['ManufItemNumber'];
$item['NLA'] = $row['NLA'];
$item['CloseOut'] = $row['CloseOut'];
$item['MSRP'] = $row['MSRP'];
$item['Category'] = $row['Category'];
$item['MAP'] = $row['MAP'];
$item['Weight'] = $row['Weight'];
//08.28.2015 ghh -
if ($row['ItemID'] > 0) {
$item['Cost'] = getItemCost($row['ItemID'], $ar['DealerID'], $row['PriceCode'], $row['Cost'], $row['MSRP']);
}
//08.25.2015 ghh - if BSV asked for full detail then we're also going to send back
//images data and other items of interest
if ($row['SupersessionID'] > 0) {
$query = "select ItemNumber from Items where ItemID={$row['SupersessionID']}";
if (!($tmpresult = $db->sql_query($query))) {
RestLog("Error 16586 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16586 - There was a problem retrieving the supersession number");
//Internal Server Error
return false;
}
$tmprow = $db->sql_fetchrow($tmpresult);
$item['SupersessionNumber'] = $tmprow['ItemNumber'];
}
RestLog("Successful Request\n");
//08.10.2012 naj - return code 200 OK.
RestUtils::sendResponse(200, json_encode(stripHTML($item)));
return true;
}
示例6: filterStr
/**
* 函数名称:filterStr
* 功能描述:对字符串、数组等进行过滤
* @param $arr
* @return array|null|string
*/
function filterStr($arr)
{
if (!isset($arr)) {
return null;
}
if (is_array($arr)) {
foreach ($arr as $k => $v) {
$arr[$k] = filter(stripSQLChars(stripHTML(trim($v), true)));
}
} else {
$arr = filter(stripSQLChars(stripHTML(trim($arr), true)));
}
return $arr;
}
示例7: SyndicateToEolin
/**
* @brief Syndicating routine.
* @see Tag, User, DBModel, Model_Context
*/
function SyndicateToEolin($entryId, $entry, $mode)
{
$context = Model_Context::getInstance();
$blogid = $context->getProperty('blog.id');
$rpc = new XMLRPC();
$rpc->url = 'http://ping.eolin.com/';
$summary = array('blogURL' => $context->getProperty('uri.default'), 'syncURL' => $context->getProperty('uri.default') . "/plugin/abstractToEolin?entryId={$entryId}");
if ($mode == 'create') {
$summary['blogTitle'] = $context->getProperty('blog.title');
$summary['language'] = $context->getProperty('blog.language');
$summary['permalink'] = $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']);
$summary['title'] = Utils_Unicode::lessenAsByte($entry['title'], 255);
$summary['content'] = Utils_Unicode::lessenAsByte(stripHTML(getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'])), 1023, '');
$summary['author'] = User::authorName($entry['userid'], $entryId);
$summary['tags'] = Tag::getTagsWithEntryId($blogid, $entry);
$summary['location'] = $entry['location'];
$summary['written'] = Timestamp::getRFC1123($entry['published']);
}
return $rpc->call("sync.{$mode}", $summary);
}
示例8: updateComment
function updateComment($blogid, $comment, $password)
{
$openid = Acl::getIdentity('openid');
if (!doesHaveOwnership()) {
// if filtered, only block and not send to trash
if (!Filter::isAllowed($comment['homepage'])) {
if (Filter::isFiltered('ip', $comment['ip'])) {
return 'blocked';
}
if (Filter::isFiltered('name', $comment['name'])) {
return 'blocked';
}
if (Filter::isFiltered('url', $comment['homepage'])) {
return 'blocked';
}
if (Filter::isFiltered('content', $comment['comment'])) {
return 'blocked';
}
if (!fireEvent('ModifyingComment', true, $comment)) {
return 'blocked';
}
}
}
$pool = DBModel::getInstance();
$comment['homepage'] = stripHTML($comment['homepage']);
$comment['name'] = Utils_Unicode::lessenAsEncoding($comment['name'], 80);
$comment['homepage'] = Utils_Unicode::lessenAsEncoding($comment['homepage'], 80);
$comment['comment'] = Utils_Unicode::lessenAsEncoding($comment['comment'], 65535);
$guestcomment = false;
$pool->reset('Comments');
$pool->setQualifier('blogid', 'eq', $blogid);
$pool->setQualifier('id', 'eq', $comment['id']);
$pool->setQualifier('replier', 'eq', NULL);
if ($pool->doesExist()) {
$guestcomment = true;
}
$pool->reset('Comments');
$setPassword = '';
$userid = getUserId();
if (!empty($userid)) {
$comment['replier'] = $userid;
$name = User::getName($userid);
$homepage = User::getHomepage($userid);
$pool->setAttribute('password', '', true);
if (empty($homepage) && $openid) {
$homepage = $openid;
}
} else {
$name = $comment['name'];
if ($comment['password'] !== true) {
$pool->setAttribute('password', empty($comment['password']) ? '' : md5($comment['password']), true);
}
$homepage = $comment['homepage'];
}
$comment0 = $comment['comment'];
$wherePassword = '';
if (!doesHaveOwnership()) {
if ($guestcomment == false) {
if (!doesHaveMembership()) {
return false;
}
$pool->setQualifier('replier', 'eq', $userid);
} else {
if (empty($password) && $openid) {
$pool->setQualifier('openid', 'eq', $openid, true);
} else {
$pool->setQualifier('password', 'eq', md5($password), true);
}
}
}
$replier = is_null($comment['replier']) ? NULL : $comment['replier'];
$pool->setAttribute('name', $name, true);
$pool->setAttribute('homepage', $homepage, true);
$pool->setAttribute('secret', $comment['secret']);
$pool->setAttribute('comment', $comment0, true);
$pool->setAttribute('ip', $comment['ip'], true);
$pool->setAttribute('written', Timestamp::getUNIXtime());
$pool->setAttribute('isfiltered', $comment['isfiltered']);
$pool->setAttribute('replier', $replier);
$pool->setQualifier('blogid', 'eq', $blogid);
$pool->setQualifier('id', 'eq', $comment['id']);
$result = $pool->update();
if ($result) {
CacheControl::flushCommentRSS($comment['entry']);
// Assume blogid = current blogid.
CacheControl::flushDBCache('comment');
return true;
} else {
return false;
}
}
示例9: sendTrackback
function sendTrackback($blogid, $entryId, $url)
{
importlib('model.blog.entry');
importlib('model.blog.keyword');
$context = Model_Context::getInstance();
$entry = getEntry($blogid, $entryId);
if (is_null($entry)) {
return false;
}
$link = $context->getProperty('uri.default') . "/" . $entryId;
$title = htmlspecialchars($entry['title']);
$entry['content'] = getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
$excerpt = str_tag_on(Utils_Unicode::lessen(removeAllTags(stripHTML($entry['content'])), 255));
$blogTitle = $context->getProperty('blog.title');
$isNeedConvert = strpos($url, '/rserver.php?') !== false || strpos($url, 'blog.naver.com/tb') !== false || strpos($url, 'news.naver.com/tb/') !== false || strpos($url, 'blog.empas.com') !== false || strpos($url, 'blog.yahoo.com') !== false || strpos($url, 'www.blogin.com/tb/') !== false || strpos($url, 'cytb.cyworld.nate.com') !== false || strpos($url, 'www.cine21.com/Movies/tb.php') !== false;
if ($isNeedConvert) {
$title = Utils_Unicode::convert($title, 'EUC-KR');
$excerpt = Utils_Unicode::convert($excerpt, 'EUC-KR');
$blogTitle = Utils_Unicode::convert($blogTitle, 'EUC-KR');
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=euc-kr';
$isSuccess = $request->send($content);
} else {
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=utf-8';
$isSuccess = $request->send($content);
}
if ($isSuccess && checkResponseXML($request->responseText) === 0) {
$trackbacklog = new TrackbackLog();
$trackbacklog->entry = $entryId;
$trackbacklog->url = Utils_Unicode::lessenAsEncoding($url, 255);
$trackbacklog->add();
return true;
}
return false;
}
示例10: truncate
function truncate($content, $size = 50, $final = "…", $stripHTML = false, $preserveEOL = false)
{
$hasn = false;
if ($stripHTML) {
$content = str_replace("\"", "'", stripHTML(str_replace("\n", "", $content), $preserveEOL));
if ($preserveEOL) {
$content = str_replace("<br/>", "\n", $content);
$hasn = strpos($content, "\n") !== false;
}
}
// avoids amp codes being cut
$len = strlen($content);
$amp = strpos($content, '&', $size - 5 >= 0 && $size - 5 < $len ? $size - 5 : 0);
if ($amp > 0 && $amp <= $size) {
$ampf = strpos($content, ';', $amp);
if ($ampf >= $size) {
return ($preserveEOL ? str_replace("\n", "<br/>", substr($content, 0, $amp - 1)) : substr($content, 0, $amp - 1)) . ($hasn ? "\n" : "") . $final;
}
}
if ($len > $size) {
if ($len <= $size - strlen($final)) {
// barelly on the limit
return ($preserveEOL ? str_replace("\n", "<br/>", $content) : $content) . $final;
} else {
// under the limit, cut utf8 to avoid issues
return ($preserveEOL ? str_replace("\n", "<br/>", utf8_truncate($content, $size - strlen($final))) : utf8_truncate($content, $size - strlen($final))) . $final . " ";
}
} else {
// not greater
return ($preserveEOL ? str_replace("\n", "<br/>", $content) : $content) . "";
}
}
示例11: sendTrackback
function sendTrackback($blogid, $entryId, $url)
{
global $defaultURL, $blog;
requireModel('blog.entry');
requireModel('blog.keyword');
$entry = getEntry($blogid, $entryId);
if (is_null($entry)) {
return false;
}
$link = "{$defaultURL}/{$entryId}";
$title = htmlspecialchars($entry['title']);
$entry['content'] = getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
$excerpt = str_tag_on(UTF8::lessen(removeAllTags(stripHTML($entry['content'])), 255));
$blogTitle = $blog['title'];
$isNeedConvert = strpos($url, '/rserver.php?') !== false || strpos($url, 'blog.naver.com/tb') !== false || strpos($url, 'news.naver.com/tb/') !== false || strpos($url, 'blog.empas.com') !== false || strpos($url, 'blog.yahoo.com') !== false || strpos($url, 'www.blogin.com/tb/') !== false || strpos($url, 'cytb.cyworld.nate.com') !== false || strpos($url, 'www.cine21.com/Movies/tb.php') !== false;
if ($isNeedConvert) {
$title = UTF8::convert($title, 'EUC-KR');
$excerpt = UTF8::convert($excerpt, 'EUC-KR');
$blogTitle = UTF8::convert($blogTitle, 'EUC-KR');
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=euc-kr';
$isSuccess = $request->send($content);
} else {
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=utf-8';
$isSuccess = $request->send($content);
}
if ($isSuccess && checkResponseXML($request->responseText) === 0) {
// $url = POD::escapeString(UTF8::lessenAsEncoding($url, 255));
$trackbacklog = new TrackbackLog();
$trackbacklog->entry = $entryId;
$trackbacklog->url = POD::escapeString(UTF8::lessenAsEncoding($url, 255));
$trackbacklog->add();
// POD::query("INSERT INTO {$database['prefix']}TrackbackLogs VALUES ($blogid, '', $entryId, '$url', UNIX_TIMESTAMP())");
return true;
}
return false;
}
示例12: getRemoteFeed
function getRemoteFeed($url)
{
global $service, $serviceURL;
$xml = fireEvent('GetRemoteFeed', null, $url);
if (empty($xml)) {
$request = new HTTPRequest($url);
$request->referer = $serviceURL;
$request->timeout = 3;
if (!$request->send()) {
return array(2, null, null);
}
$xml = $request->responseText;
}
$feed = array('xmlurl' => isset($request) ? $request->url : $url);
$xmls = new XMLStruct();
if (!$xmls->open($xml, $service['encoding'])) {
if (preg_match_all('/<link .*?rel\\s*=\\s*[\'"]?alternate.*?>/i', $xml, $matches)) {
foreach ($matches[0] as $link) {
$attributes = Utils_Misc::getAttributesFromString($link);
if (isset($attributes['href'])) {
$urlInfo = parse_url($url);
$rssInfo = parse_url($attributes['href']);
$rssURL = false;
if (isset($rssInfo['scheme']) && $rssInfo['scheme'] == 'http') {
$rssURL = $attributes['href'];
} else {
if (isset($rssInfo['path'])) {
if ($rssInfo['path'][0] == '/') {
$rssURL = "{$urlInfo['scheme']}://{$urlInfo['host']}{$rssInfo['path']}";
} else {
$rssURL = "{$urlInfo['scheme']}://{$urlInfo['host']}" . (isset($urlInfo['path']) ? rtrim($urlInfo['path'], '/') : '') . '/' . $rssInfo['path'];
}
}
}
if ($rssURL && $url != $rssURL) {
return getRemoteFeed($rssURL);
}
}
}
}
return array(3, null, null);
}
if ($xmls->getAttribute('/rss', 'version')) {
$feed['blogURL'] = $xmls->getValue('/rss/channel/link');
$feed['title'] = $xmls->getValue('/rss/channel/title');
$feed['description'] = $xmls->getValue('/rss/channel/description');
if (Validator::language($xmls->getValue('/rss/channel/language'))) {
$feed['language'] = $xmls->getValue('/rss/channel/language');
} else {
if (Validator::language($xmls->getValue('/rss/channel/dc:language'))) {
$feed['language'] = $xmls->getValue('/rss/channel/dc:language');
} else {
$feed['language'] = 'en-US';
}
}
$feed['modified'] = gmmktime();
} else {
if ($xmls->doesExist('/feed')) {
$feed['blogURL'] = $xmls->getAttribute('/feed/link', 'href');
$feed['title'] = $xmls->getValue('/feed/title');
$feed['description'] = $xmls->getValue('/feed/tagline');
if (Validator::language($xmls->getAttribute('/feed', 'xml:lang'))) {
$feed['language'] = $xmls->getAttribute('/feed', 'xml:lang');
} else {
$feed['language'] = 'en-US';
}
$feed['modified'] = gmmktime();
} else {
if ($xmls->getAttribute('/rdf:RDF', 'xmlns')) {
if ($xmls->getAttribute('/rdf:RDF/channel/link', 'href')) {
$feed['blogURL'] = $xmls->getAttribute('/rdf:RDF/channel/link', 'href');
} else {
if ($xmls->getValue('/rdf:RDF/channel/link')) {
$feed['blogURL'] = $xmls->getValue('/rdf:RDF/channel/link');
} else {
$feed['blogURL'] = '';
}
}
$feed['title'] = $xmls->getValue('/rdf:RDF/channel/title');
$feed['description'] = $xmls->getValue('/rdf:RDF/channel/description');
if (Validator::language($xmls->getValue('/rdf:RDF/channel/dc:language'))) {
$feed['language'] = $xmls->getValue('/rdf:RDF/channel/dc:language');
} else {
if (Validator::language($xmls->getAttribute('/rdf:RDF', 'xml:lang'))) {
$feed['language'] = $xmls->getAttribute('/rdf:RDF', 'xml:lang');
} else {
$feed['language'] = 'en-US';
}
}
$feed['modified'] = gmmktime();
} else {
return array(3, null, null);
}
}
}
$feed['xmlurl'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['xmlurl'])));
$feed['blogURL'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['blogURL'])));
$feed['title'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['title'])));
$feed['description'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct(stripHTML($feed['description']))));
$feed['language'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['language']), 255));
//.........这里部分代码省略.........
示例13: sendOrder
//.........这里部分代码省略.........
$unitrow = $db->sql_fetchrow($unitresult);
if ($db->sql_numrows($unitresult) == 0) {
RestLog("Error 16561 The Unit Model you sent is not valid");
RestUtils::sendResponse(500, "16561 - The Model Number or VendorID passed are invalid");
return false;
}
//now lets see if we can calculate the cost for the current dealer
$cost = getUnitCost($unitrow['ModelID'], $vars['DealerID'], $unitrow['Cost']);
} else {
RestLog("Error 16563 {$row['PONumber']} is missing a vendor id\n");
RestUtils::sendResponse(409, "Error 16563 {$key['ModelNumber']} is missing a vendor id");
return false;
}
//08.25.2015 ghh - if we have less line items on the PO than the qty we need then
//we're going to insert a few more rows until they match.
if ($db->sql_numrows($result) < $key['Qty']) {
for ($i = 0; $i < $key['Qty'] - $db->sql_numrows($result); $i++) {
$query = "insert into PurchaseOrderUnits (POID,ModelNumber,\n\t\t\t\t\t ModelID,OrderCode,Year, Colors, VendorID, Cost) values \n\t\t\t\t\t ( '{$poid}','{$key['ModelNumber']}',{$unitrow['ModelID']},'{$unitrow['OrderCode']}',\n\t\t\t\t\t {$year},'{$key['Colors']}', {$key['VendorID']}, '{$cost}')";
if (!($tmpresult = $db->sql_query($query))) {
RestLog("Error 16564 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16564 - There was an error trying to add the unit to the order");
return false;
}
}
//08.25.2015 ghh - update the PO with the current time for last modified date
$query = "update PurchaseOrders set DateLastModified=now() where POID = {$poid}";
if (!($result = $db->sql_query($query))) {
RestLog("Error 16565 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16565 - There was a problem updating the last modified date");
//Internal Server Error
return false;
}
} else {
if ($db->sql_numrows($result) > $key['Qty']) {
$qtytoremove = $db->sql_numrows($result) - $key['Qty'];
$query = "select POUnitID from PurchaseOrderUnits where POID={$poid}\n\t\t\t\t\t\tand ModelID={$unitrow['ModelID']} limit {$qtytoremove}";
if (!($tmpresult = $db->sql_query($query))) {
RestLog("Error 16566 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16566 - There was a problem deleting changed models");
//Internal Server Error
return false;
}
while ($tmprow = $db->sql_fetchrow($tmpresult)) {
$query = "delete from PurchaseOrderUnits where POUnitID={$tmprow['POUnitID']}";
if (!($tmp2result = $db->sql_query($query))) {
RestLog("Error 16567 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16567 - There was a problem deleting changed models");
//Internal Server Error
return false;
}
}
//08.25.2015 ghh - update the PO with the current time for last modified date
$query = "update PurchaseOrders set DateLastModified=now() where POID = {$poid}";
if (!($result = $db->sql_query($query))) {
RestLog("Error 16568 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16568 - There was a problem updating the last modified date");
//Internal Server Error
return false;
}
}
}
//08.25.2015 ghh - first lets grab total qty for the current model
$query = "select sum(Qty) as Qty from UnitModelStock where ModelID={$unitrow['ModelID']}";
if (!($qtyresult = $db->sql_query($query))) {
RestLog("Error 16570 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16570 - There was an error getting total instock");
return false;
}
$tmprow = $db->sql_fetchrow($qtyresult);
$stockqty = $tmprow['Qty'];
$query = "select count(POUnitID) as Qty from PurchaseOrderUnits \n\t\t\t\twhere ModelID={$unitrow['ModelID']} and SerialVin is null";
if (!($qtyresult = $db->sql_query($query))) {
RestLog("Error 16571 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16571 - There was an error getting total instock");
return false;
}
$tmprow = $db->sql_fetchrow($qtyresult);
$orderqty = $tmprow['Qty'];
//08.21.2015 ghh - now we have all of our return information and have updated or
//inserted into the items list for the purchase order so we only need to build our
//response now.
$units[$i]['VendorID'] = $key['VendorID'];
$units[$i]['ModelNumber'] = $key['ModelNumber'];
$units[$i]['NLA'] = $unitrow['NLA'];
$units[$i]['Closeout'] = $unitrow['CloseOut'];
$units[$i]['MSRP'] = $unitrow['MSRP'];
$units[$i]['Cost'] = $cost;
if ($stockqty - $onorderqty < 0) {
$units[$i]['BackorderQty'] = abs($stockqty - $onorderqty);
} else {
$units[$i]['BackorderQty'] = 0;
}
$i++;
}
$rst['Units'] = $units;
RestLog("Successful Request\n");
//08.10.2012 naj - return code 200 OK.
RestUtils::sendResponse(200, json_encode(stripHTML($rst)));
return true;
}
示例14: FM_default_summary
function FM_default_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = false)
{
if (!$blog['publishWholeOnRSS']) {
$content = Utils_Unicode::lessen(removeAllTags(stripHTML($content)), 255);
}
return $content;
}
示例15: getInventory
function getInventory($vars, $responsetype)
{
global $db;
$ar = $vars;
if (empty($ar) || !isset($ar['VendorID']) || !isset($ar['ItemNumber'])) {
RestLog("16575 - Insufficient data provided for creating order \n" . print_r($vars, true) . "\n");
RestUtils::sendResponse(400, "16575 - Insufficient data provided");
//Internal Server Error
return false;
}
//now we grab inventory records for the requested item and build up our package to return
//to the dealer
//08.26.2015 rch - Moving ItemStock,Warehouses,DaysToFullfill to left outer joins
//to account for not stocking an item or not putting in warehouse
//08.28.2015 ghh - added Weight
$query = "select Items.ItemID, Items.MSRP, NLA, CloseOut,\n\t\t\t\tPriceCode, Cost, MAP, Category, WarehouseName, \n\t\t\t\tWarehouseState, Qty, DaysToArrive, Weight\n\t\t\t\tManufItemNumber, ManufName, SupersessionID\n\t\t\t\tfrom Items\n\t\t\t\tleft outer join ItemStock on ItemStock.ItemID = Items.ItemID \n\t\t\t\tleft outer join Warehouses on Warehouses.WarehouseID = ItemStock.WarehouseID\n\t\t\t\tleft outer join DaysToFullfill on DaysToFullfill.WarehouseID = ItemStock.WarehouseID\n\t\t\t\twhere Items.ItemNumber='{$ar['ItemNumber']}' and\n\t\t\t\tItems.VendorID={$ar['VendorID']} and\n\t\t\t\tDaysToFullfill.DealerID={$ar['DealerID']} order by DaysToArrive";
if (!($result = $db->sql_query($query))) {
RestLog("Error 16576 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16576 - There was a problem getting inventory information.");
//Internal Server Error
return false;
}
$i = 0;
$itemid = 0;
while ($row = $db->sql_fetchrow($result)) {
//grabbing our details on first run through as no sense in grabbing
//more than once.
if ($itemid == 0) {
$itemid = $row['ItemID'];
$OrigManufName = $row['ManufName'];
$OrigManufNumber = $row['ManufItemNumber'];
$NLA = $row['NLA'];
$CloseOut = $row['CloseOut'];
$MSRP = $row['MSRP'];
$Category = $row['Category'];
$MAP = $row['MAP'];
$Weight = $row['Weight'];
//08.28.2015 ghh -
}
$rst[$i]['WarehouseName'] = $row['WarehouseName'];
$rst[$i]['WarehouseState'] = $row['WarehouseState'];
$rst[$i]['Qty'] = $row['Qty'];
$rst[$i]['DaysToArrive'] = $row['DaysToArrive'];
$i++;
}
if ($itemid > 0) {
$item['Warehouses'] = $rst;
$item['MSRP'] = $MSRP;
if ($itemid > 0) {
$item['Cost'] = getItemCost($itemid, $ar['DealerID'], $row['PriceCode'], $row['Cost'], $row['MSRP']);
}
//08.25.2015 ghh - if BSV asked for full detail then we're also going to send back
//images data and other items of interest
if ($row['SupersessionID'] > 0) {
$query = "select ItemNumber from Items where ItemID={$row['SupersessionID']}";
if (!($tmpresult = $db->sql_query($query))) {
RestLog("Error 16578 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16578 - There was a problem retrieving the supersession number");
//Internal Server Error
return false;
}
$tmprow = $db->sql_fetchrow($tmpresult);
$item['SupersessionNumber'] = $tmprow['ItemNumber'];
}
$item['OrigManufName'] = $ManufName;
$item['OrigManufNumber'] = $ManufItemNumber;
$item['NLA'] = $NLA;
$item['Category'] = $Category;
$item['MAP'] = $MAP;
//08.25.2015 ghh - now we're getting a list of images that may exist for this
//item
$query = "select * from ItemImages where ItemID={$itemid}";
if (!($result = $db->sql_query($query))) {
RestLog("Error 16577 in query: {$query}\n" . $db->sql_error());
RestUtils::sendResponse(500, "16577 - There was a problem retrieving a list of images");
//Internal Server Error
return false;
}
$i = 0;
while ($row = $db->sql_fetchrow($result)) {
$img[$i]['ImageURL'] = $row['ImageURL'];
$img[$i]['ImageSize'] = $row['ImageSize'];
$i++;
}
$item['Images'] = $img;
} else {
RestLog("Error 16635 The item number being requested doesn't exist\n");
RestUtils::sendResponse(500, "16635 - The Item you requested was not found.");
//Internal Server Error
return false;
}
RestLog("Successful Request\n");
//08.10.2012 naj - return code 200 OK.
RestUtils::sendResponse(200, json_encode(stripHTML($item)));
return true;
}