public static function getLine($params) { $default = array('row' => 10, 'limit' => 0, 'type' => 'top', 'flag' => 'new'); $params = array_merge($default, $params); extract($params); //获取最新线路 if ($flag == 'new') { $sql = "select a.* from sline_line a order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'byorder') { $sql = "select a.* from sline_line a left join sline_allorderlist b on (a.id=b.aid and b.typeid=1) where ishidden=0 order by ifnull(b.displayorder,9999) asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } } $list = DB::query(1, $sql)->execute()->as_array(); foreach ($list as $key => $value) { $list[$key]['title'] = $list[$key]['title']; $list[$key]['url'] = $GLOBALS['cfg_cmspath'] . 'lines/show/id/' . $list[$key]['id']; $list[$key]['litpic'] = !empty($list[$key]['litpic']) ? $list[$key]['litpic'] : Common::getDefaultImage(); $list[$key]['satisfyscore'] = !empty($list[$key]['satisfyscore']) ? $list[$key]['satisfyscore'] : mt_rand(92, 96) . '%'; $list[$key]['lineprice'] = Model_Line::getMinPrice($list[$key]['id']); } return $list; }
if (isset($_POST['category'])) { $conditions['category'] = $_POST['category']; } if (isset($_POST['keyword'])) { $conditions['keyword'] = $_POST['keyword']; } $conditions['linesforpage'] = $_POST['lines']; $d = _t('삭제'); $conditions['template'] = <<<EOS \t\t\t<dl id="line_[##_id_##]" class="line"> \t\t\t\t<dt class="date">[##_date_##]</dt> \t\t\t\t<dd class="content">[##_content_##]</dd> \t\t\t\t<dd class="permalink"><a href="[##_permalink_##]" class="permalink">at [##_root_##]</a></dd> \t\t\t\t<dd class="delete input-button" onclick="deleteLine('[##_id_##]');return false;"><span class="text">{$d}</span></dd> \t\t\t</dl> EOS; $conditions['dress'] = array('id' => 'id', 'date' => 'created', 'content' => 'content', 'permalink' => 'permalink', 'root' => 'root'); $line = Model_Line::getInstance(); $contentView = $line->getFormattedList($conditions); if (empty($contentView)) { $contentView = ' <dl class="end"> <dt class="date"></dt> <dd class="content">' . _t('더이상 라인이 없습니다') . '</dd></dl>'; $buttonView = ''; } else { $m = _t('더 보기'); $buttonView = '<input type="submit" class="more-button input-button" value="' . _t('더 보기') . '" onclick="getMoreContent(' . ($conditions['page'] + 1) . ',' . $conditions['linesforpage'] . ',\'bottom\');return false;" />'; } $result = array('error' => 0, 'contentView' => $contentView, 'buttonView' => $buttonView); Respond::PrintResult($result);
foreach ($transport_arr as $user) { if (!in_array($user, $sysjiaotong) && !empty($user)) { $jiaotong .= "<span class=\"fl zdy\"><input checked='checked' class=\"fl mt-8\" type=\"checkbox\" name=\"transport[" . $v['day'] . "][]\" value=\"" . $user . "\"/></span> <label class=\"fl ml-5 mr-20\" style=\"cursor:pointer;\">" . $user . "</label>"; } } $jiaotong .= " <span id=\"addjt_" . $v['day'] . "\"></span><img class='addimg' data-contain='addjt_" . $v['day'] . "' data-day='" . $v['day'] . "' style=\"line-height: 30px;vertical-align: middle;cursor: pointer\" src=\"" . $GLOBALS['cfg_public_url'] . "images/tianjia.png\">"; $breakfirst_check = $v['breakfirsthas'] == 1 ? 'checked="checked"' : ''; $lunch_check = $v['lunchhas'] == 1 ? 'checked="checked"' : ''; $supper_check = $v['supperhas'] == 1 ? 'checked="checked"' : ''; $transport_arr = explode(',', $v['transport']); $car_check = in_array(2, $transport_arr) ? 'checked="checked"' : ''; $train_check = in_array(3, $transport_arr) ? 'checked="checked"' : ''; $plane_check = in_array(1, $transport_arr) ? 'checked="checked"' : ''; $ship_check = in_array(4, $transport_arr) ? 'checked="checked"' : ''; $food_style = $info['showrepast'] == 0 ? "display:none" : ''; $dayspot = Model_Line::getDaySpotHtml($v['day'], $v['lineid']); $jieshao = '<div class="add-class">'; $jieshao .= '<dl><dt>第' . $v['day'] . '天:</dt>'; $jieshao .= '<dd>'; $jieshao .= '<input type="text" name="jieshaotitle[' . $v['day'] . ']" value="' . $v['title'] . '" class="set-text-xh text_700 mt-2"/></dd>'; $jieshao .= '</dl>'; $jieshao .= '<dl class="jieshao-diner" style="' . $food_style . '">'; $jieshao .= '<dt>用餐情况:</dt>'; $jieshao .= '<dd>'; $jieshao .= '<span class="fl"><input class="mt-8 mr-3 fl" type="checkbox" name="breakfirsthas[' . $v['day'] . ']" ' . $breakfirst_check . ' value="1"></span>'; $jieshao .= '<label style=" float:left; cursor: pointer;">早餐</label>'; $jieshao .= '<span><input class="set-text-xh text_177 ml-5 mr-10" type="text" name="breakfirst[' . $v['day'] . ']" value="' . $v['breakfirst'] . '"/></span>'; $jieshao .= '<span class="fl"><input class="mt-8 mr-3 fl" type="checkbox" name="lunchhas[' . $v['day'] . ']" ' . $lunch_check . ' value="1"></span>'; $jieshao .= '<label style=" float:left; cursor: pointer;">午餐</label>'; $jieshao .= '<span><input class="set-text-xh text_177 ml-5 mr-10" type="text" name="lunch[' . $v['day'] . ']" value="' . $v['lunch'] . '"/></span>'; $jieshao .= '<span class="fl"><input class="mt-8 mr-3 fl" type="checkbox" name="supperhas[' . $v['day'] . ']" ' . $supper_check . ' value="1"></span>';
function getLinesFeed($blogid, $category = 'public', $mode = 'atom') { global $blog; $channel = array(); $channel = initializeRSSchannel($blogid); $lineobj = Model_Line::getInstance(); $lineobj->reset(); $lineobj->setFilter(array('created', 'bigger', Timestamp::getUNIXTime() - 86400)); $lineobj->setFilter(array('blogid', 'equals', $blogid)); $lineobj->setFilter(array('category', 'equals', $category, true)); $lines = $lineobj->get(); $channel['items'] = getFeedItemByLines($lines); $channel['title'] = RSSMessage($blog['title'] . ': ' . _text('Lines')); $rss = array('channel' => $channel); if ($mode == 'rss') { return publishRSS($blogid, $rss); } else { if ($mode == 'atom') { return publishATOM($blogid, $rss); } } return false; }
public function action_city() { $kindid = $this->params['id']; //当前目地的信息 $row = ORM::factory('destinations')->where("id={$kindid}")->find()->as_array(); $tempic = trim($row['piclist'], ','); if (empty($tempic)) { $row['pic_arr'] = array(); } else { $temarr = explode(",", trim($row['piclist'], ',')); foreach ($temarr as $key => $value) { $row['pic_arr'][$key] = explode("||", $value); } } //数据统计(攻略,线路,酒店,租车,门票,相册,团购) $Tjarr = array(); $Tjarr['lines'] = ORM::factory('line')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['article'] = ORM::factory('article')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['hotel'] = ORM::factory('hotel')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['car'] = ORM::factory('car')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['spot'] = ORM::factory('spot')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['photo'] = ORM::factory('photo')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['tuan'] = ORM::factory('tuan')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); //推荐数据调用 //文章(有图片的跟没有图片的) $articlelist1 = ORM::factory('article')->where("litpic is not NULL and litpic<>'' and find_in_set(" . $kindid . ",kindlist) and ishidden=1")->order_by("modtime", 'desc')->limit(4)->get_all(); $articlelist2 = ORM::factory('article')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=1")->order_by("modtime", 'desc')->limit(3)->get_all(); //去掉html标记 if (!empty($articlelist2)) { foreach ($articlelist2 as $key => $value) { $articlelist2[$key]['content'] = Common::cutstr_html($value['content'], 30); } } //推荐线路,租车,酒店,门票,景区 $lineslist = ORM::factory('line')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'desc')->limit(4)->get_all(); $carlist = ORM::factory('car')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'desc')->limit(4)->get_all(); $hotellist = ORM::factory('hotel')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'asc')->limit(4)->get_all(); $spotlist = ORM::factory('spot')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'asc')->limit(4)->get_all(); $photolist = ORM::factory('photo')->where("litpic is not NULL and litpic<>'' and find_in_set(" . $kindid . ",kindlist) and ishidden=1")->order_by("modtime", 'asc')->limit(4)->get_all(); //做一个初始标记,前台好设为选定状态(线路1,租车2,酒店3,门票4) $sts = 4; if (!empty($spotlist)) { $sts = 4; } if (!empty($hotellist)) { $sts = 3; } if (!empty($carlist)) { $sts = 2; } if (!empty($lineslist)) { $sts = 1; foreach ($lineslist as $key => $line) { $lineslist[$key]['lineprice'] = Model_Line::getMinPrice($line['id']); } } $row['title'] = !empty($row['seotitle']) ? $row['seotitle'] : $row['kindname']; //数据压入 $this->assign('row', $row); $this->assign('tj', $Tjarr); $this->assign('sts', $sts); $this->assign('articlarr1', $articlelist1); $this->assign('articlarr2', $articlelist2); $this->assign('lineslist', $lineslist); $this->assign('carlist', $carlist); $this->assign('hotellist', $hotellist); $this->assign('spotlist', $spotlist); $this->assign('photolist', $photolist); $this->display('mdd/mdd'); }
function importer($path, $node, $line) { global $blogid, $migrational, $items, $item; switch ($path) { case '/blog/setting': setProgress($item++ / $items * 100, _t('블로그 설정을 복원하고 있습니다.')); $setting = new BlogSetting(); if (isset($node['title'][0]['.value'])) { $setting->title = $node['title'][0]['.value']; } if (isset($node['description'][0]['.value'])) { $setting->description = $node['description'][0]['.value']; } if (isset($node['banner'][0]['name'][0]['.value'])) { $setting->banner = $node['banner'][0]['name'][0]['.value']; } if (isset($node['useSloganOnPost'][0]['.value'])) { $setting->useSloganOnPost = $node['useSloganOnPost'][0]['.value']; } if (isset($node['postsOnPage'][0]['.value'])) { $setting->postsOnPage = $node['postsOnPage'][0]['.value']; } if (isset($node['postsOnList'][0]['.value'])) { $setting->postsOnList = $node['postsOnList'][0]['.value']; } if (isset($node['postsOnFeed'][0]['.value'])) { $setting->postsOnFeed = $node['postsOnFeed'][0]['.value']; } if (isset($node['publishWholeOnFeed'][0]['.value'])) { $setting->publishWholeOnFeed = $node['publishWholeOnFeed'][0]['.value']; } if (isset($node['acceptGuestComment'][0]['.value'])) { $setting->acceptGuestComment = $node['acceptGuestComment'][0]['.value']; } if (isset($node['acceptcommentOnGuestComment'][0]['.value'])) { $setting->acceptcommentOnGuestComment = $node['acceptcommentOnGuestComment'][0]['.value']; } if (isset($node['language'][0]['.value'])) { $setting->language = $node['language'][0]['.value']; } if (isset($node['timezone'][0]['.value'])) { $setting->timezone = $node['timezone'][0]['.value']; } if (!$setting->save()) { user_error(__LINE__ . $setting->error); } if (!empty($setting->banner) && !empty($node['banner'][0]['content'][0]['.stream'])) { Attachment::confirmFolder(); Utils_Base64Stream::decode($node['banner'][0]['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $setting->banner)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $setting->banner)); fclose($node['banner'][0]['content'][0]['.stream']); unset($node['banner'][0]['content'][0]['.stream']); } return true; case '/blog/category': setProgress($item++ / $items * 100, _t('분류를 복원하고 있습니다.')); $category = new Category(); $category->name = $node['name'][0]['.value']; $category->priority = $node['priority'][0]['.value']; if (isset($node['root'][0]['.value'])) { $category->id = 0; } if (!$category->add()) { user_error(__LINE__ . $category->error); } if (isset($node['category'])) { for ($i = 0; $i < count($node['category']); $i++) { $childCategory = new Category(); $childCategory->parent = $category->id; $cursor =& $node['category'][$i]; $childCategory->name = $cursor['name'][0]['.value']; $childCategory->priority = $cursor['priority'][0]['.value']; if (!$childCategory->add()) { user_error(__LINE__ . $childCategory->error); } } } return true; case '/blog/post': setProgress($item++ / $items * 100, _t('글을 복원하고 있습니다.')); $post = new Post(); $post->id = $node['id'][0]['.value']; $post->slogan = @$node['.attributes']['slogan']; $post->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $post->starred = $node['starred'][0]['.value']; } else { $post->starred = 0; } $post->title = $node['title'][0]['.value']; $post->content = $node['content'][0]['.value']; $post->contentformatter = isset($node['content'][0]['.attributes']['formatter']) ? $node['content'][0]['.attributes']['formatter'] : 'ttml'; $post->contenteditor = isset($node['content'][0]['.attributes']['editor']) ? $node['content'][0]['.attributes']['editor'] : 'modern'; $post->location = $node['location'][0]['.value']; $post->password = isset($node['password'][0]['.value']) ? $node['password'][0]['.value'] : null; $post->acceptcomment = $node['acceptComment'][0]['.value']; $post->accepttrackback = $node['acceptTrackback'][0]['.value']; $post->published = $node['published'][0]['.value']; if (isset($node['longitude'][0]['.value'])) { $post->longitude = $node['longitude'][0]['.value']; } if (isset($node['latitude'][0]['.value'])) { $post->latitude = $node['latitude'][0]['.value']; } $post->created = @$node['created'][0]['.value']; $post->modified = @$node['modified'][0]['.value']; if ($post->visibility == 'private' && intval($post->published) > $_SERVER['REQUEST_TIME'] || !empty($node['appointed'][0]['.value']) && $node['appointed'][0]['.value'] == 'true') { // for compatibility of appointed entries $post->visibility = 'appointed'; } if ($post->slogan == '') { $post->slogan = 'Untitled' . $post->id; } if (!empty($node['category'][0]['.value'])) { $post->category = Category::getId($node['category'][0]['.value']); } if (isset($node['tag'])) { $post->tags = array(); for ($i = 0; $i < count($node['tag']); $i++) { if (!empty($node['tag'][$i]['.value'])) { array_push($post->tags, $node['tag'][$i]['.value']); } } } if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $post->content = nl2brWithHTML($post->content); } if (!$post->add()) { user_error(__LINE__ . $post->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $post->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } else { if ($cursor['name'][0]['.value'] != $attachment->name) { $post2 = new Post(); if ($post2->open($post->id, 'id, content')) { $post2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $post2->content); $post2->loadTags(); $post2->update(); $post2->close(); } unset($post2); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } if (isset($node['comment'])) { for ($i = 0; $i < count($node['comment']); $i++) { $comment = new Comment(); $comment->entry = $post->id; $cursor =& $node['comment'][$i]; $comment->name = $cursor['commenter'][0]['name'][0]['.value']; if (!empty($cursor['id'][0]['.value'])) { $comment->id = $cursor['id'][0]['.value']; } if (!empty($cursor['commenter'][0]['.attributes']['id'])) { $comment->commenter = $cursor['commenter'][0]['.attributes']['id']; } if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) { $comment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; } if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) { $comment->ip = $cursor['commenter'][0]['ip'][0]['.value']; } if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) { $comment->openid = $cursor['commenter'][0]['openid'][0]['.value']; } $comment->password = $cursor['password'][0]['.value']; $comment->secret = $cursor['secret'][0]['.value']; $comment->written = $cursor['written'][0]['.value']; if (isset($cursor['longitude'][0]['.value'])) { $comment->longitude = $cursor['longitude'][0]['.value']; } if (isset($cursor['latitude'][0]['.value'])) { $comment->latitude = $cursor['latitude'][0]['.value']; } $comment->content = $cursor['content'][0]['.value']; if (!empty($cursor['isFiltered'][0]['.value'])) { $comment->isfiltered = $cursor['isFiltered'][0]['.value']; } if (!$comment->add()) { user_error(__LINE__ . $comment->error); } if (isset($node['comment'][$i]['comment'])) { for ($j = 0; $j < count($node['comment'][$i]['comment']); $j++) { $childComment = new Comment(); $childComment->entry = $post->id; $childComment->parent = $comment->id; $cursor =& $node['comment'][$i]['comment'][$j]; if (!empty($cursor['id'][0]['.value'])) { $childComment->id = $cursor['id'][0]['.value']; } if (!empty($cursor['commenter'][0]['.attributes']['id'])) { $childComment->commenter = $cursor['commenter'][0]['.attributes']['id']; } $childComment->name = $cursor['commenter'][0]['name'][0]['.value']; if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) { $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; } if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) { $childComment->ip = $cursor['commenter'][0]['ip'][0]['.value']; } if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) { $childComment->openid = $cursor['commenter'][0]['openid'][0]['.value']; } $childComment->password = $cursor['password'][0]['.value']; $childComment->secret = $cursor['secret'][0]['.value']; $childComment->written = $cursor['written'][0]['.value']; if (isset($cursor['longitude'][0]['.value'])) { $comment->longitude = $cursor['longitude'][0]['.value']; } if (isset($cursor['latitude'][0]['.value'])) { $comment->latitude = $cursor['latitude'][0]['.value']; } $childComment->content = $cursor['content'][0]['.value']; if (!empty($cursor['isFiltered'][0]['.value'])) { $childComment->isfiltered = $cursor['isFiltered'][0]['.value']; } if (!$childComment->add()) { user_error(__LINE__ . $childComment->error); } } } } } if (isset($node['trackback'])) { for ($i = 0; $i < count($node['trackback']); $i++) { $trackback = new Trackback(); $trackback->entry = $post->id; $cursor =& $node['trackback'][$i]; $trackback->url = $cursor['url'][0]['.value']; $trackback->site = $cursor['site'][0]['.value']; $trackback->title = $cursor['title'][0]['.value']; $trackback->excerpt = @$cursor['excerpt'][0]['.value']; if (!empty($cursor['ip'][0]['.value'])) { $trackback->ip = $cursor['ip'][0]['.value']; } if (!empty($cursor['received'][0]['.value'])) { $trackback->received = $cursor['received'][0]['.value']; } if (!empty($cursor['isFiltered'][0]['.value'])) { $trackback->isFiltered = $cursor['isFiltered'][0]['.value']; } if (!$trackback->add()) { user_error(__LINE__ . $trackback->error); } } } if (isset($node['logs'][0]['trackback'])) { for ($i = 0; $i < count($node['logs'][0]['trackback']); $i++) { $log = new TrackbackLog(); $log->entry = $post->id; $cursor =& $node['logs'][0]['trackback'][$i]; $log->url = $cursor['url'][0]['.value']; if (!empty($cursor['sent'][0]['.value'])) { $log->sent = $cursor['sent'][0]['.value']; } if (!$log->add()) { user_error(__LINE__ . $log->error); } } } return true; case '/blog/page': setProgress($item++ / $items * 100, _t('페이지를 복원하고 있습니다.')); $page = new Page(); $page->id = $node['id'][0]['.value']; $page->slogan = @$node['.attributes']['slogan']; $page->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $page->starred = $node['starred'][0]['.value']; } else { $page->starred = 0; } $page->title = $node['title'][0]['.value']; $page->content = $node['content'][0]['.value']; $page->contentformatter = isset($node['content']['.attributes']['formatter']) ? $node['content']['.attributes']['formatter'] : getDefaultFormatter(); $page->contenteditor = isset($node['content']['.attributes']['editor']) ? $node['content']['.attributes']['editor'] : getDefaultEditor(); $page->published = $node['published'][0]['.value']; $page->created = @$node['created'][0]['.value']; $page->modified = @$node['modified'][0]['.value']; if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $page->content = nl2brWithHTML($page->content); } if (!$page->add()) { user_error(__LINE__ . $page->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $page->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (Attachment::doesExist($attachment->name)) { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } $page2 = new Page(); if ($page2->open($page->id, 'id, content')) { $page2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $page2->content); $page2->update(); $page2->close(); } unset($page2); } else { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } return true; case '/blog/notice': setProgress($item++ / $items * 100, _t('공지를 복원하고 있습니다.')); $notice = new Notice(); $notice->id = $node['id'][0]['.value']; $notice->slogan = @$node['.attributes']['slogan']; $notice->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $notice->starred = $node['starred'][0]['.value']; } else { $notice->starred = 0; } $notice->title = $node['title'][0]['.value']; $notice->content = $node['content'][0]['.value']; $notice->contentformatter = isset($node['content'][0]['.attributes']['formatter']) ? $node['content'][0]['.attributes']['formatter'] : getDefaultFormatter(); $notice->contenteditor = isset($node['content'][0]['.attributes']['editor']) ? $node['content'][0]['.attributes']['editor'] : getDefaultEditor(); $notice->published = intval($node['published'][0]['.value']); $notice->created = @$node['created'][0]['.value']; $notice->modified = @$node['modified'][0]['.value']; if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $notice->content = nl2brWithHTML($notice->content); } if (!$notice->add()) { user_error(__LINE__ . $notice->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $notice->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (Attachment::doesExist($attachment->name)) { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } $notice2 = new Notice(); if ($notice2->open($notice->id, 'id, content')) { $notice2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $notice2->content); $notice2->update(); $notice2->close(); } unset($notice2); } else { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } return true; case '/blog/keyword': setProgress($item++ / $items * 100, _t('키워드를 복원하고 있습니다.')); $keyword = new Keyword(); $keyword->id = $node['id'][0]['.value']; $keyword->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $keyword->starred = $node['starred'][0]['.value']; } else { $keyword->starred = 0; } $keyword->name = $node['name'][0]['.value']; $keyword->description = $node['description'][0]['.value']; $keyword->descriptionEditor = isset($node['description'][0]['.attributes']['editor']) ? $node['description'][0]['.attributes']['editor'] : getDefaultEditor(); $keyword->descriptionFormatter = isset($node['description'][0]['.attributes']['formatter']) ? $node['description'][0]['.attributes']['formatter'] : getDefaultFormatter(); $keyword->published = intval($node['published'][0]['.value']); $keyword->created = @$node['created'][0]['.value']; $keyword->modified = @$node['modified'][0]['.value']; if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $keyword->description = nl2brWithHTML($keyword->description); } if (!$keyword->add()) { user_error(__LINE__ . $keyword->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $keyword->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (Attachment::doesExist($attachment->name)) { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } $keyword2 = new Keyword(); if ($keyword2->open($keyword->id, 'id, content')) { $keyword2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $keyword2->content); $keyword2->update(); $keyword2->close(); } unset($keyword2); } else { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } return true; case '/blog/linkCategories': setProgress($item++ / $items * 100, _t('링크 카테고리를 복원하고 있습니다.')); $linkCategory = new LinkCategories(); $linkCategory->name = $node['name'][0]['.value']; $linkCategory->priority = $node['priority'][0]['.value']; $linkCategory->visibility = !isset($node['visibility'][0]['.value']) || empty($node['visibility'][0]['.value']) ? 2 : $node['visibility'][0]['.value']; $linkCategory->id = LinkCategories::getId($linkCategory->name); if ($linkCategory->id) { if (!$linkCategory->update()) { user_error(__LINE__ . $linkCategory->error); } } else { if (!$linkCategory->add()) { user_error(__LINE__ . $linkCategory->error); } } return true; case '/blog/link': setProgress($item++ / $items * 100, _t('링크를 복원하고 있습니다.')); $link = new Link(); $link->category = empty($node['category'][0]['.value']) ? 0 : $node['category'][0]['.value']; $link->url = $node['url'][0]['.value']; $link->title = $node['title'][0]['.value']; if (!empty($node['feed'][0]['.value'])) { $link->feed = $node['feed'][0]['.value']; } if (!empty($node['registered'][0]['.value'])) { $link->registered = $node['registered'][0]['.value']; } if (!empty($node['xfn'][0]['.value'])) { $link->xfn = $node['xfn'][0]['.value']; } $link->id = Link::getId($link->url); if ($link->id) { if (!$link->update()) { user_error(__LINE__ . $link->error); } } else { if (!$link->add()) { user_error(__LINE__ . $link->error); } } return true; case '/blog/logs/referer': setProgress($item++ / $items * 100, _t('리퍼러 로그를 복원하고 있습니다.')); $log = new RefererLog(); if (isset($node['path'][0]['.value'])) { $log->url = $node['path'][0]['.value']; } else { $log->url = $node['url'][0]['.value']; } $log->referred = $node['referred'][0]['.value']; if (!$log->add(false)) { user_error(__LINE__ . $log->error); } return true; case '/blog/commentsNotified/comment': setProgress($item++ / $items * 100, _t('댓글 알리미 내용을 복원하고 있습니다.')); $cmtNotified = new CommentNotified(); $cmtNotified->id = $node['id'][0]['.value']; $cursor =& $node['commenter'][0]; $cmtNotified->name = $cursor['name'][0]['.value']; $cmtNotified->homepage = $cursor['homepage'][0]['.value']; $cmtNotified->ip = $cursor['ip'][0]['.value']; $cmtNotified->entry = $node['entry'][0]['.value']; $cmtNotified->password = $node['password'][0]['.value']; $cmtNotified->content = $node['content'][0]['.value']; $cmtNotified->parent = $node['parent'][0]['.value']; $cmtNotified->secret = $node['secret'][0]['.value']; $cmtNotified->written = $node['written'][0]['.value']; $cmtNotified->modified = $node['modified'][0]['.value']; $cmtNotified->url = $node['url'][0]['.value']; $cmtNotified->isnew = $node['isNew'][0]['.value']; $site = new CommentNotifiedSiteInfo(); if (!$site->open("url = '{$node['site'][0]['.value']}'")) { $site->title = ''; $site->name = ''; $site->modified = 31536000; $site->url = $node['site'][0]['.value']; $site->add(); } $cmtNotified->siteid = $site->id; $site->close(); $cmtNotified->remoteid = $node['remoteId'][0]['.value']; $cmtNotified->entrytitle = !isset($node['entryTitle'][0]['.value']) || empty($node['entryTitle'][0]['.value']) ? 'No title' : $node['entryTitle'][0]['.value']; $cmtNotified->entryurl = $node['entryUrl'][0]['.value']; if (!$cmtNotified->add()) { user_error(__LINE__ . $cmtNotified->error); } return true; case '/blog/commentsNotifiedSiteInfo/site': setProgress($item++ / $items * 100, _t('댓글 알리미 내용을 복원하고 있습니다.')); $cmtNotifiedSite = new CommentNotifiedSiteInfo(); if ($cmtNotifiedSite->open("url = '{$node['url'][0]['.value']}'")) { if (intval($node['modified'][0]['.value']) > intval($cmtNotifiedSite->modified)) { $cmtNotifiedSite->title = $node['title'][0]['.value']; $cmtNotifiedSite->name = $node['name'][0]['.value']; $cmtNotifiedSite->modified = $node['modified'][0]['.value']; } if (!$cmtNotifiedSite->update()) { user_error(__LINE__ . $cmtNotifiedSite->error); } } else { $cmtNotifiedSite->url = $node['url'][0]['.value']; $cmtNotifiedSite->title = $node['title'][0]['.value']; $cmtNotifiedSite->name = $node['name'][0]['.value']; $cmtNotifiedSite->modified = $node['modified'][0]['.value']; if (!$cmtNotifiedSite->add()) { user_error(__LINE__ . $cmtNotifiedSite->error); } } return true; case '/blog/statistics/referer': setProgress($item++ / $items * 100, _t('리퍼러 통계를 복원하고 있습니다.')); $statistics = new RefererStatistics(); $statistics->host = $node['host'][0]['.value']; $statistics->count = $node['count'][0]['.value']; if (!$statistics->add()) { user_error(__LINE__ . $statistics->error); } return true; case '/blog/statistics/visits': setProgress($item++ / $items * 100, _t('블로그 통계 정보를 복원하고 있습니다.')); $statistics = new BlogStatistics(); $statistics->visits = $node['.value']; if (!$statistics->add()) { user_error(__LINE__ . $statistics->error); } return true; case '/blog/statistics/daily': setProgress($item++ / $items * 100, _t('일별 통계 정보를 복원하고 있습니다.')); $statistics = new DailyStatistics(); $statistics->date = $node['date'][0]['.value']; $statistics->visits = $node['visits'][0]['.value']; if (!$statistics->add()) { user_error(__LINE__ . $statistics->error); } return true; case '/blog/skin': setProgress($item++ / $items * 100, _t('스킨 설정을 복원하고 있습니다.')); $setting = new SkinSetting(); if (false) { $setting->skin = $node['name'][0]['.value']; if (!$setting->save()) { user_error(__LINE__ . $setting->error); } $setting->skin = null; } $setting->entriesOnRecent = $node['entriesOnRecent'][0]['.value']; $setting->commentsOnRecent = $node['commentsOnRecent'][0]['.value']; $setting->trackbacksOnRecent = $node['trackbacksOnRecent'][0]['.value']; $setting->commentsOnGuestbook = $node['commentsOnGuestbook'][0]['.value']; $setting->tagsOnTagbox = $node['tagsOnTagbox'][0]['.value']; $setting->alignOnTagbox = $node['alignOnTagbox'][0]['.value']; $setting->expandComment = $node['expandComment'][0]['.value']; $setting->expandTrackback = $node['expandTrackback'][0]['.value']; if (!empty($node['recentNoticeLength'][0]['.value'])) { $setting->recentNoticeLength = $node['recentNoticeLength'][0]['.value']; } $setting->recentEntryLength = $node['recentEntryLength'][0]['.value']; $setting->recentTrackbackLength = $node['recentTrackbackLength'][0]['.value']; $setting->linkLength = $node['linkLength'][0]['.value']; $setting->showListOnCategory = $node['showListOnCategory'][0]['.value']; $setting->showListOnArchive = $node['showListOnArchive'][0]['.value']; if (isset($node['tree'])) { $cursor =& $node['tree'][0]; $setting->tree = $cursor['name'][0]['.value']; $setting->colorOnTree = $cursor['color'][0]['.value']; $setting->bgcolorOnTree = $cursor['bgColor'][0]['.value']; $setting->activecolorOnTree = $cursor['activeColor'][0]['.value']; $setting->activebgcolorOnTree = $cursor['activeBgColor'][0]['.value']; $setting->labelLengthOnTree = $cursor['labelLength'][0]['.value']; $setting->showValueOnTree = $cursor['showValue'][0]['.value']; } if (!$setting->save()) { user_error(__LINE__ . $setting->error); } return true; case '/blog/plugin': // setProgress($item++ / $items * 100, _t('플러그인 설정을 복원하고 있습니다.')); // $setting = new PluginSetting(); // $setting->name = $node['name'][0]['.value']; // $setting->setting = $node['setting'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); return true; case '/blog/personalization': // setProgress($item++ / $items * 100, _t('사용자 편의 설정을 복원하고 있습니다.')); // $setting = new UserSetting(); // $setting->name = 'rowsPerPage'; // $setting->value = $node['rowsPerPage'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); // $setting->name = 'readerPannelVisibility'; // $setting->value = $node['readerPannelVisibility'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); // $setting->name = 'readerPannelHeight'; // $setting->value = $node['readerPannelHeight'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); // $setting->name = 'lastVisitNotifiedPage'; // $setting->value = $node['lastVisitNotifiedPage'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); return true; case '/blog/userSetting': // setProgress($item++ / $items * 100, _t('사용자 편의 설정을 복원하고 있습니다')); // $setting = new UserSetting(); // $setting->name = $node['name'][0]['.value']; // $setting->value = $node['value'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); return true; case '/blog/guestbook/comment': setProgress($item++ / $items * 100, _t('방명록을 복원하고 있습니다.')); $comment = new GuestComment(); $comment->name = $node['commenter'][0]['name'][0]['.value']; if (!empty($node['id'][0]['.value'])) { $comment->id = $node['id'][0]['.value']; } if (!empty($node['commenter'][0]['.attributes']['id'])) { $comment->commenter = $node['commenter'][0]['.attributes']['id']; } if (!empty($node['commenter'][0]['homepage'][0]['.value'])) { $comment->homepage = $node['commenter'][0]['homepage'][0]['.value']; } if (!empty($node['commenter'][0]['ip'][0]['.value'])) { $comment->ip = $node['commenter'][0]['ip'][0]['.value']; } if (!empty($node['commenter'][0]['openid'][0]['.value'])) { $comment->openid = $node['commenter'][0]['openid'][0]['.value']; } $comment->password = $node['password'][0]['.value']; $comment->secret = @$node['secret'][0]['.value']; $comment->written = $node['written'][0]['.value']; $comment->content = $node['content'][0]['.value']; if (!$comment->add()) { user_error(__LINE__ . $comment->error); } if (isset($node['comment'])) { for ($j = 0; $j < count($node['comment']); $j++) { $childComment = new GuestComment(); $childComment->parent = $comment->id; $cursor =& $node['comment'][$j]; $childComment->name = $cursor['commenter'][0]['name'][0]['.value']; if (!empty($cursor['id'][0]['.value'])) { $comment->id = $cursor['id'][0]['.value']; } if (!empty($cursor['commenter'][0]['.attributes']['id'])) { $childComment->commenter = $cursor['commenter'][0]['.attributes']['id']; } if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) { $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; } if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) { $childComment->ip = $cursor['commenter'][0]['ip'][0]['.value']; } if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) { $childComment->openid = $cursor['commenter'][0]['openid'][0]['.value']; } $childComment->password = $cursor['password'][0]['.value']; $childComment->secret = @$cursor['secret'][0]['.value']; $childComment->written = $cursor['written'][0]['.value']; $childComment->content = $cursor['content'][0]['.value']; if (!$childComment->add()) { user_error(__LINE__ . $childComment->error); } } } return true; case '/blog/filter': setProgress($item++ / $items * 100, _t('필터 설정을 복원하고 있습니다.')); $filter = new Filter(); $filter->type = $node['.attributes']['type']; $filter->pattern = $node['pattern'][0]['.value']; if (!$filter->add()) { user_error(__LINE__ . $filter->error); } return true; case '/blog/feed': setProgress($item++ / $items * 100, _t('리더 데이터를 복원하고 있습니다.')); $feed = new Feed(); if (!empty($node['group'][0]['.value'])) { $feed->group = FeedGroup::getId($node['group'][0]['.value'], true); } $feed->url = $node['url'][0]['.value']; if (!$feed->add()) { user_error(__LINE__ . $feed->error); } return true; case '/blog/line': setProgress($item++ / $items * 100, _t('라인을 복원하고 있습니다.')); $line = Model_Line::getInstance(); $line->reset(); if (!empty($node['author'][0]['.value'])) { $line->author = $node['author'][0]['.value']; } if (!empty($node['category'][0]['.value'])) { $line->category = $node['category'][0]['.value']; } if (!empty($node['root'][0]['.value'])) { $line->root = $node['root'][0]['.value']; } if (!empty($node['permalink'][0]['.value'])) { $line->permalink = $node['permalink'][0]['.value']; } if (!empty($node['content'][0]['.value'])) { $line->content = $node['content'][0]['.value']; } if (!empty($node['created'][0]['.value'])) { $line->created = intval($node['created'][0]['.value']); } if ($line->add()) { return true; } else { user_error(__LINE__ . $line->_error); } } }
if (!empty($_POST['content'])) { if (!empty($_POST['key'])) { $key = $_POST['key']; } else { $key = null; } $content = $_POST['content']; $category = $_POST['category']; $mode = $_POST['mode']; } else { $key = $_GET['key']; $content = $_GET['content']; $category = $_GET['category']; $mode = $_GET['mode']; } $lineobj = Model_Line::getInstance(); $lineobj->reset(); // If line comes. if (!empty($content)) { $password = Setting::getBlogSetting('LinePassword', null, true); if ($password === $key || doesHaveOwnership()) { $lineobj->content = $content; $lineobj->category = $category; $result = $lineobj->add(); fireEvent('AddLine', $result, $lineobj); $cache = pageCache::getInstance(); $cache->name = 'linesATOM'; $cache->purge(); $cache->reset(); $cache->name = 'linesRSS'; $cache->purge();
public function action_ajax_clone_line() { $num = Arr::get($_POST, 'num'); $lineid = Arr::get($_POST, 'lineid'); $model = new Model_Line(); $flag = $model->cloneLine($lineid, $num); echo json_encode(array('status' => $flag)); }
public function action_ajax_addprice() { /* $typeid = Arr::get($_POST,'typeid'); $basicprice = Arr::get($_POST,'basicprice') ? Arr::get($_POST,'basicprice') : 0; $profit = Arr::get($_POST,'profit') ? Arr::get($_POST,'profit') : 0; $day = Arr::get($_POST,'day'); $suitid = Arr::get($_POST,'suitid'); $productid = Arr::get($_POST,'productid'); $price = (int)$basicprice+(int)$profit;*/ $typeid = Arr::get($_POST, 'typeid'); $productid = Arr::get($_POST, 'productid'); $suitid = Arr::get($_POST, 'suitid'); $basicprice = Arr::get($_POST, 'basicprice') ? Arr::get($_POST, 'basicprice') : 0; $profit = Arr::get($_POST, 'profit') ? Arr::get($_POST, 'profit') : 0; $child_basicprice = Arr::get($_POST, 'child_basicprice') ? Arr::get($_POST, 'child_basicprice') : 0; $child_profit = Arr::get($_POST, 'child_profit') ? Arr::get($_POST, 'child_profit') : 0; $old_basicprice = Arr::get($_POST, 'old_basicprice') ? Arr::get($_POST, 'old_basicprice') : 0; $old_profit = Arr::get($_POST, 'old_profit') ? Arr::get($_POST, 'old_profit') : 0; $number = $_POST['number'] == '' ? -1 : $_POST['number']; $number = (string) $number == '不限' ? -1 : $number; $roombalance = empty($_POST['roombalance']) ? 0 : $_POST['roombalance']; $day = Arr::get($_POST, 'day'); $price = (int) $basicprice + (int) $profit; $child_price = (int) $child_basicprice + (int) $child_profit; $old_price = (int) $old_basicprice + (int) $old_profit; $table = self::$priceTableArr[$typeid]; switch ($typeid) { case 1: $arr = array('lineid' => $productid, 'suitid' => $suitid, 'adultbasicprice' => $basicprice, 'adultprofit' => $profit, 'adultprice' => $price, 'day' => $day, 'childbasicprice' => $child_basicprice, 'childprofit' => $child_profit, 'childprice' => $child_price, 'oldbasicprice' => $old_basicprice, 'oldprofit' => $old_profit, 'oldprice' => $old_price, 'roombalance' => $roombalance); //$field = 'lineid,suitid,adultbasicprice,adultprofit,adultprice,day'; break; case 2: $arr = array('hotelid' => $productid, 'suitid' => $suitid, 'basicprice' => $basicprice, 'profit' => $profit, 'price' => $price, 'day' => $day); //$field = 'hotelid,suitid,basicprice,profit,price,day'; break; case 3: $arr = array('carid' => $productid, 'suitid' => $suitid, 'adultbasicprice' => $basicprice, 'adultprofit' => $profit, 'adultprice' => $price, 'day' => $day); // $field = 'carid,suitid,adultbasicprice,adultprofit,adultprice,day'; break; } $flag = false; if ($price != 0) { $sql_key = $sql_value = ''; $sql = "INSERT INTO sline_{$table} ("; $sql2 = "VALUES ( "; foreach ($arr as $key => $value) { $sql_key .= "`" . $key . "`,"; $sql_value .= "'" . $value . "',"; } $sql_key = substr($sql_key, 0, -1) . ")"; $sql_value = substr($sql_value, 0, -1) . ")"; $sql = $sql . $sql_key . $sql2 . $sql_value . ";"; //$sql = "insert into sline_{$table} ($field) values("; //$sql.= "'{$productid}','{$suitid}','{$basicprice}','{$profit}','{$price}','{$day}')"; $result = DB::query(Database::INSERT, $sql)->execute(); if ($result) { $flag = true; } } $out = array(); if ($flag) { $out['status'] = true; $out['price'] = $price; $out['basicprice'] = $basicprice; $out['profit'] = $profit; $out['child_price'] = $child_price; $out['child_basicprice'] = $child_basicprice; $out['child_profit'] = $child_profit; $out['old_price'] = $old_price; $out['old_basicprice'] = $old_basicprice; $out['old_profit'] = $old_profit; $out['roombalance'] = $roombalance; $out['number'] = $number == -1 ? '不限' : $number; switch ($typeid) { case 1: Model_Line::updateMinPrice($productid); break; case 2: Model_Hotel::updateMinPrice($productid); break; case 3: Model_Car::updateMinPrice($productid); break; } } else { $out['status'] = false; } echo json_encode($out); exit; }
public function action_create() { $lineid = $this->params['id']; /*if(!isset($GLOBALS['userinfo']['mid'])) { $forwardurl = URL::site('lines/create/id/'.$lineid); $this->request->redirect('user/login?forwardurl='.$forwardurl); }*/ $row = ORM::factory('line')->where("id={$lineid}")->find()->as_array(); if (empty($row['litpic'])) { $row['litpic'] = Common::getDefaultImage(); } $row['lineprice'] = Model_Line::getMinPrice($row['id']); $suit = ORM::factory('line_suit')->where("lineid={$lineid}")->get_all(); $dayBeforeNum = empty($row['linebefore']) ? 0 : $row['linebefore']; //价格开始时间,从今天开始,最近30条价格信息 $BeginDate = strtotime(date("Y-m-d")) + $dayBeforeNum * 24 * 60 * 60; //套餐价格 if (!empty($suit)) { foreach ($suit as $key => $value) { $price_arr = ORM::factory('line_suit_price')->where("suitid=" . $value['id'] . " and day>{$BeginDate} and adultprice>0")->order_by('day', 'asc')->limit('0,90')->get_all(); if (empty($price_arr)) { $suit[$key]['price_arr'] = array(); } else { foreach ($price_arr as $ke => $va) { $price_arr[$ke]['dayid'] = $va['day']; $price_arr[$ke]['day'] = date("Y-m-d", $va['day']); $price_arr[$ke]['suitid'] = $va['suitid']; } $suit[$key]['price_arr'] = $price_arr; } } } //var_dump($suit[0]['price_arr']); $this->assign('row', $row); $this->assign('suit', $suit); $this->display('lines/select'); }