info_page('状态错误!'); } } if (strpos($feed, 'http://') === false) { $feed = 'http://' . $feed; } $fnum = lazy_get_var("SELECT COUNT(*) FROM `app_feed` WHERE `feed` = " . s($feed) . ""); if ($fnum != '0') { info_page("此博客已经存在!"); } // $uid = format_uid(); $insert_feed = "INSERT INTO `app_feed` (`feed`, `tid`, `uid`, `title`, `time`, `img`, `state`) VALUES"; $insert_feed .= "(" . s($feed) . ", '" . intval($tid) . "', '" . intval($uid) . "', " . s($title) . ", '" . date('Y-m-d H:i:s') . "', '" . $img . "' , '" . $status . "')"; lazy_run_sql($insert_feed); $fid = lazy_last_id(); //add feed item $CI =& get_instance(); $CI->load->library('simplepie'); //MakeDir(ROOT.'static/data/cache'); //$CI->simplepie->set_cache_location(ROOT.'static/data/cache'); $CI->simplepie->set_feed_url($feed); $CI->simplepie->init(); $items = $CI->simplepie->get_items(); $values = array(); foreach ($items as $k => $v) { $title = $v->get_title(); // 标题 $desp = $v->get_content(); // 内容 $link = $v->get_link();
function add_shop_item_tag($cid) { $this->is_admin(); $cid = intval($cid); $tags = z(v('tags')); if ($cid > 0 && $tags) { $add_tags = array(); $tags = explode(' ', $tags); foreach ($tags as $v) { $v = trim(addslashes($v)); if ($v) { $add_tags[] = $v; } } if ($add_tags) { $ready = lazy_get_data("select * from `u2_shop_tags` where `tag` IN('" . join("','", $add_tags) . "') ", 'tag'); foreach ($add_tags as $v) { if (isset($ready[$v])) { lazy_run_sql("replace into `u2_shop_relate_tags` ( `cid` , `tid` , `is_active` )values('{$cid}','{$ready[$v]['id']}',0) "); } else { lazy_run_sql("replace into `u2_shop_tags` ( `tag` )values('{$v}') "); $tid = lazy_last_id(); lazy_run_sql("replace into `u2_shop_relate_tags` ( `cid` , `tid` , `is_active` )values('{$cid}','{$tid}',0) "); } } } } }