} elseif ($condition_flag == 2) { $condition_result = $category_result; } $condition_string = array_to_str($condition_result, 'category_id'); //将category中的限定结果在lz_item表中查找,得到item_id结果,返回最终的限定结果 if ($condition_string != null) { $condition_result = $db->get_all("SELECT item_id FROM lz_item WHERE category_id in (" . $condition_string . ") "); $condition = array_to_str($condition_result, 'item_id'); } //sort($condition); } //搜索作者 if ($author != null) { //在双字作者中间加上两个空格,方便与数据库中内容匹配 if (strlen($author) == 6) { $author = str_insert($author, 3, " "); } //如果之前限定了搜索范围 if ($condition != null) { $author_result = $db->get_all("SELECT aid FROM lz_author WHERE (author like '%" . $author . "%') and aid in(" . $condition . ") "); } else { $author_result = $db->get_all("SELECT aid FROM lz_author WHERE author like '%" . $author . "%'"); } $result = my_array_add($result, $author_result, 'aid'); } if ($institution != null) { if ($condition != null) { $institution_result = $db->get_all("SELECT aid FROM lz_author WHERE institution like '%" . $institution . "%' and (aid in(" . $condition . ") )"); } else { $institution_result = $db->get_all("SELECT aid FROM lz_author WHERE institution like '%" . $institution . "%' "); }
protected function update_dumbroot_xml_file($xml_data) { if (($pos = strpos($xml_data, '<?xml')) !== false) { $pos = strpos($xml_data, '>', $pos); if ($pos !== false) { return str_insert("<Root>", $xml_data, $pos + 1) . "</Root>"; } } return $xml_data; }
<?php ob_start(); define('INCLUDES', '/includes'); define('ABSPATH', realpath(dirname(__FILE__) . '/../')); require ABSPATH . INCLUDES . '/basic-load.php'; if (!$BLOCK) { require ABSPATH . '/' . ADMIN . INCLUDES . '/admin-load.php'; require ABSPATH . INCLUDES . '/basic-doit.php'; } else { redirect(BASE_URL); } $out = ob_get_clean(); echo str_insert('output-messages">', get_output_result_messages(), $out);
$pageToBeDeployed = str_replace("#hotel-code-upper#", strtoupper($datarow[CSV_HOTEL_CODE_INDEX]), $pageToBeDeployed); $pageToBeDeployed = str_replace("#meta-keywords#", $datarow[CSV_HOTEL_NAME_INDEX] . ", " . $datarow[CSV_HOTEL_NAME_INDEX] . " " . $datarow[CSV_COUNTRY_INDEX] . ", " . $datarow[CSV_HOTEL_NAME_INDEX] . " " . $datarow[CSV_COUNTRY_INDEX] . " hotel, " . $datarow[CSV_HOTEL_NAME_INDEX] . " resort, " . $datarow[CSV_HOTEL_NAME_INDEX] . " hotel, " . $datarow[CSV_COUNTRY_INDEX] . " " . $datarow[CSV_HOTEL_NAME_INDEX] . ", " . $datarow[CSV_HOTEL_NAME_INDEX] . " all inclusive", $pageToBeDeployed); // Change to include the description from hotel info instead of generic line. TODO, go back and replace this whole page // to use the OO technique. //$pageToBeDeployed = str_replace("#meta-description#", PRETTY_SITE_NAME." provides All-inclusive vacations to ".$datarow[CSV_HOTEL_NAME_INDEX]." in ".$datarow[CSV_COUNTRY_INDEX].". Great prices, personal service, and can price match (then beat) any other offer.", $pageToBeDeployed); $hotelObject = get_hotel_info($countryCode, $hotelCode, false); $pageToBeDeployed = str_replace("#meta-description#", $hotelObject->hotelShortDescription, $pageToBeDeployed); $pageToBeDeployed = str_replace("#agency-code#", AGENCY_CODE, $pageToBeDeployed); $pageToBeDeployed = str_replace("#pretty-site-name#", PRETTY_SITE_NAME, $pageToBeDeployed); // Trim the content area of the TI page $theContent = substr($theContent, strpos($theContent, '<div id="main">')); $theContent = convert_relative_paths(substr($theContent, 0, strpos($theContent, '<div id="footer_ext">')), TI_DOCROOT_URL); $tripAdvisor = '<div class="hotel_review"><iframe src=http://www.tripadvisor.com/WidgetEmbed-cdspropertysummary?display=true&partnerId=CEBBFA18F4BB11DDBF8ADA0256D89593&lang=en&locationId=' . strtoupper($countryCode) . strtoupper($hotelCode) . ' width="240" height="320" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>'; $tripAdvisorPosition = strpos($theContent, '<div class="hotel_vtour">'); $tripAdvisorPosition = strpos($theContent, '</div>', $tripAdvisorPosition) + 6; $theContent = str_insert($tripAdvisor, $theContent, $tripAdvisorPosition); $pageToBeDeployed = str_replace("#content#", $theContent, $pageToBeDeployed); // Detail pages already have their destination filtered $pageToBeDeployed = str_replace("#dest-region#", "", $pageToBeDeployed); // Add the remote path where the installation is located $pageToBeDeployed = str_replace("#remote-install-path#", REMOTE_INSTALL_PATH, $pageToBeDeployed); //Adding pricing display $priceDisplayHTML = "<div id='price-display'>\n\t\t\t\t\t\t\t<div class='left'>\n\t\t\t\t\t\t\t\t3 Nights\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='right'>\n\t\t\t\t\t\t\t\t7 Nights\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t<div class='left price'>\n\t\t\t\t\t\t\t\t#three-day-price-output#\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='right price'>\n\t\t\t\t\t\t\t\t#seven-day-price-output#\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='style01 clearFix'>\n\t\t\t\t\t\t\t\tSample prices per person double cccupancy and departure of #trip-start#.\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>"; $tripStart = date("m/d/y", mktime(0, 0, 0, date("m"), date("d") + 43, date("y"))); $sevenDayPrice = get_hotel_price($datarow[CSV_COUNTRY_CODE_INDEX], $datarow[CSV_HOTEL_CODE_INDEX], 7, $datarow[CSV_DISCOUNT_INDEX], false); $totalTripWithAirPrice = ""; $threeDayPrice = ""; if (!empty($sevenDayPrice)) { try { $totalTripWithAirPrice = get_air_price_build(DEFAULT_AIR_GATEWAY, $datarow[CSV_COUNTRY_CODE_INDEX], 7, AIR_DISCOUNT, false); if (!empty($totalTripWithAirPrice)) {
public function get_block_content_html() { $data = array(); $str = ''; $block_id = intval($this->input['block_id']); // $line_num = intval($this->input['line_num']); $pic_width = urldecode($this->input['pic_width']); $pic_height = urldecode($this->input['pic_height']); $title_num = urldecode($this->input['title_num']); $brief_num = urldecode($this->input['brief_num']); if (!$block_id) { $result = array('error' => '未传区块'); $this->addItem($result); $this->output(); } //取区块信息 $block_data = $this->obj->get_block_first($block_id); //取区块每行内容 $content_data = $this->block_set->get_block_content($block_id, $block_data['line_num']); //取区块每行信息 $line_data = $this->block_set->get_block_line($block_id); //父标签 $str = "<" . $block_data['father_tag'] . " style='"; if ($block_data['width']) { $str .= "width:" . $block_data['width'] . "px;"; } if ($block_data['height']) { $str .= "height:" . $block_data['height'] . "px;"; } $str .= "'>"; //每行 foreach ($line_data as $k => $v) { if (!empty($content_data[$k])) { foreach ($content_data[$k] as $kk => $vv) { $title = $title_num ? hg_cutchars($vv['title'], $title_num, '') : $vv['title']; $brief = $brief_num ? hg_cutchars($vv['brief'], $brief_num, '') : $vv['brief']; $outlink = $vv['outlink']; if (!empty($vv['indexpic'])) { $pic_data = unserialize($vv['indexpic']); $indexpic = $pic_data['host'] . $pic_data['dir']; if ($pic_width && !$pic_height) { $indexpic .= $pic_width . "x" . "0/"; } else { if ($pic_width && $pic_height) { $indexpic .= $pic_width . "x" . $pic_height . "/"; } } $indexpic .= $pic_data['filepath'] . $pic_data['filename']; } $loop_body = $v['loop_body'] ? $v['loop_body'] : $block_data['loop_body']; // print_r($loop_body);exit; eval("\$li_data = \"{$loop_body}\";"); //生成样式 $style = " style='"; if ($v['width']) { $style .= "width:" . $v['width'] . "px;"; } if ($v['height']) { $style .= "height:" . $v['height'] . "px;"; } $style .= "'"; if (!($insert_i = stripos($v['loop_body'], '>'))) { $result = array('error' => '未找到区块样式的标识'); $this->addItem($result); $this->output(); } //插入样式 $str .= str_insert($li_data, $insert_i, $style); } } } $str .= "</" . $block_data['father_tag'] . ">"; $this->addItem($str); $this->output(); }