当前位置: 首页>>代码示例>>PHP>>正文


PHP load_dynamic_cache函数代码示例

本文整理汇总了PHP中load_dynamic_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP load_dynamic_cache函数的具体用法?PHP load_dynamic_cache怎么用?PHP load_dynamic_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了load_dynamic_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse_wap_url_tag

function parse_wap_url_tag($str)
{
    $key = md5("WAP_URL_TAG_" . $str);
    if (isset($GLOBALS[$key])) {
        return $GLOBALS[$key];
    }
    $url = load_dynamic_cache($key);
    $url = false;
    if ($url !== false) {
        $GLOBALS[$key] = $url;
        return $url;
    }
    $str = substr($str, 2);
    $str_array = explode("|", $str);
    $app_index = $str_array[0];
    $route = $str_array[1];
    $param_tmp = explode("&", $str_array[2]);
    $param = array();
    foreach ($param_tmp as $item) {
        if ($item != '') {
            $item_arr = explode("=", $item);
        }
        if ($item_arr[0] && $item_arr[1]) {
            $param[$item_arr[0]] = $item_arr[1];
        }
    }
    $GLOBALS[$key] = wap_url($app_index, $route, $param);
    set_dynamic_cache($key, $GLOBALS[$key]);
    return $GLOBALS[$key];
}
开发者ID:eliu03,项目名称:fanweP2P,代码行数:30,代码来源:functions.php

示例2: fav

 public function fav()
 {
     if (!$GLOBALS['user_info']) {
         app_redirect(url("user#login"));
     }
     $GLOBALS['tmpl']->assign("page_title", "我关注的项目动态");
     $cate_result = load_dynamic_cache("INDEX_CATE_LIST");
     if ($cate_result === false) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         $cate_result = array();
         foreach ($cate_list as $k => $v) {
             $cate_result[$v['id']] = $v;
         }
         set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $rand_deals = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and begin_time < " . NOW_TIME . " and (end_time >" . NOW_TIME . " or end_time = 0) order by rand() limit 3");
     $GLOBALS['tmpl']->assign("rand_deals", $rand_deals);
     $page_size = DEALUPDATE_PAGE_SIZE;
     $step_size = DEALUPDATE_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $sql = "select dl.* from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']) . " order by dl.create_time desc limit " . $limit;
     $sql_count = "select count(*) from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']);
     $log_list = $GLOBALS['db']->getAll($sql);
     $log_count = $GLOBALS['db']->getOne($sql_count);
     foreach ($log_list as $k => $v) {
         $log_list[$k]['pass_time'] = pass_date($v['create_time']);
         $online_time = online_date($v['create_time'], $deal_info['begin_time']);
         $log_list[$k]['online_time'] = $online_time['info'];
         $log_list[$k]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id']);
         $log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " order by create_time desc limit 3");
         if ($log_list[$k]['comment_count'] <= count($log_list[$k]['comment_list'])) {
             $log_list[$k]['more_comment'] = false;
         } else {
             $log_list[$k]['more_comment'] = true;
         }
         $log_list[$k]['deal_info'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $v['deal_id']);
         if ($log_list[$k]['deal_info']) {
             $log_list[$k]['deal_info']['remain_days'] = floor(($log_list[$k]['deal_info']['end_time'] - NOW_TIME) / (24 * 3600));
             $log_list[$k]['deal_info']['percent'] = round($log_list[$k]['deal_info']['support_amount'] / $log_list[$k]['deal_info']['limit_price'] * 100);
         }
     }
     $GLOBALS['tmpl']->assign('log_list', $log_list);
     $pager = new Page($log_count, $page_size);
     //初始化分页对象
     $p = $pager->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("ajaxurl", url("ajax#newsfav", array("p" => $page)));
     $GLOBALS['tmpl']->display("news.html");
 }
开发者ID:noikiy,项目名称:yisheji,代码行数:59,代码来源:newsModule.class.php

示例3: index

 public function index()
 {
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_result = load_dynamic_cache("INDEX_CATE_LIST");
     if ($cate_result === false) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         $cate_result = array();
         foreach ($cate_list as $k => $v) {
             $cate_result[$v['id']] = $v;
         }
         set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $page_size = DEAL_PAGE_SIZE;
     $step_size = DEAL_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $deal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_effect = 1 and is_recommend = 1 and is_delete = 0 order by sort asc limit " . $limit);
     //$deal_count = $GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."deal where is_effect = 1 and is_recommend = 1 and is_delete = 0");
     foreach ($deal_list as $k => $v) {
         $deal_list[$k]['remain_days'] = floor(($v['end_time'] - NOW_TIME) / (24 * 3600));
         $deal_list[$k]['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
     }
     $GLOBALS['tmpl']->assign("deal_list", $deal_list);
     //add by fjl begin
     //热门项目
     //add by fjl end
     //$page = new Page($deal_count,$page_size);   //初始化分页对象
     //$p  =  $page->show();
     //$GLOBALS['tmpl']->assign('pages',$p);
     $GLOBALS['tmpl']->display("index.html");
 }
开发者ID:bharatthakkar,项目名称:stock-crowd-funding-system,代码行数:45,代码来源:indexModule.class.php

示例4: index

 public function index()
 {
     $GLOBALS['tmpl']->assign("page_title", "最新动态");
     $param = array();
     //参数集合
     //数据来源参数
     $r = strim($_REQUEST['r']);
     //推荐类型
     $param['r'] = $r ? $r : '';
     $GLOBALS['tmpl']->assign("p_r", $r);
     $id = intval($_REQUEST['id']);
     //分类id
     $param['id'] = $id;
     $GLOBALS['tmpl']->assign("p_id", $id);
     $loc = strim($_REQUEST['loc']);
     //地区
     $param['loc'] = $loc;
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $state = intval($_REQUEST['state']);
     //状态
     $param['state'] = $state;
     $GLOBALS['tmpl']->assign("p_state", $state);
     $tag = strim($_REQUEST['tag']);
     //标签
     $param['tag'] = $tag;
     $GLOBALS['tmpl']->assign("p_tag", $tag);
     $kw = strim($_REQUEST['k']);
     //关键词
     $param['k'] = $kw;
     $GLOBALS['tmpl']->assign("p_k", $kw);
     $type = intval($_REQUEST['type']);
     //推荐类型
     $param['type'] = $type;
     $GLOBALS['tmpl']->assign("p_type", $type);
     if (intval($_REQUEST['redirect']) == 1) {
         $param = array();
         if ($r != "") {
             $param = array_merge($param, array("r" => $r));
         }
         if ($id > 0) {
             $param = array_merge($param, array("id" => $id));
         }
         if ($loc != "") {
             $param = array_merge($param, array("loc" => $loc));
         }
         if ($state != "") {
             $param = array_merge($param, array("state" => $state));
         }
         if ($tag != "") {
             $param = array_merge($param, array("tag" => $tag));
         }
         if ($kw != "") {
             $param = array_merge($param, array("k" => $kw));
         }
         if ($type != "") {
             $param = array_merge($param, array("type" => $type));
         }
         app_redirect(url_wap("deals", $param));
     }
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_list = load_dynamic_cache("INDEX_CATE_LIST");
     if (!$cate_list) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
     }
     $cate_result = array();
     foreach ($cate_list as $k => $v) {
         if ($v['pid'] == 0) {
             $temp_param = $param;
             $cate_result[$v['id']]['id'] = $v['id'];
             $cate_result[$v['id']]['name'] = $v['name'];
             $temp_param['id'] = $v['id'];
             $cate_result[$v['id']]['url'] = url_wap("deals", $temp_param);
         } else {
             if ($v['pid'] > 0) {
                 $temp_param['id'] = $v['id'];
                 $cate_result[$v['pid']]['child'][] = array('id' => $v['id'], 'name' => $v['name'], 'url' => url_wap("deals", $temp_param));
             }
         }
         if ($v['id'] == $id) {
             $GLOBALS['tmpl']->assign("cate_name", $v['name']);
         }
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $pid = $id;
     //获取父类id
     if ($cate_list) {
         $pid = $this->get_child($cate_list, $pid);
     }
     /*子分类 start*/
     $cate_ids = array();
     $is_child = false;
     $temp_cate_ids = array();
     if ($cate_list) {
         $child_cate_result = array();
//.........这里部分代码省略.........
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:101,代码来源:deals.action.php

示例5: url_mapi_html

/**
 * 链接到mapi/html
 */
function url_mapi_html($route = "index", $param = array())
{
    $key = md5("URL_MAPI_HTML_KEY_" . $route . serialize($param));
    if (isset($GLOBALS[$key])) {
        $url = $GLOBALS[$key];
        return $url;
    }
    $url = load_dynamic_cache($key);
    if ($url !== false) {
        $GLOBALS[$key] = $url;
        return $url;
    }
    $route_array = explode("#", $route);
    if (isset($param) && $param != '' && !is_array($param)) {
        $param['id'] = $param;
    }
    $module = strtolower(trim($route_array[0]));
    $action = strtolower(trim($route_array[1]));
    if (!$module || $module == 'index') {
        $module = "";
    }
    if (!$action || $action == 'index') {
        $action = "";
    }
    //原始模式
    $html_app_root = str_replace('/mapi/html', "", APP_ROOT);
    $html_app_root = str_replace('/mapi', "", APP_ROOT);
    $url = $html_app_root . "/mapi/html/index.php";
    if ($module != '' || $action != '' || count($param) > 0) {
        $url .= "?";
    }
    if ($module && $module != '') {
        $url .= "ctl=" . $module . "&";
    }
    if ($action && $action != '') {
        $url .= "act=" . $action . "&";
    }
    if (count($param) > 0) {
        foreach ($param as $k => $v) {
            if ($k && $v) {
                $url = $url . $k . "=" . urlencode($v) . "&";
            }
        }
    }
    if (substr($url, -1, 1) == '&' || substr($url, -1, 1) == '?') {
        $url = substr($url, 0, -1);
    }
    $GLOBALS[$key] = $url;
    set_dynamic_cache($key, $url);
    return $url;
}
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:54,代码来源:functions.php

示例6: index

 public function index()
 {
     get_mortgate();
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME);
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete=0 order by sort asc");
     $cate_result = array();
     foreach ($cate_list as $k => $v) {
         $cate_result[$v['id']] = $v;
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     send_deal_success_1();
     send_deal_fail_1();
     //===============首页项目列表START===================
     $page_size = 5;
     $limit = "0,5";
     $GLOBALS['tmpl']->assign("current_page", 1);
     $deal_result = get_deal_list($limit, 'is_recommend=1');
     $GLOBALS['tmpl']->assign("deal_list", $deal_result['list']);
     $deal_invest_result = get_deal_list($limit, '');
     $GLOBALS['tmpl']->assign("deal_list_invest", $deal_invest_result['list']);
     $shu = $GLOBALS['db']->getAll("select count(*) from " . DB_PREFIX . "deal where is_recommend=1 and type=0");
     $shu = $shu[0]['count(*)'];
     $GLOBALS['tmpl']->assign("shu", $shu);
     $all_shu = $GLOBALS['db']->getAll("select count(*) from " . DB_PREFIX . "deal where type=0");
     $all_shu = $all_shu[0]['count(*)'];
     $GLOBALS['tmpl']->assign("all_shu", $all_shu);
     //===============首页项目列表END===================
     //links
     $g_links = get_link_by_id();
     /*虚拟的累计项目总个数,支持总人数,项目支持总金额*/
     if (app_conf("INVEST_STATUS") == 0) {
         $condition = " and 1=1 ";
     } elseif (app_conf("INVEST_STATUS") == 1) {
         $condition = " and type=0 ";
     } elseif (app_conf("INVEST_STATUS") == 2) {
         $condition = " and type=1 ";
     }
     $virtual_effect = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
     $virtual_person = $GLOBALS['db']->getOne("select sum((support_count+virtual_num)) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
     $virtual_money = $GLOBALS['db']->getOne("select sum(support_amount+virtual_price) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
     $zhuce_num = $GLOBALS['db']->getOne("select count(*) as num from " . DB_PREFIX . "user where is_effect = 1");
     $GLOBALS['tmpl']->assign("zhuce_num", $zhuce_num);
     $virtual_effect = floor($virtual_effect * 2.3);
     $GLOBALS['tmpl']->assign("virtual_effect", $virtual_effect);
     //项目总个数
     $virtual_person = floor($virtual_person * 2.7);
     $GLOBALS['tmpl']->assign("virtual_person", $virtual_person);
     //累计支持人
     //$virtual_money = floor($virtual_money*2.1);
     $GLOBALS['tmpl']->assign("virtual_money", number_format($virtual_money, 2));
     //筹资总金额
     /*虚拟的累计项目总个数,支持总人数,项目支持总金额 结束*/
     //首页TAB选项卡
     if (app_conf("INVEST_STATUS") == 0) {
         $condition = " d.is_delete = 0 and d.is_effect = 1 ";
     } elseif (app_conf("INVEST_STATUS") == 1) {
         $condition = " d.is_delete = 0 and d.is_effect = 1 and d.type=0 ";
     } elseif (app_conf("INVEST_STATUS") == 2) {
         $condition = " d.is_delete = 0 and d.is_effect = 1 and d.type=1 ";
     }
     if ($GLOBALS['user_info']['user_level'] != 0) {
         $level = $GLOBALS['db']->getOne("SELECT level from " . DB_PREFIX . "user_level where id=" . $GLOBALS['user_info']['user_level']);
         $condition .= " AND (d.user_level ='' or d.user_level=0 or d.user_level <={$level})   ";
     } else {
         $condition .= " AND (d.user_level =0 or d.user_level =1 or d.user_level ='') AND d.is_recommend='1'";
     }
     //最后发起的项目,如果被设置为推荐,被选项卡显示
     $deal_cate_array = $GLOBALS['db']->getAll("select d.* from (select * from " . DB_PREFIX . "deal order by sort asc)  as d left join " . DB_PREFIX . "deal_cate as dc on dc.id=d.cate_id where {$condition} group by d.cate_id order by dc.sort asc ");
     $deal_cate = array();
     $now_time = NOW_TIME;
     foreach ($deal_cate_array as $k => $v) {
         if ($v['id'] > 0) {
             $v['cate_name'] = $cate_result[$v['cate_id']]['name'];
             $v['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
             $v['num_days'] = ceil(($v['end_time'] - $v['begin_time']) / (24 * 3600));
             $v['remain_days'] = ceil(($v['end_time'] - $now_time) / (24 * 3600));
             if ($v['begin_time'] > $now_time) {
                 $v['left_days'] = intval(($now_time - $v['create_time']) / 24 / 3600);
             }
             $v['num_days'] = ceil(($v['end_time'] - $v['begin_time']) / (24 * 3600));
             $deal_ids[] = $v['id'];
             $deal_cate[$v['id']] = $v;
         }
     }
     //将获取到的虚拟人数和虚拟价格拿到项目列表里面进行统计
     foreach ($deal_cate as $k => $v) {
         if ($v['type'] == 1) {
             $deal_cate[$k]['virtual_person'] = $deal_cate[$k]['invote_num'];
             $deal_cate[$k]['support_count'] = $deal_cate[$k]['invote_num'];
             $deal_cate[$k]['support_amount'] = $deal_cate[$k]['invote_money'];
             $deal_cate[$k]['percent'] = round($deal_cate[$k]['support_amount'] / $v['limit_price'] * 100);
         } else {
             $deal_cate[$k]['virtual_person'] = $deal_cate[$k]['virtual_num'];
//.........这里部分代码省略.........
开发者ID:xinlechou,项目名称:app,代码行数:101,代码来源:indexModule.class.php

示例7: define

} else {
    define('PAGE_SIZE', intval($m_config['page_size']));
    //分页的常量
}
$GLOBALS['tmpl']->assign("site_name", $m_config['program_title'] ? $m_config['program_title'] : app_conf("SITE_NAME"));
$GLOBALS['tmpl']->assign("site_logo", $m_config['logo'] ? $m_config['logo'] : app_conf("SITE_LOGO"));
$class = strtolower(strim($_REQUEST['ctl'])) ? strtolower(strim($_REQUEST['ctl'])) : "index";
$act2 = strtolower(strim($_REQUEST['act'])) ? strtolower(strim($_REQUEST['act'])) : "index";
$city_id = intval($request['city_id']);
define('ACT', $class);
//act常量
define('ACT_2', $act2);
$GLOBALS['tmpl']->assign("class", $class);
$GLOBALS['tmpl']->assign("act", $act2);
get_pre_wap();
$cate_list = load_dynamic_cache("INDEX_CATE_LIST");
if (!$cate_list) {
    $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
    set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
}
$is_weixin = isWeixin();
$GLOBALS['tmpl']->assign("is_weixin", $is_weixin);
$GLOBALS['tmpl']->assign("cate_list", $cate_list);
if ($_REQUEST['code'] && $_REQUEST['state'] == 1 && $m_config['wx_appid'] && $m_config['wx_secrit'] && !$user_info) {
    //file_put_contents('./t.txt',var_export($_REQUEST,TRUE)."\n",FILE_APPEND);
    //require '../system/utils/weixin.php';
    $weixin = new weixin($m_config['wx_appid'], $m_config['wx_secrit'], get_domain() . APP_ROOT . "/wap");
    $wx_info = $weixin->scope_get_userinfo($_REQUEST['code']);
    if ($wx_info['openid']) {
        $wx_user_info = get_user_has('wx_openid', $wx_info['openid']);
        if ($wx_user_info) {
开发者ID:xinlechou,项目名称:wap,代码行数:31,代码来源:index.php

示例8: url_wap

function url_wap($route = "index", $param = array())
{
    $key = md5("URL_KEY_" . $route . serialize($param));
    if (isset($GLOBALS[$key])) {
        $url = $GLOBALS[$key];
        return $url;
    }
    $url = load_dynamic_cache($key);
    if ($url !== false) {
        $GLOBALS[$key] = $url;
        return $url;
    }
    $route_array = explode("#", $route);
    if (isset($param) && $param != '' && !is_array($param)) {
        $param['id'] = $param;
    }
    $module = strtolower(trim($route_array[0]));
    $action = strtolower(trim($route_array[1]));
    if (!$module || $module == 'index') {
        $module = "";
    }
    if (!$action || $action == 'index') {
        $action = "";
    }
    if (true) {
        //原始模式
        $url = APP_ROOT . "/wap/index.php";
        if ($module != '' || $action != '' || count($param) > 0) {
            $url .= "?";
        }
        if ($module && $module != '') {
            $url .= "ctl=" . $module . "&";
        }
        if ($action && $action != '') {
            $url .= "act=" . $action . "&";
        }
        if (count($param) > 0) {
            foreach ($param as $k => $v) {
                if ($k && $v) {
                    $url = $url . $k . "=" . urlencode($v) . "&";
                }
            }
        }
        if (substr($url, -1, 1) == '&' || substr($url, -1, 1) == '?') {
            $url = substr($url, 0, -1);
        }
        $GLOBALS[$key] = $url;
        set_dynamic_cache($key, $url);
        return $url;
    } else {
        //重写的默认
        $url = APP_ROOT . "/wap";
        if ($module && $module != '') {
            $url .= "/" . $module;
        }
        if ($action && $action != '') {
            $url .= "-" . $action;
        }
        if (count($param) > 0) {
            $url .= "/";
            foreach ($param as $k => $v) {
                $url = $url . $k . "-" . urlencode($v) . "-";
            }
        }
        $route = $module . "#" . $action;
        switch ($route) {
            case "xxx":
                break;
            default:
                break;
        }
        if (substr($url, -1, 1) == '/' || substr($url, -1, 1) == '-') {
            $url = substr($url, 0, -1);
        }
        if ($url == '') {
            $url = "/";
        }
        $GLOBALS[$key] = $url;
        set_dynamic_cache($key, $url);
        return $url;
    }
}
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:82,代码来源:functions.php

示例9: search


//.........这里部分代码省略.........
     }
     $condition = " 1=1 ";
     if ($type == 0) {
         //所有分享
         $condition .= "";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_ALL'];
     } elseif ($type == 1) {
         $condition .= " and (t.type='tuancomment' or t.type='shopcomment' or t.type='youhuicomment' ) ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_DEAL'];
     } elseif ($type == 2) {
         $condition .= " and t.type='slocationcomment' ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_STORE'];
     } elseif ($type == 3) {
         $condition .= " and t.title like '" . $keyword . "' ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_RECOMMEND'];
     }
     if ($filter == 0) {
         //全部
         //$search_title.= " - ".$GLOBALS['lang']['TOPIC_FILTER_ALL'];
     } elseif ($filter == 1) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MYFOCUS'];
         $condition .= " and uf.focus_user_id =  " . intval($GLOBALS['user_info']['id']);
     } elseif ($filter == 2) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_DAREN'];
         $condition .= " and u.is_daren = 1 ";
     } elseif ($filter == 3) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MERCHANT'];
         $condition .= " and u.is_merchant = 1 ";
     }
     if ($keyword) {
         $search_title .= " - " . $keyword;
         $kws_div = div_str($keyword);
         foreach ($kws_div as $k => $item) {
             $kw[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kw);
         $condition .= " and match(t.keyword_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) ";
     }
     $GLOBALS['tmpl']->assign("kws_div", $kws_div);
     $GLOBALS['tmpl']->assign("page_title", $search_title);
     $GLOBALS['tmpl']->assign("page_keyword", $search_title . ",");
     $GLOBALS['tmpl']->assign("page_description", $search_title . ",");
     //分页
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     //		$result = get_topic_list($limit,$condition,"",$kws_div);
     $orderby = 't.create_time desc';
     $condition = " and " . $condition;
     $list = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0 " . $condition . " group by t.id order by " . $orderby . " limit " . $limit);
     $total = $GLOBALS['db']->getOne("select count(distinct(t.id)) from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0  " . $condition);
     foreach ($list as $k => $v) {
         $list[$k] = get_topic_item($v, $kws_div);
         if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['content'])) {
             $list[$k]['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50);
         } else {
             $list[$k]['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['content']);
         }
         if ($list[$k]['origin']) {
             if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content'])) {
                 $list[$k]['origin']['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50);
             } else {
                 $list[$k]['origin']['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['origin']['content']);
             }
         }
     }
     $result = array('list' => $list, 'total' => $total);
     if ($result['total'] > 0) {
         if (check_ipop_limit(get_client_ip(), "topic_search", 10, $keyword)) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "topic_tag set count = count + 1 where name = '" . $keyword . "'");
         }
     }
     //$result['list'] = div_to_col($result['list']);
     $GLOBALS['tmpl']->assign("topic_list", $result['list']);
     $page = new Page($result['total'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $list_html = load_topic_list();
     //$list_html = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/topic_col_list.html"));
     $GLOBALS['tmpl']->assign("list_html", $list_html);
     $GLOBALS['tmpl']->assign("type_navs", $type_navs);
     $GLOBALS['tmpl']->assign("filter_navs", $filter_navs);
     $res = load_dynamic_cache("topic_search_hot");
     if ($res === false) {
         $res['hot_tag_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc, count desc limit 10");
         $res['hot_title_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_title where is_recommend = 1 order by sort desc,count desc limit 10");
         set_dynamic_cache("topic_search_hot", $res);
     }
     //输出搜索热词
     $GLOBALS['tmpl']->assign("hot_tag_list", $res['hot_tag_list']);
     $GLOBALS['tmpl']->assign("hot_title_list", $res['hot_title_list']);
     //输出推荐分享
     $recommend_topic = load_auto_cache("recommend_uc_topic");
     $GLOBALS['tmpl']->assign("recommend_topic", $recommend_topic);
     $GLOBALS['tmpl']->display("topic_search.html");
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:topicModule.class.php

示例10: set_uc_right

function set_uc_right()
{
    //获取可以相关的用户
    $user_id = intval($GLOBALS['user_info']['id']);
    $user_list = get_rand_user(5, 0, $user_id);
    $GLOBALS['tmpl']->assign("user_list", $user_list);
    //输出粉丝
    $fans_list = $GLOBALS['db']->getAll("select focus_user_id as id,focus_user_name as user_name from " . DB_PREFIX . "user_focus where focused_user_id = " . $user_id . " limit 5");
    $ids = array(0);
    foreach ($fans_list as $k => $v) {
        $ids[] = $v['id'];
    }
    $focus_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id in (" . implode(",", $ids) . ")");
    foreach ($fans_list as $k => $v) {
        foreach ($focus_data as $kk => $vv) {
            if ($vv['focused_user_id'] == $v['id']) {
                $fans_list[$k]['focused'] = 1;
                break;
            }
        }
    }
    $GLOBALS['tmpl']->assign("fans_list", $fans_list);
    //输出我的关注
    $focus_list = $GLOBALS['db']->getAll("select focused_user_id as id,focused_user_name as user_name from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " limit 5");
    $ids = array(0);
    foreach ($focus_list as $k => $v) {
        $ids[] = $v['id'];
    }
    $focus_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id in (" . implode(",", $ids) . ")");
    foreach ($focus_list as $k => $v) {
        foreach ($focus_data as $kk => $vv) {
            if ($vv['focused_user_id'] == $v['id']) {
                $focus_list[$k]['focused'] = 1;
                break;
            }
        }
    }
    $GLOBALS['tmpl']->assign("focus_list", $focus_list);
    $res = load_dynamic_cache("topic_search_hot");
    if ($res === false) {
        $res['hot_tag_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc, count desc limit 10");
        $res['hot_title_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_title where is_recommend = 1 order by sort desc,count desc limit 10");
        set_dynamic_cache("topic_search_hot", $res);
    }
    //输出搜索热词
    $GLOBALS['tmpl']->assign("hot_tag_list", $res['hot_tag_list']);
    $GLOBALS['tmpl']->assign("hot_title_list", $res['hot_title_list']);
    //输出推荐分享
    $recommend_topic = load_auto_cache("recommend_uc_topic");
    $GLOBALS['tmpl']->assign("recommend_topic", $recommend_topic);
    $GLOBALS['tmpl']->assign("has_right", 1);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:52,代码来源:uc.php

示例11: get_user_name

function get_user_name($id, $show_tag = true)
{
    $key = md5("USER_NAME_LINK_" . $id);
    if (isset($GLOBALS[$key])) {
        return $GLOBALS[$key];
    } else {
        $uname = load_dynamic_cache($key);
        if ($uname === false) {
            $u = $GLOBALS['db']->getRow("select id,user_name,is_merchant,is_daren,daren_title from " . DB_PREFIX . "user where id = " . intval($id));
            $uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "'  class='user_name'  onmouseover='userCard.load(this,\"" . $u['id'] . "\");' >" . $u['user_name'] . "</a>";
            if ($show_tag) {
                $uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "' onmouseover='userCard.load(this,\"" . $u['id'] . "\");'>" . msubstr($u['user_name'], 0, 5) . "</a>";
                if ($u['is_merchant']) {
                    $uname = $uname . "<font class='is_merchant' title='认证商家'></font>";
                }
                if ($u['is_daren']) {
                    $uname = $uname . "<font class='is_daren' title='" . $u['daren_title'] . "'></font>";
                }
            } else {
                $uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "' onmouseover='userCard.load(this,\"" . $u['id'] . "\");'>" . $u['user_name'] . "</a>";
            }
            set_dynamic_cache($key, $uname);
        }
        $GLOBALS[$key] = $uname;
        return $GLOBALS[$key];
    }
}
开发者ID:macall,项目名称:jsd,代码行数:27,代码来源:main_lib.php

示例12: index_left_daijin

 public function index_left_daijin()
 {
     $result = search_youhui_list(0, 0, " d.is_recommend = 1 ", "", false, "", $GLOBALS['deal_city']['id']);
     $daijin_list = $result['list'];
     $GLOBALS['tmpl']->assign("daijin_list", $daijin_list);
     $bcate_list = load_dynamic_cache("INDEX_RECOMMEND_BCATE");
     $GLOBALS['tmpl']->assign("bcate_list", $bcate_list);
     return $GLOBALS['tmpl']->fetch("index/index_left_daijin.html");
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:9,代码来源:indexModule.class.php

示例13: invester_list

 public function invester_list($from = 'wap')
 {
     $g_links = get_link_by_id(14);
     $GLOBALS['tmpl']->assign("g_links", $g_links);
     $GLOBALS['tmpl']->assign("page_title", "天使投资人列表");
     $param = array();
     //参数集合
     //数据来源参数
     $r = strim($_REQUEST['r']);
     //投资人类型
     $param['r'] = $r ? $r : '';
     $GLOBALS['tmpl']->assign("p_r", $r);
     $loc = strim($_REQUEST['loc']);
     //地区
     $param['loc'] = $loc;
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $city = strim($_REQUEST['city']);
     //地区
     $param['city'] = $city;
     $GLOBALS['tmpl']->assign("p_city", $city);
     if (intval($_REQUEST['redirect']) == 1) {
         $param = array();
         if ($r != "") {
             $param = array_merge($param, array("r" => $r));
         }
         if ($loc != "") {
             $param = array_merge($param, array("loc" => $loc));
         }
         if ($city != "") {
             $param = array_merge($param, array("city" => $city));
         }
     }
     $city_list = load_dynamic_cache("INDEX_CITY_LIST");
     if (!$city_list) {
         $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "user group by province order by create_time desc");
         set_dynamic_cache("INDEX_CITY_LIST", $city_list);
     }
     foreach ($city_list as $k => $v) {
         $temp_param = $param;
         unset($temp_param['city']);
         $temp_param['loc'] = $v['province'];
         if ($from == 'web') {
             $city_list[$k]['url'] = url("investor#invester_list", $temp_param);
         } elseif ($from == 'wap') {
             $city_list[$k]['url'] = url_wap("investor#invester_list", $temp_param);
         }
     }
     $GLOBALS['tmpl']->assign("city_list", $city_list);
     $next_pid = 0;
     $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc");
     //二级地址
     foreach ($region_lv2 as $k => $v) {
         $temp_param = $param;
         unset($temp_param['city']);
         $temp_param['loc'] = $v['name'];
         if ($from == 'web') {
             $region_lv2[$k]['url'] = url("investor#invester_list", $temp_param);
         } elseif ($from == 'wap') {
             $region_lv2[$k]['url'] = url_wap("investor#invester_list", $temp_param);
         }
         if ($loc == $v['name']) {
             $next_pid = $v['id'];
         }
     }
     $GLOBALS['tmpl']->assign("region_lv2", $region_lv2);
     if ($next_pid > 0) {
         $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 3 and `pid`='" . $next_pid . "' order by py asc");
         //二级地址
         foreach ($region_lv3 as $k => $v) {
             $temp_param = $param;
             $temp_param['city'] = $v['name'];
             if ($from == 'web') {
                 $region_lv3[$k]['url'] = url("investor#invester_list", $temp_param);
             } elseif ($from == 'wap') {
                 $region_lv3[$k]['url'] = url_wap("investor#invester_list", $temp_param);
             }
         }
         $GLOBALS['tmpl']->assign("region_lv3", $region_lv3);
     }
     //	print_r($region_lv2);exit;
     $page_size = 20;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = "is_effect = 1 ";
     if ($r != "") {
         if ($r == "ordinary_user") {
             $condition .= " and is_investor = 0 ";
             $GLOBALS['tmpl']->assign("page_title", "普通用户");
         }
         if ($r == "invester") {
             $condition .= " and is_investor = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "投资人");
         }
         if ($r == "institutions_invester") {
             $condition .= " and is_investor = 2 ";
             $GLOBALS['tmpl']->assign("page_title", "机构投资人");
//.........这里部分代码省略.........
开发者ID:xinlechou,项目名称:wap,代码行数:101,代码来源:investor.action.php

示例14: url

function url($app_index, $route = "index", $param = array())
{
    $key = md5("URL_KEY_" . $app_index . $route . serialize($param));
    if ($GLOBALS['request']['from'] != "wap") {
        if (isset($GLOBALS[$key])) {
            $url = $GLOBALS[$key];
            return $url;
        }
        $url = load_dynamic_cache($key);
        if ($url !== false) {
            $GLOBALS[$key] = $url;
            return $url;
        }
    }
    $route_array = explode("#", $route);
    if (isset($param) && $param != '' && !is_array($param)) {
        $param['id'] = $param;
    }
    $module = strtolower(trim($route_array[0]));
    $action = strtolower(trim($route_array[1]));
    if (!$module || $module == 'index') {
        $module = "";
    }
    if (!$action || $action == 'index') {
        $action = "";
    }
    if (app_conf("URL_MODEL") == 0 || $GLOBALS['request']['from'] == "wap") {
        //过滤主要的应用url
        if ($app_index == app_conf("MAIN_APP")) {
            $app_index = "index";
        }
        //原始模式
        $url = APP_ROOT . "/" . $app_index . ".php";
        if ($module != '' || $action != '' || count($param) > 0) {
            $url .= "?";
        }
        if ($module && $module != '') {
            $url .= "ctl=" . $module . "&";
        }
        if ($action && $action != '') {
            $url .= "act=" . $action . "&";
        }
        if (count($param) > 0) {
            foreach ($param as $k => $v) {
                if ($k && $v) {
                    $url = $url . $k . "=" . urlencode($v) . "&";
                }
            }
        }
        if (substr($url, -1, 1) == '&' || substr($url, -1, 1) == '?') {
            $url = substr($url, 0, -1);
        }
        if ($GLOBALS['request']['from'] != "wap") {
            $GLOBALS[$key] = $url;
            set_dynamic_cache($key, $url);
        }
        return $url;
    } else {
        //重写的默认
        $url = APP_ROOT;
        if ($app_index != 'index') {
            $url .= "/" . $app_index;
        }
        if ($module && $module != '') {
            $url .= "/" . $module;
        }
        if ($action && $action != '') {
            $url .= "-" . $action;
        }
        if (count($param) > 0) {
            $url .= "/";
            foreach ($param as $k => $v) {
                $url = $url . $k . "-" . urlencode($v) . "-";
            }
        }
        //过滤主要的应用url
        if ($app_index == app_conf("MAIN_APP")) {
            $url = str_replace("/" . app_conf("MAIN_APP"), "", $url);
        }
        $route = $module . "#" . $action;
        switch ($route) {
            case "xxx":
                break;
            default:
                break;
        }
        if (substr($url, -1, 1) == '/' || substr($url, -1, 1) == '-') {
            $url = substr($url, 0, -1);
        }
        if ($url == '') {
            $url = "/";
        }
        $GLOBALS[$key] = $url;
        set_dynamic_cache($key, $url);
        return $url;
    }
}
开发者ID:neteasy-work,项目名称:fanwei_xindai_3.2,代码行数:97,代码来源:common.php

示例15: index

 public function index()
 {
     $r = strim($_REQUEST['r']);
     //推荐类型
     $GLOBALS['tmpl']->assign("p_r", $r);
     $id = intval($_REQUEST['id']);
     //分类id
     $GLOBALS['tmpl']->assign("p_id", $id);
     $loc = strim($_REQUEST['loc']);
     //地区
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $tag = strim($_REQUEST['tag']);
     //标签
     $GLOBALS['tmpl']->assign("p_tag", $tag);
     $kw = strim($_REQUEST['k']);
     //关键词
     $GLOBALS['tmpl']->assign("p_k", $kw);
     if (intval($_REQUEST['redirect']) == 1) {
         $param = array();
         if ($r != "") {
             $param = array_merge($param, array("r" => $r));
         }
         if ($id > 0) {
             $param = array_merge($param, array("id" => $id));
         }
         if ($loc != "") {
             $param = array_merge($param, array("loc" => $loc));
         }
         if ($tag != "") {
             $param = array_merge($param, array("tag" => $tag));
         }
         if ($kw != "") {
             $param = array_merge($param, array("k" => $kw));
         }
         app_redirect(url("deals", $param));
     }
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_result = load_dynamic_cache("INDEX_CATE_LIST");
     if ($cate_result === false) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         $cate_result = array();
         foreach ($cate_list as $k => $v) {
             $cate_result[$v['id']] = $v;
         }
         set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $page_size = DEAL_PAGE_SIZE;
     $step_size = DEAL_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = " is_delete = 0 and is_effect = 1 ";
     if ($r != "") {
         if ($r == "new") {
             $condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time > 0 ";
             //上线不超过一天
             $GLOBALS['tmpl']->assign("page_title", "最新上线");
         }
         if ($r == "nend") {
             $condition .= " and end_time - " . NOW_TIME . " < " . 24 * 3600 . " and end_time - " . NOW_TIME . " > 0 ";
             //当天就要结束
             $GLOBALS['tmpl']->assign("page_title", "即将结束");
         }
         if ($r == "classic") {
             $condition .= " and is_classic = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "经典项目");
         }
     }
     if ($id > 0) {
         $condition .= " and cate_id = " . $id;
         $GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']);
     }
     if ($loc != "") {
         $condition .= " and (province = '" . $loc . "' or city = '" . $loc . "') ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($tag != "") {
         $unicode_tag = str_to_unicode_string($tag);
         $condition .= " and match(tags_match) against('" . $unicode_tag . "'  IN BOOLEAN MODE) ";
         $GLOBALS['tmpl']->assign("page_title", $tag);
     }
     if ($kw != "") {
         $kws_div = div_str($kw);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
//.........这里部分代码省略.........
开发者ID:xcdxcd,项目名称:zhongchou,代码行数:101,代码来源:dealsModule.class.php


注:本文中的load_dynamic_cache函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。