// 鍏ュ簱杩囨护 闈炵鐞嗗憳鍏ㄩ儴杩囨护 $post['message'] = isset($post['gid']) && 1 == $post['gid'] ? $post['message'] : xn_html_safe($post['message']); break; case '1': $post['message'] = xn_txt_to_html($post['message']); break; default: $post['message'] = htmlspecialchars($post['message'], ENT_QUOTES); // html鏍囩鍏ㄩ儴杞崲 break; } // 瀵瑰紩鐢ㄨ繘琛屽鐞 !empty($post['quotepid']) && $post['quotepid'] > 0 && $post['message'] = comment_quote($post['quotepid']) . $post['message']; } unset($post['gid']); } /*鍏敤鐨勯檮浠舵ā鏉匡紝閲囩敤鍑芥暟锛屾晥鐜囨瘮 include 楂 * @param $filelist 闄勪欢鍒楄〃 * @param bool $include_delete 鍒犻櫎 * @param bool $access TRUE缂栬緫鏃堕檮浠惰矾寰 * @param bool $path TRUE鍚庡彴缂栬緫鏃堕檮浠惰矾寰 * @return string */ function data_file_list_html($filelist, $include_delete = FALSE, $access = FALSE, $path = FALSE) { global $conf; if (empty($filelist)) return ''; if (FALSE != $path) { if ($conf['url_rewrite_on'] > 1) { $path = $conf['path']; } else { $path = '../'; } } else { $path = ''; } $s = '
' . "\r\n"; $s .= '' . lang('uploaded_attach') . '锛' . "\r\n"; $s .= '' . "\r\n"; $s .= '
' . "\r\n"; return $s; } //--------------------------cache-------------------------- // 浠庣紦瀛樹腑璇诲彇锛岄伩鍏嶉噸澶嶄粠鏁版嵁搴撳彇鏁版嵁 function data_read_cache($tid) { global $conf; $key = 'website_data_' . $tid; static $cache = array(); // 鐢ㄩ潤鎬佸彉閲忓彧鑳藉湪褰撳墠 request 鐢熷懡鍛ㄦ湡缂撳瓨锛岃璺ㄨ繘绋嬶紝鍙互鍐嶅姞涓灞傜紦瀛橈細 memcached/xcache/apc/ if (isset($cache[$key])) return $cache[$key]; if ('mysql' == $conf['cache']['type']) { $r = data_read($tid); } else { $r = cache_get($key); if (NULL === $r) { $r = data_read($tid); $r and cache_set($key, $r, 1800); // 30鍒嗛挓 } } $cache[$key] = $r ? $r : NULL; return $cache[$key]; } ?>扮粍淇濈暀鐨勬爣绛 浣欎笅涓洪渶瑕佸垹闄ょ殑鏍囩 unset($oldtag[$key]); } } } if (!empty($oldtag)) { $tagids = array(); foreach ($oldtag as $tagid => $tagname) { $tagids[] = $tagid; } well_oldtag_delete($tagids, $tid); } $r = well_tag_process($tid, $fid, $create_tag, $tagarr); return $r; } // 鍒犻櫎鏍囩鍜岀粦瀹氱殑涓婚 function well_oldtag_delete($tagids, $tid) { $pagesize = count($tagids); $arrlist = well_tag_find_by_tagids($tagids, 1, $pagesize); $delete_tagids = array(); // 鍒犻櫎 $tagids = array(); $n = 0; foreach ($arrlist as $val) { ++$n; if (1 == $val['count']) { // 鍙湁涓涓富棰 $delete_tagids[] = $val['tagid']; } else { $tagids[] = $val['tagid']; } } !empty($delete_tagids) and well_tag_delete($delete_tagids); $arlist = well_tag_thread_find_by_tid($tid, 1, $n); if ($arlist) { $ids = array(); foreach ($arlist as $val) $ids[] = $val['id']; well_tag_thread_delete($ids); } !empty($tagids) and well_tag_update($tagids, array('count-' => 1)); } // 鏍囩鏁版嵁澶勭悊 $arr=鏂版彁浜ょ殑鏁扮粍 $tagarr=淇濈暀鐨勬棫鏍囩 function well_tag_process($tid, $fid, $new_tags = array(), $tagarr = array()) { if (empty($tid)) return ''; // 鏂版爣绛惧鐞嗗叆搴 if ($new_tags) { $threadarr = array(); $tagids = array(); $i = 0; $size = 5; $n = count($tagarr); $n = $n > $size ? $size : $size - $n; foreach ($new_tags as $name) { ++$i; $name = trim($name); $name = stripslashes($name); $name = strip_tags($name); $name = str_replace(array(' ', '#', "@", "$", "%", "^", '&', '路', '<', '>', '锛', '`', '~', '!', '锟', '鈥︹', ';', '?', '锛', '-', '鈥', '_', '=', '+', '.', '{', '}', '|', ':', '锛', '銆', '/', '銆', '[', ']', '銆', '銆', '鈥', ' ', ' ', ' ', ' ', ' '), '', $name); $name = htmlspecialchars($name, ENT_QUOTES); if ($name && $i <= $n) { // 鏌ヨ鏍囩 $read = well_tag_read_name($name); if ($read) { // 瀛樺湪 count+1 $tagids[] = $read['tagid']; } else { // 鍏ュ簱 $arr = array('name' => $name, 'count' => 1); $tagid = well_tag_create($arr); FALSE === $tagid and message(-1, lang('create_failed')); $read = array('tagid' => $tagid, 'name' => $name); } $tag_thread = array('tagid' => $read['tagid'], 'tid' => $tid); $threadarr[] = $tag_thread; $tagarr[$read['tagid']] = $read['name']; } } !empty($threadarr) and tag_thread_big_insert($threadarr); !empty($tagids) and well_tag_update($tagids, array('count+' => 1)); } $json = empty($tagarr) ? '' : xn_json_encode($tagarr); return $json; } ?>return $r; } /** * @param int $page 椤垫暟 * @param int $pagesize 姣忛〉鏄剧ず鏁伴噺 * @return mixed */ function link_find($page = 1, $pagesize = 100) { $arr = link__find($cond = array(), array('rank' => -1), $page, $pagesize); return $arr; } /** * @param $id * @return bool 杩斿洖FALSE澶辫触 TRUE鎴愬姛 */ function link_delete($id) { if (empty($id)) return FALSE; $r = link__delete(array('id' => $id)); link_delete_cache(); return $r; } //--------------------------kv + cache-------------------------- /** * @return mixed 杩斿洖鍏ㄩ儴鍙嬫儏閾炬帴 */ function link_get($page = 1, $pagesize = 100) { $g_link = website_get('friends_link'); if (empty($g_link)) { $g_link = link_find($page, $pagesize); $g_link AND website_set('friends_link', $g_link); } return $g_link; } // delete kv and cache function link_delete_cache() { website_set('friends_link', ''); return TRUE; } ?>tpw_complete': // 閲嶇疆瀵嗙爜 $pre .= $default_pre .= 'user_resetpw_complete.htm'; break; case 'user_comment': // 鎴戠殑棣栭〉璇勮 $pre .= $default_pre .= 'user_comment.htm'; break; case 'single_page': // 鍗曢〉 $pre .= $default_pre .= 'single_page.htm'; break; case 'search': // 鎼滅储 $pre .= $default_pre .= 'search.htm'; break; case 'operate_sticky': // 缃《 $pre .= $default_pre .= 'operate_sticky.htm'; break; case 'operate_close': // 鍏抽棴 $pre .= $default_pre .= 'operate_close.htm'; break; case 'operate_delete': // 鍒犻櫎 $pre .= $default_pre .= 'operate_delete.htm'; break; case 'operate_move': // 绉诲姩 $pre .= $default_pre .= 'operate_move.htm'; break; case '404': $pre .= $default_pre .= '404.htm'; break; case 'read_404': $pre .= $default_pre .= 'read_404.htm'; break; case 'list_404': $pre .= $default_pre .= 'list_404.htm'; break; default: // 棣栭〉 $pre .= $default_pre .= theme_mode_pre(); break; } if ($config['theme']) { $conffile = APP_PATH . 'view/template/' . $config['theme'] . '/conf.json'; $json = is_file($conffile) ? xn_json_decode(file_get_contents($conffile)) : array(); } // 鍔犺浇缁戝畾ID瀹夎椋庢牸 !empty($json['installed']) and $path_file = APP_PATH . 'view/template/' . $config['theme'] . '/htm/' . ($id ? $id . '_' : '') . $pre; // 鍔犺浇瀹夎椋庢牸 (empty($path_file) || !is_file($path_file)) and $path_file = APP_PATH . 'view/template/' . $config['theme'] . '/htm/' . $pre; // 涓婚鏍间笅鍙畨瑁呭涓瓙椋庢牸 if (!empty($config['theme_child']) && is_array($config['theme_child'])) { foreach ($config['theme_child'] as $theme) { if (empty($theme) || is_array($theme)) continue; // 鍔犺浇缁戝畾ID瀹夎椋庢牸 $path_file = APP_PATH . 'view/template/' . $theme . '/htm/' . ($id ? $id . '_' : '') . $pre; // 鍔犺浇瀹夎椋庢牸 !is_file($path_file) and $path_file = APP_PATH . 'view/template/' . $theme . '/htm/' . $pre; } } // 椋庢牸涓嶅瓨鍦ㄥ姞杞介傞厤绔 !is_file($path_file) and $path_file = APP_PATH . ($dir ? 'plugin/' . $dir . '/view/htm/' : 'view/htm/') . $default_pre; return $path_file; } // 渚濇嵁妯″紡杩斿洖閫傞厤鏂囦欢 function theme_mode_pre($type = 0) { global $config; // 缃戠珯妯″紡 $mode = $config['setting']['website_mode']; $pre = ''; // 棣栭〉鏂囦欢鍓嶇紑 if (1 == $mode) { // 闂ㄦ埛妯″紡 $pre .= 2 == $type ? 'portal_category.htm' : 'portal.htm'; } elseif (2 == $mode) { // 鎵佸钩妯″紡 $pre .= 2 == $type ? 'flat_category.htm' : 'flat.htm'; } else { // 鑷畾涔夋ā寮 $pre .= 2 == $type ? 'index_category.htm' : 'index.htm'; } return $pre; } ?>