public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = (int) $_FANWE['requestData']['uid']; $cid = (int) $_FANWE['requestData']['cid']; $album_title = trim($_FANWE['requestData']['title']); $data = array('title' => $album_title, 'cid' => $cid); $vservice = FS('Validate'); $validate = array(array('title', 'required', lang('album', 'name_require')), array('title', 'max_length', lang('album', 'name_max'), 60), array('cid', 'min', lang('album', 'cid_min'), 1)); if (!$vservice->validation($validate, $data)) { $root['info'] = $vservice->getError(); m_display($root); } $check_result = FS('Share')->checkWord($album_title, 'title'); if ($check_result['error_code'] == 1) { $root['info'] = $check_result['error_msg']; m_display($root); } if ($uid > 0) { if (!FS('User')->getUserExists($uid)) { $uid = 0; } } if ($cid == 0) { $uid == 0; } if ($uid == 0) { $root['info'] = "请先登录"; m_display($root); } $share_data = array(); $share_data['uid'] = $uid; $share_data['type'] = 'album'; $share_data['content'] = $album_title; $share = FS('Share')->submit($share_data, false, true, true); if ($share['status']) { $data = array(); $data['title'] = htmlspecialchars($album_title); $data['album_title_match'] = segmentToUnicode(clearSymbol($album_title)); $data['uid'] = $uid; $data['cid'] = $cid; $data['share_id'] = $share['share_id']; $data['create_day'] = getTodayTime(); $data['create_time'] = TIME_UTC; $data['show_type'] = 2; $aid = FDB::insert('album', $data, true); FDB::query('UPDATE ' . FDB::table('share') . ' SET rec_id = ' . $aid . ' WHERE share_id = ' . $share['share_id']); FDB::query("update " . FDB::table("user_count") . " set albums = albums + 1 where uid = " . $uid); $root['aid'] = $aid; $root['album_name'] = $album_title; $root['return'] = 1; } m_display($root); }
FanweService::instance()->cache->loadCache('albums'); if (!isset($_FANWE['cache']['albums']['category'][$data['cid']])) { exit; } $check_result = FS('Share')->checkWord($_FANWE['request']['title'], 'title'); if ($check_result['error_code'] == 1) { $result['msg'] = $check_result['error_msg']; outputJson($result); } $_FANWE['request']['uid'] = $_FANWE['uid']; $_FANWE['request']['type'] = 'album'; $_FANWE['request']['content'] = $_FANWE['request']['title']; $share = FS('Share')->submit($_FANWE['request'], false, true, true); if ($share['status']) { $data['title'] = htmlspecialchars($_FANWE['request']['title']); $data['album_title_match'] = segmentToUnicode(clearSymbol($data['title'])); $data['uid'] = $_FANWE['uid']; $data['share_id'] = $share['share_id']; $data['create_day'] = getTodayTime(); $data['create_time'] = TIME_UTC; $data['show_type'] = 2; $aid = FDB::insert('album', $data, true); FDB::query('UPDATE ' . FDB::table('share') . ' SET rec_id = ' . $aid . ' WHERE share_id = ' . $share['share_id']); FDB::query("update " . FDB::table("user_count") . " set albums = albums + 1 where uid = " . $_FANWE['uid']); $result['url'] = FU("album/show", array('id' => $aid)); $result['aid'] = $aid; $result['title'] = $data['title']; $result['status'] = 1; } else { $result['msg'] = '添加数据失败';
if (count($data_num) > 0) { $data_num = $data_num[0]['num']; } else { $data_num = 0; } if ($data_num > $begin) { $limit = $data_num - $begin; if ($limit > 1000) { $limit = 1000; } $data_list = $db->query("SELECT id,site_name,name FROM {$table} LIMIT " . $begin . ',' . $limit); showjsmessage("开始更新数据表 goods {$begin} 到 " . ($begin + $limit) . " 行"); $data_count = count($data_list); for ($j = 0; $j < $data_count; $j++) { $data = $data_list[$j]; $db->query('INSERT INTO ' . $table_match . ' (id,content) VALUES(' . $data['id'] . ',\'' . segmentToUnicode(clearSymbol($data['site_name'] . $data['name'])) . '\')'); } showjsmessage("更新数据表 goods {$begin} 到 " . ($begin + $limit) . " 行 成功"); if ($limit < 1000) { showjsmessage(U('Index/updatetable', array('table' => 'area', 'begin' => 0)), 5); exit; } else { showjsmessage(U('Index/updatetable', array('table' => 'goods', 'begin' => $begin + $limit)), 5); exit; } } /** * utf8字符转Unicode字符 * @param string $char 要转换的单字符 * @return void */
$data['share_id'] = intval($_FANWE['request']['share_id']); $data['content'] = htmlspecialchars($_FANWE['request']['content']); $data['album_id'] = intval($_FANWE['request']['albumid']); $data['old_album_id'] = intval($_FANWE['request']['old_album_id']); $o_img = copyImage(FANWE_ROOT . $_FANWE['request']['img_url'], md5(microtime(true)) . random('6') . ".jpg", 'share', true, $_FANWE['request']['share_id']); $data['img'] = $o_img['url']; $data['photo_id'] = intval($_FANWE['request']['photo_id']); if (empty($data['content']) || empty($data['album_id']) || empty($data['photo_id'])) { $result['status'] = 0; outputJson($result); } $upImg = false; if (!empty($data['img'])) { $upImg = true; } $share_sql = "update " . FDB::table("share") . " set content = '" . $data['content'] . "',share_content_match = '" . segmentToUnicode(clearSymbol($data['content'])) . "' where share_id = " . $data['share_id']; $share_photo_sql = "update " . FDB::table("share_photo") . " set img = '" . $data['img'] . "',img_width = " . $o_img['width'] . ",img_height = " . $o_img['height'] . " where photo_id = " . $data['photo_id']; $album_share_sql = "select * from " . FDB::table("album_share") . " where album_id = " . $data['album_id'] . " and share_id = " . $data['share_id']; if (!FDB::fetchFirst($album_share_sql)) { FDB::query("delete from " . FDB::table("album_share") . " where share_id =" . $data['share_id']); FDB::query("update " . FDB::table("album") . " set share_count = share_count - 1 where id =" . $data['old_album_id']); FDB::query("update " . FDB::table("album") . " set share_count = share_count + 1 where id =" . $data['album_id']); $cid = FDB::resultFirst("select cid from " . FDB::table("album") . " where id = " . $data['album_id']); if ($cid) { $album_data = array(); $album_data['album_id'] = $data['album_id']; $album_data['share_id'] = $data['share_id']; $album_data['cid'] = $cid; $album_data['create_day'] = TIME_UTC; if (FDB::insert('album_share', $album_data, true)) { FDB::query($share_sql);
public function updateShareMatch($share_id) { $share = ShareService::getShareById($share_id); if (!in_array($share['share_data'], array('goods', 'photo', 'goods_photo'))) { return; } $share['cache_data'] = fStripslashes(unserialize($share['cache_data'])); $content_match = clearExpress($share['content']); $content_match .= $share['title']; if (isset($share['cache_data']['tags']['user'])) { foreach ($share['cache_data']['tags']['user'] as $tag) { $content_match .= $tag['tag_name']; } } if (isset($share['cache_data']['tags']['admin'])) { foreach ($share['cache_data']['tags']['admin'] as $tag) { $content_match .= $tag['tag_name']; } } if (isset($share['cache_data']['imgs']['all'])) { foreach ($share['cache_data']['imgs']['all'] as $img) { if (!empty($img['name'])) { $content_match .= $img['name']; } } } //保存匹配查询 $share_match = array(); $share_match['share_id'] = $share_id; $share_match['content_match'] = segmentToUnicode(clearSymbol($content_match)); FDB::insert("share_match", $share_match, false, true); }
} $old = FS('Topic')->getTopicById($id); if (empty($old)) { deleteManageLock('club', $id); exit; } $share_id = $old['share_id']; $topic = array('title' => htmlspecialchars(trim($_FANWE['request']['title'])), 'content' => htmlspecialchars(trim($_FANWE['request']['content'])), 'fid' => $_FANWE['request']['fid'], 'is_best' => isset($_FANWE['request']['is_best']) ? intval($_FANWE['request']['is_best']) : 0, 'is_top' => isset($_FANWE['request']['is_top']) ? intval($_FANWE['request']['is_top']) : 0, 'is_event' => isset($_FANWE['request']['is_event']) ? intval($_FANWE['request']['is_event']) : 0); FDB::update('forum_thread', $topic, 'tid = ' . $id); $match_content = $topic['title']; $match_content .= preg_replace("/\\[[^\\]]+\\]/i", "", $topic['content']); $res = FDB::query('SELECT name FROM ' . FDB::table('share_goods') . ' WHERE share_id = ' . $share_id); while ($data = FDB::fetch($res)) { $match_content .= $data['name']; } $res = FDB::query('SELECT tag_name FROM ' . FDB::table('share_tags') . ' WHERE share_id = ' . $share_id); while ($data = FDB::fetch($res)) { $match_content .= $data['tag_name ']; } $share_match = array(); $share_match['content_match'] = segmentToUnicode(clearSymbol($match_content)); FDB::update("share_match", $share_match, 'share_id = ' . $share_id); $share = array(); $share['title'] = $topic['title']; $share['content'] = $topic['content']; FDB::update("share", $share, 'share_id = ' . $share_id); createManageLog('club', 'edit', $id, lang('manage', 'manage_edit_success')); deleteManageLock('club', $id); $msg = lang('manage', 'manage_edit_success'); include template('manage/tooltip'); display();