本文整理汇总了PHP中fimport函数的典型用法代码示例。如果您正苦于以下问题:PHP fimport函数的具体用法?PHP fimport怎么用?PHP fimport使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fimport函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* 初始化设置
* @param array $config 内存服务器优化设置
* @return void
*/
function init($config)
{
$this->config = $config;
$this->prefix = empty($config['prefix']) ? substr(md5($_SERVER['HTTP_HOST']), 0, 6) . '_' : $config['prefix'];
$this->keys = array();
if ($this->extension['memcache'] && !empty($config['memcache']['server'])) {
require_once fimport('class/memcache');
$this->memory = new Memcache();
$this->memory->init($this->config['memcache']);
if (!$this->memory->enable) {
$this->memory = NULL;
}
}
if (!is_object($this->memory) && $this->extension['eaccelerator'] && $this->config['eaccelerator']) {
require_once fimport('class/eaccelerator');
$this->memory = new Eaccelerator();
$this->memory->init(NULL);
}
if (!is_object($this->memory) && $this->extension['xcache'] && $this->config['xcache']) {
require_once fimport('class/xcache');
$this->memory = new Xcache();
$this->memory->init(NULL);
}
if (!is_object($this->memory) && $this->extension['apc'] && $this->config['apc']) {
require_once fimport('class/apc');
$this->memory = new Apc();
$this->memory->init(null);
}
if (is_object($this->memory)) {
$this->enable = true;
$this->type = get_class($this->memory);
$this->keys = $this->get('memory_system_keys');
$this->keys = !is_array($this->keys) ? array() : $this->keys;
}
}
示例2: photo
public function photo()
{
global $_FANWE;
if ($_FANWE['uid'] == 0) {
$redir_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
fSetCookie('redir_url', $redir_url, time() + 3600);
require_once fimport('dynamic/user');
include template('page/user/user_login');
} else {
FanweService::instance()->cache->loadCache('albums');
$imgs = $_FANWE['request']['imgUrl'];
$pageUrl = $_FANWE['request']['pageUrl'];
$img_list = explode(",", $imgs);
$count_img = count($img_list);
$videos = $_FANWE['request']['videoUrl'];
$video_list = explode(",", $videos);
$count_video = count($video_list);
if ($_FANWE['request']['showType'] == 1) {
include template("page/collection/collection_photos");
} else {
include template("page/collection/collection_photo");
}
}
display();
}
示例3: detail
public function detail()
{
global $_FANWE;
$id = intval($_FANWE['request']['id']);
if ($id == 0) {
fHeader("location: " . FU('index/index'));
}
include fimport('dynamic/u');
//获取相关的分享ID
$eventinfo = FDB::fetchFirst("select * from " . FDB::table("event") . " where id=" . $id);
if (intval($eventinfo['share_id']) == 0) {
fHeader("location: " . FU('index/index'));
}
$eventinfo['share'] = FS('Share')->getShareDetail($eventinfo['share_id']);
if ($share_detail === false) {
fHeader("location: " . FU('index'));
}
$user_share_collect = FS('Share')->getShareCollectUser($eventinfo['share_id']);
$page_title = preg_replace("/\\[[^\\]]+\\]/i", "", $eventinfo['title']);
$_FANWE['nav_title'] = $page_title . ' - ' . lang('common', 'event');
$_FANWE['seo_description'] = $page_title;
$_FANWE['setting']['site_description'] = '';
//分享评论
$page_args = array('id' => $id);
$count = $eventinfo['thread_count'];
$post_list = array();
if ($count > 0) {
$pager = buildPage('event/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 10);
$sql = 'SELECT share_id FROM ' . FDB::table('event_share') . '
WHERE event_id = ' . $id . ' ORDER BY share_id DESC LIMIT ' . $pager['limit'];
$ids = array();
$res = FDB::query($sql);
while ($data = FDB::fetch($res)) {
$ids[] = $data['share_id'];
}
$ids = implode(',', $ids);
$sql = 'SELECT * from ' . FDB::table('share') . ' where share_id IN (' . $ids . ') ORDER BY share_id';
$list = FDB::fetchAll($sql);
$post_list = FS('Share')->getShareDetailList($list, true, true, true);
}
$args = array('share_list' => &$post_list, 'pager' => &$pager, 'current_share_id' => $eventinfo['share_id']);
$post_html = tplFetch("inc/share/post_share_list", $args);
//热门话题
$hot_event_list = FS("event")->getHotEvent(10);
if (intval($_FANWE['uid']) > 0) {
//我发布的
$me_event_list = FS("event")->getUserEvent($_FANWE['uid'], 5);
//我参与的
$me_join_event_list = FS("event")->getUserJoinevent($_FANWE['uid'], 5);
}
if (intval($_FANWE['page']) == 1) {
FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $eventinfo['share_id']);
}
include template('page/event/event_detail');
display();
}
示例4: all
public function all()
{
define("ACTION_NAME", "all");
require fimport('function/user');
require fimport("function/share");
if (intval($GLOBALS['fanwe']->var['uid']) == 0) {
fHeader("location: " . FU('user/login'));
}
global $_FANWE;
$list_html = getAllList();
include template('page/home');
display();
}
示例5: bindCacheCity
function bindCacheCity()
{
$citys = array();
$res = FDB::query("SELECT * FROM " . FDB::table('region') . " ORDER BY id ASC");
while ($data = FDB::fetch($res)) {
if ($data['parent_id'] == 0) {
$citys['province'][] = $data['id'];
} elseif ($data['parent_id'] > 0) {
$citys['city'][$data['parent_id']][] = $data['id'];
}
$citys['all'][$data['id']] = $data;
}
include_once fimport('class/json');
$json = new JSON();
writeFile(PUBLIC_ROOT . './js/city.js', 'var CITYS = ' . $json->encode($citys) . ';');
FanweService::instance()->cache->saveCache('citys', $citys);
}
示例6: sendDemo
public function sendDemo()
{
vendor("common");
global $_FANWE;
$stmp = $_REQUEST;
require_once fimport('mail.class', 'class');
$mail = new Mail();
$mail->setStmp($stmp);
$name = '测试邮件';
$email = trim($stmp['mail_address']);
$subject = '测试邮件';
$content = '测试邮件';
if ($mail->send($name, $email, $subject, $content)) {
echo '发送成功';
} else {
echo '发送失败';
}
exit;
}
示例7: verify
public function verify()
{
global $_FANWE;
$seccode = random(6, 1);
$seccodeunits = '';
$s = sprintf('%04s', base_convert($seccode, 10, 24));
$seccodeunits = 'BCEFGHJKMPQRTVWXY2346789';
$seccode = '';
for ($i = 0; $i < 4; $i++) {
$unit = ord($s[$i]);
$seccode .= $unit >= 0x30 && $unit <= 0x39 ? $seccodeunits[$unit - 0x30] : $seccodeunits[$unit - 0x57];
}
$rhash = $_FANWE['request']['rhash'];
fSetCookie('verify' . $rhash, authcode(strtoupper($seccode) . "\t" . (TIME_UTC - 180) . "\t" . $rhash . "\t" . FORM_HASH, 'ENCODE', $_FANWE['config']['security']['authkey']), 0, 1, true);
@header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
require fimport('class/verify');
$verify = new Verify();
$verify->code = $seccode;
$verify->width = 100;
$verify->height = 36;
$verify->display();
}
示例8: systemClear
public function systemClear()
{
$system_clear = $_SESSION['cache_system_clear'];
if (empty($system_clear)) {
$this->redirect('Cache/system');
} else {
$_SESSION['cache_system_clear'] = $system_clear;
}
@set_time_limit(3600);
if (function_exists('ini_set')) {
ini_set('max_execution_time', 3600);
ini_set("memory_limit", "256M");
}
$this->display();
ob_start();
ob_end_flush();
ob_implicit_flush(1);
if (isset($system_clear['is_admin'])) {
clearCache();
echoFlush('<script type="text/javascript">showmessage(\'' . L('SYSTEM_TIPS6') . '\',1);</script>');
}
Vendor('common');
if (isset($system_clear['is_data'])) {
usleep(100);
include_once fimport('class/cache');
Cache::getInstance()->updateCache();
echoFlush('<script type="text/javascript">showmessage(\'' . L('SYSTEM_TIPS7') . '\',1);</script>');
}
if (isset($system_clear['is_tpl'])) {
usleep(50);
clearDir(FANWE_ROOT . './public/data/tpl/caches/static');
usleep(50);
clearDir(FANWE_ROOT . './public/data/tpl/caches/dynamic');
usleep(50);
clearDir(FANWE_ROOT . './public/data/tpl/compiled');
usleep(50);
clearDir(FANWE_ROOT . './public/data/tpl/caches/adv_position');
@file_put_contents(FANWE_ROOT . './public/data/tpl/caches/page/is_clear.lock', TIMESTAMP);
echoFlush('<script type="text/javascript">showmessage(\'' . L('SYSTEM_TIPS8') . '\',1);</script>');
}
usleep(100);
echoFlush('<script type="text/javascript">showmessage(\'' . L('SYSTEM_TIPS9') . '\',3);</script>');
exit;
}
示例9: forgetPassword
function forgetPassword()
{
global $_FANWE;
$method = strtolower($_SERVER["REQUEST_METHOD"]);
if ($method == 'post') {
$data = array('email' => $_FANWE['request']['email'], 'user_name' => $_FANWE['request']['user_name']);
$data_error = false;
$send_error = true;
$vservice = FS('Validate');
$validate = array(array('email', 'required', lang('user', 'register_email_require')), array('email', 'email', lang('user', 'register_email_error')), array('user_name', 'required', lang('user', 'register_user_name_require')), array('user_name', 'range_length', lang('user', 'register_user_name_len'), 2, 20), array('user_name', '/^[\\x{4e00}-\\x{9fa5}a-zA-Z][\\x{4e00}-\\x{9fa5}a-zA-Z0-9_]+$/u', lang('user', 'register_user_name_error')));
if (!$vservice->validation($validate, $data)) {
$data_error = true;
} else {
$uid = FDB::resultFirst('SELECT uid
FROM ' . FDB::table('user') . '
WHERE user_name = \'' . $data['user_name'] . '\' AND email = \'' . $data['email'] . '\'');
$uid = intval($uid);
if ($uid == 0) {
$data_error = true;
} else {
$reset_hash = md5(microtime(true) . random(8));
FDB::query('UPDATE ' . FDB::table('user_status') . '
SET reset_hash = \'' . $reset_hash . '\'
WHERE uid = ' . $uid);
$site_name = $_FANWE['setting']['site_name'];
$reset_url = $_FANWE['site_url'] . 'user.php?action=resetpassword&resethash=' . $reset_hash;
$title = sprintf(lang('user', 'get_pwd_title'), $site_name);
$content = sprintf(lang('user', 'get_pwd_html'), $site_name, $reset_url, $reset_url, $site_name, $_FANWE['site_url'], $site_name);
include fimport("class/mail");
$mail = new Mail();
if ($mail->send($data['user_name'], $data['email'], $title, $content, 1)) {
$send_error = false;
}
}
}
}
include template('page/user/user_getpwd');
display();
}
示例10: show
private function show($current_type = '')
{
global $_FANWE;
$share_id = intval($_FANWE['request']['sid']);
$id = intval($_FANWE['request']['id']);
$share_detail = FS('Share')->getShareDetail($share_id);
include fimport('dynamic/u');
if ($share_detail === false) {
fHeader("location: " . FU('index'));
}
$page_title = preg_replace("/\\[[^\\]]+\\]/i", "", $share_detail['content']);
$_FANWE['nav_title'] = $page_title . ' - ' . lang('common', 'share');
$_FANWE['seo_description'] = $page_title;
$_FANWE['setting']['site_description'] = '';
FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $share_id);
//上一个,下一个分享
//$pns = FS('Share')->getPrevNextShares($share_detail['uid'],$share_id);
//发布分享的会员
$share_user = FS('User')->getUserById($share_detail['uid']);
//喜欢分享的会员
$share_detail['collects'] = FS('Share')->getShareCollectUser($share_id);
if (!isset($share_detail['collects'][$_FANWE['uid']])) {
if (FS('Share')->getIsCollectByUid($share_id, $_FANWE['uid'])) {
$share_detail['collects'][$_FANWE['uid']] = $_FANWE['uid'];
}
}
//会员显示名称
$user_show_name = FS('User')->getUserShowName($share_detail['uid']);
//会员勋章
$user_medals = FS('User')->getUserMedal($share_detail['uid']);
//分享标签
$share_tags = $share_detail['cache_data']['tags']['user'];
FS('Share')->tagsFormat($share_tags);
foreach ($share_tags as $seo_tag) {
$_FANWE['seo_keywords'] .= $seo_tag['tag_name'] . ',';
}
//是否可编辑标签
$is_eidt_tag = FS('Share')->getIsEditTag($share_detail);
//喜欢分享的会员还喜欢
$fav_user_fav_share = FS('Share')->getCollectShareByShare($share_id);
//发布分享的会员喜欢的分享
$user_collect_share = FS('Share')->getCollectShareByUser($share_user['uid']);
//是否可删除标签
$is_remove_comment = FS('Share')->getIsRemoveComment($share_detail);
//分享评论
$share_detail['comments'] = FS('Share')->getShareCommentList($share_id, '0,10');
//分享评论分页
$pager = buildPage('', array(), $share_detail['comment_count'], $_FANWE['page'], 10);
unset($share_detail['cache_data']);
$current_obj = NULL;
if ($current_type == '' || $id == 0) {
if (!empty($share_detail['imgs'])) {
$current_obj = current($share_detail['imgs']);
if ($current_obj['type'] == 'g') {
$current_type = 'bao';
} else {
$current_type = 'photo';
}
}
} else {
switch ($current_type) {
case 'bao':
foreach ($share_detail['imgs'] as $img) {
$current_obj = $img;
if ($img['type'] == 'g' && $img['id'] == $id) {
break;
}
}
break;
case 'photo':
foreach ($share_detail['imgs'] as $img) {
$current_obj = $img;
if ($img['type'] == 'm' && $img['id'] == $id) {
break;
}
}
break;
}
}
if (!empty($current_obj['name'])) {
$_FANWE['nav_title'] = $current_obj['name'] . ' - ' . lang('common', 'share');
}
switch ($current_type) {
case 'bao':
//会员最被喜欢的宝贝
$best_goods_share = FS('Share')->getBestCollectGoodsShareByUser($share_user['uid']);
//会员分享店铺信息
$shop_percent_html = FS('Shop')->getUserShareShopHtml($share_user['uid']);
break;
case 'photo':
//会员最被喜欢的照片
$best_photo_share = FS('Share')->getBestCollectPhotoShareByUser($share_user['uid']);
//会员喜欢的照片
$user_fav_photo = FS('Share')->getUserFavPhotoShare($share_user['uid']);
break;
default:
//获取原文分享
$share_detail['is_relay'] = false;
$share_detail['is_rec'] = false;
if ($share_detail['parent_id'] > 0 && $share_detail['base_id'] > 0) {
//.........这里部分代码省略.........
示例11: define
<?php
define('MODULE_NAME', 'Book');
$actions = array('cate', 'shopping', 'search', 'dapei', 'look');
if (isset($_REQUEST['action'])) {
$action = strtolower($_REQUEST['action']);
if (!in_array($action, $actions)) {
$action = 'shopping';
}
}
define('ACTION_NAME', $action);
require dirname(__FILE__) . '/core/fanwe.php';
$fanwe =& FanweService::instance();
$fanwe->initialize();
require fimport('module/book');
switch (ACTION_NAME) {
case 'cate':
BookModule::cate();
break;
case 'shopping':
BookModule::shopping();
break;
case 'search':
BookModule::search();
break;
case 'dapei':
define('IS_DAPAI', true);
BookModule::dapei();
break;
case 'look':
define('IS_DAPAI', true);
示例12: error
function error($message, $tpl_name)
{
require_once fimport('class/error');
FanweError::templateError($message, $tpl_name);
}
示例13: save
public function save()
{
global $_FANWE;
if ($_FANWE['uid'] == 0) {
exit;
}
include_once fimport('class/image');
$image = new Image();
if (intval($_FANWE['setting']['max_upload']) > 0) {
$image->max_size = intval($_FANWE['setting']['max_upload']);
}
$daren = array();
$daren['uid'] = $_FANWE['uid'];
$daren['reason'] = $_FANWE['request']['reason'];
$daren['status'] = 0;
$daren['create_time'] = TIME_UTC;
//个人街拍照
$img = $_FILES['img'];
if (!empty($img)) {
$image->init($img, 'daren');
if ($image->save()) {
$daren['img'] = $image->file['target'];
}
}
$index_img = $_FILES['index_img'];
if (!empty($index_img)) {
$image->init($index_img, 'daren');
if ($image->save()) {
$daren['index_img'] = $image->file['target'];
}
}
$id = FDB::insert('user_daren', $daren, true, false, true);
if ($id > 0) {
showSuccess('提交申请成功', '你的达人申请已经成功提交,我们会尽快处理你的达人申请!', FU('daren/index'));
} else {
showError('提交申请失败', '你的达人申请提交失败,请重新提交达人申请', -1);
}
}
示例14: halt
function halt($message = '', $sql = '')
{
require_once fimport('class/error');
FanweError::dbError($message, $sql);
}
示例15: getUserWeiBoFollowers
public function getUserWeiBoFollowers($uid)
{
$uid = (int) $uid;
if (!$uid) {
return false;
}
$binds = UserService::getUserBindList($uid);
if ($binds) {
foreach ($binds as $type => $bind) {
include fimport('class/' . $type, 'user');
$type = ucfirst($type) . 'User';
$weibo = new $type();
$followers = $weibo->getFollowers($uid);
}
}
}