コード例 #1
0
ファイル: daren.module.php プロジェクト: dalinhuang/concourse
    public function all()
    {
        global $_FANWE;
        $is_best = false;
        $is_all = true;
        $_FANWE['nav_title'] = lang('common', 'daren');
        $count = FDB::resultFirst('SELECT COUNT(uid) FROM ' . FDB::table('user_daren') . ' WHERE status = 1');
        $pager = buildPage('daren/all', array(), $count, $_FANWE['page'], 18);
        $col = 3;
        $index = 0;
        $list = array();
        $today_time = getTodayTime();
        $sql = 'SELECT ud.*,u.user_name,u.server_code,uc.fans,uc.goods,uc.shares,
			up.reside_province,up.reside_city,up.introduce 
			FROM ' . FDB::table('user_daren') . ' AS ud 
			INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = ud.uid 
			INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = u.uid 
			INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = ud.uid 
			WHERE ud.status = 1 
			ORDER BY ud.day_time DESC,ud.id DESC LIMIT ' . $pager['limit'];
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $data['today_best'] = false;
            $data['url'] = FU('u/index', array('uid' => $data['uid']));
            $province = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name'];
            $city = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name'];
            $data['city'] = $province . ' ' . $city;
            $list[$index % $col][] = $data;
            $index++;
        }
        include template('page/daren');
        display();
    }
コード例 #2
0
ファイル: plugin.php プロジェクト: kaaleth/bludit
 private function getPage($key)
 {
     // Generate the object Page
     $Page = buildPage($key);
     if (!$Page) {
         return json_encode(array('status' => '0', 'bludit' => 'Bludit API plugin', 'message' => 'The page doesn\'t exist'));
     }
     return $Page->json();
 }
コード例 #3
0
 public function target()
 {
     define("ACTION_NAME", "target");
     if (intval($GLOBALS['fanwe']->var['uid']) == 0) {
         fHeader("location: " . FU('user/login'));
     }
     global $_FANWE;
     $sql = "select f.f_uid as uid,u.user_name from " . FDB::table("user_follow") . " as f left join " . FDB::table("user") . " as u on f.f_uid = u.uid where f.uid = " . intval($GLOBALS['fanwe']->var['uid']);
     $sql_count = "select count(f.f_uid) from " . FDB::table("user_follow") . " as f left join " . FDB::table("user") . " as u on f.f_uid = u.uid where f.uid = " . intval($GLOBALS['fanwe']->var['uid']);
     $page_size = 21;
     $count = FDB::resultFirst($sql_count);
     $pager = buildPage('message/target', array(), $count, $_FANWE['page'], $page_size);
     $sql = $sql . " limit " . $pager['limit'];
     $follow_user = FDB::fetchAll($sql);
     include template('page/message_target');
     display();
 }
コード例 #4
0
ファイル: shop.module.php プロジェクト: dalinhuang/concourse
    public function show()
    {
        global $_FANWE;
        $id = (int) $_FANWE['request']['id'];
        if (!$id) {
            exit;
        }
        $shop = FDB::fetchFirst('SELECT * FROM ' . FDB::table('shop') . ' WHERE shop_id = ' . $id);
        if (!$shop) {
            fHeader("location: " . FU('shop/index'));
        }
        $_FANWE['nav_title'] = $shop['shop_name'] . ' - ' . $_FANWE['nav_title'];
        $cache_data = fStripslashes(unserialize($shop['data']));
        $shop['tags'] = $cache_data['tags'];
        if (empty($shop['taoke_url'])) {
            $shop['to_url'] = FU('tgo', array('url' => $shop['shop_url']));
        } else {
            $shop['to_url'] = FU('tgo', array('url' => $shop['taoke_url']));
        }
        $page_args['id'] = $id;
        $sql = 'SELECT COUNT(DISTINCT sg.share_id) FROM ' . FDB::table('share_goods') . ' AS sg 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id 
			WHERE s.status = 1 AND sg.shop_id = ' . $id;
        $share_count = FDB::resultFirst($sql);
        $page_size = 20;
        $pager = buildPage('shop/show', $page_args, $share_count, $_FANWE['page'], $page_size);
        $share_ids = array();
        $sql = 'SELECT DISTINCT sg.share_id FROM ' . FDB::table('share_goods') . ' AS sg 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id 
			WHERE s.status = 1 AND sg.shop_id = ' . $id . ' ORDER BY sg.share_id DESC LIMIT ' . $pager['limit'];
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $share_ids[] = $data['share_id'];
        }
        $share_list = array();
        if (count($share_ids) > 0) {
            $share_ids = implode(',', $share_ids);
            $sql = 'SELECT * FROM ' . FDB::table('share') . ' WHERE share_id IN (' . $share_ids . ') ORDER BY share_id DESC';
            $share_list = FDB::fetchAll($sql);
            $share_list = FS('Share')->getShareDetailList($share_list, false, true, true, false, 0, 10);
        }
        $shops_tags = FS('Shop')->getUserOtherShopAndTags($id);
        include template('page/shop/shop_show');
        display();
    }
コード例 #5
0
ファイル: 71.pages.php プロジェクト: michaelctorres/bludit
function buildAllPages()
{
    global $pagesParents;
    global $dbPages;
    $list = $dbPages->getDB();
    // Clean pages array.
    $pages = array();
    unset($list['error']);
    foreach ($list as $key => $db) {
        $Page = buildPage($key);
        if ($Page !== false) {
            // --- Order pages by parents ---
            // Generate all posible parents.
            if ($Page->parentKey() === false) {
                // Add the parent key in the dbPages
                $dbPages->addParentKey($Page->key());
                $pagesParents[NO_PARENT_CHAR][$Page->key()] = $Page;
            } else {
                $pagesParents[$Page->parentKey()][$Page->key()] = $Page;
            }
            // --- All pages in 1 array ---
            $pages[$Page->key()] = $Page;
        }
    }
    // --- SORT PAGES ---
    // Sort parents.
    $parents = $pagesParents[NO_PARENT_CHAR];
    uasort($parents, 'sortPages');
    // Sort children.
    unset($pagesParents[NO_PARENT_CHAR]);
    $children = $pagesParents;
    $tmpPageWithParent = array();
    foreach ($children as $parentKey => $childrenPages) {
        // If the child doesn't have a valid parent, then doesn't included them.
        if (isset($pages[$parentKey])) {
            $tmpPageWithParent[$parentKey] = $childrenPages;
            uasort($tmpPageWithParent[$parentKey], 'sortPages');
        }
    }
    $pagesParents = array(NO_PARENT_CHAR => $parents) + $tmpPageWithParent;
    return $pages;
}
コード例 #6
0
 public function index()
 {
     global $_FANWE;
     $where = ' WHERE status = 1 AND (begin_time <= ' . TIME_UTC . ' OR begin_time = 0) AND (end_time >= ' . TIME_UTC . ' OR end_time = 0)';
     $order = ' ORDER BY sort ASC,end_time ASC,id DESC';
     $best_list = array();
     $best_ids = array();
     $sql = 'SELECT * FROM ' . FDB::table('exchange_goods') . $where . ' AND is_best = 1 ' . $order . ' LIMIT 0,4';
     $res = FDB::query($sql);
     while ($data = FDB::fetch($res)) {
         $data['num'] = $data['stock'] - $data['buy_count'];
         $data['url'] = FU('exchange/show', array('id' => $data['id']));
         $best_list[] = $data;
         $best_ids[] = $data['id'];
     }
     if (count($best_ids) > 0) {
         $best_ids = implode(',', $best_ids);
         $where .= ' AND id NOT IN (' . $best_ids . ')';
     }
     $sql = 'SELECT COUNT(id) FROM ' . FDB::table('exchange_goods') . $where;
     $goods_count = FDB::resultFirst($sql);
     $page_size = 10;
     $pager = buildPage('exchange/index', array(), $goods_count, $_FANWE['page'], $page_size);
     $sql = 'SELECT * FROM ' . FDB::table('exchange_goods') . $where . $order . ' LIMIT ' . $pager['limit'];
     $goods_list = array();
     $res = FDB::query($sql);
     while ($data = FDB::fetch($res)) {
         $data['num'] = $data['stock'] - $data['buy_count'];
         $data['url'] = FU('exchange/show', array('id' => $data['id']));
         $goods_list[] = $data;
     }
     $order_list = FS("Exchange")->getOrderTop();
     $score_list = FS("Exchange")->getScoreTop();
     $exchange_list = FS("Exchange")->getExchangeTop();
     if ($_FANWE['uid'] > 0) {
         $consignee = FDB::fetchFirst('SELECT * FROM ' . FDB::table('user_consignee') . ' WHERE uid = ' . $_FANWE['uid']);
     }
     include template('page/exchange/exchange_index');
     display();
 }
コード例 #7
0
function showPage($configItems, $typeOfDemo)
{
    global $manifest;
    global $paths;
    // paths related to the environment
    global $typeOfDemo;
    $paths["webDefault"] = $paths["webHome"] . "/default/templates/" . $typeOfDemo;
    include $paths["templates"] . "/manifest.php";
    $manifest = getManifest($typeOfDemo);
    $basicHTMLstrings = getHTMLstrings($configItems);
    // grab any simple HTML
    //strings from the list of configurations
    $thesePaths = setPaths();
    // paths to all of the needed files
    $finalPaths = evaluatePaths($thesePaths);
    // files opened, html tags added
    $basicHTMLstrings["navigation"] = getNav();
    $finalHTML = getFinalHTML($finalPaths, $basicHTMLstrings);
    $htmlTemplate = getHTMLtemplate($configItems);
    $htmlString = buildPage($htmlTemplate, $finalHTML);
    echo $htmlString;
}
コード例 #8
0
ファイル: Search.php プロジェクト: GobYang/thaidh
 public function indexAction()
 {
     $word = deep_htmlspecialchars($this->get("word"));
     if (!$word) {
         $where = "status=-1";
     } else {
         $where = "status=1 AND title like '%" . $word . "%'";
     }
     $total = $this->m_search->getSearchArticle(0, $where);
     //获取符合条件的总是
     $page = $this->get('page');
     $page = $page ? $page : 1;
     $size = 15;
     $start = ($page - 1) * $size;
     $limit = $start . ',' . $size;
     $url = '/search?word=' . $word . "&page=";
     $buffer["word"] = $word;
     $buffer['pageNav'] = buildPage($page, $total, $url, $size, 5);
     $buffer["list"] = $this->m_search->getSearchArticle(1, $where, $limit);
     $m_user = $this->load("User");
     foreach ($buffer['list'] as $k => $v) {
         $buffer['list'][$k]["username"] = $m_user->SelectFieldByID("username", $v["user_id"]);
         $buffer['list'][$k]["avatar"] = $m_user->SelectFieldByID("avatar", $v["user_id"]);
         if ($v["table_name"] == "study") {
             $buffer['list'][$k]["url"] = "/study/detail?id=" . $v["id"];
         } elseif ($v["table_name"] == "discuss") {
             $buffer['list'][$k]["url"] = "/discuss/detail?id=" . $v["id"];
         } elseif ($v["table_name"] == "travel") {
             $buffer['list'][$k]["url"] = "/travel/detail?id=" . $v["id"];
         }
     }
     $buffer["list"] = deep_htmlspecialchars_decode($buffer['list']);
     $buffer['pageTitle'] = $this->get("word") . "_泰语导航网";
     $buffer["curNav"] = 5;
     $this->getView()->assign($buffer);
 }
コード例 #9
0
    public function category()
    {
        global $_FANWE;
        $id = (int) $_FANWE['request']['id'];
        if (!$id) {
            fHeader("location: " . FU('album'));
        }
        if (!isset($_FANWE['cache']['albums']['category'][$id])) {
            fHeader("location: " . FU('album'));
        }
        $album_cate = $_FANWE['cache']['albums']['category'][$id];
        $_FANWE['nav_title'] = $album_cate['name'] . $_FANWE['nav_title'];
        $page_args = array();
        $page_args['id'] = $id;
        $sort = $_FANWE['request']['sort'];
        switch ($sort) {
            case 'new':
                $page_args['sort'] = 'new';
                $order = " ORDER BY s.share_id DESC";
                break;
            default:
                $sort = 'hot';
                $page_args['sort'] = 'hot';
                $order = " ORDER BY s.collect_count DESC";
                break;
        }
        $where = ' WHERE a.cid = ' . $id;
        $sql = 'SELECT COUNT(DISTINCT share_id) FROM ' . FDB::table('album_share') . ' AS a ' . $where;
        $count = FDB::resultFirst($sql);
        $share_list = array();
        $share_display = array();
        if ($count > 0) {
            $pager = buildPage('album/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 40);
            $share_list = FDB::fetchAll('SELECT * FROM ' . FDB::table('album_share') . ' AS a 
				INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = a.share_id ' . $where . ' 
				AND s.type = \'album_item\'' . $order . ' LIMIT ' . $pager['limit']);
            $share_list = FS('Share')->getShareDetailList($share_list, false, false, false, true, 2);
            $col = 4;
            $index = 0;
            $share_display = array();
            foreach ($share_list as $share) {
                $share['empty_content'] = sprintf(lang('album', 'rel_album_empty_content'), $share['title']);
                $mod = $index % $col;
                $share_display['col' . $mod][] = $share;
                $index++;
            }
        }
        include template('page/album/album_category');
        display();
    }
コード例 #10
0
ファイル: Campaigns.php プロジェクト: Lawrence94/sme4me
 public function editCampaign($campaignId)
 {
     # code...
     if ($this->input->post('editcamp')) {
         $campaign = $this->input->post('editcamp');
         $date1 = date('Y-m-d H:i', strtotime($campaign['expirydate']));
         $date = date_create($date1);
         $title = $campaign['title'];
         $type = $campaign['type'];
         $points = (int) $campaign['points'];
         $userpoints = (int) $campaign['userpoints'];
         $description = $campaign['desc'];
         $gender = $campaign['gender'];
         $age = $campaign['age'];
         //var_dump($companyName);
         //exit;
         $status1 = true;
         $currentUser = ParseUser::getCurrentUser();
         if ($currentUser) {
             $editCampParse = $this->signup->doEditCampaign($title, $type, $points, $userpoints, $description, $gender, $age, $date, $campaignId);
             if (!$editCampParse['status']) {
                 $status1 = false;
             }
             if (!$status1) {
                 //echo "f**k";
                 notify('danger', $editCampParse['parseMsg'], 'company/campaigns');
             } else {
                 echo "Please wait, we'll take you back to the dashboard right away...";
                 notify('success', 'Campaign Edited Succesfully', 'company/campaigns');
             }
         } else {
             redirect('company/login', 'refresh');
         }
     } else {
         $currentUser = ParseUser::getCurrentUser();
         $displayData = 'display:none';
         $adminName = $this->editHeader($displayData, $campaignId);
         if ($currentUser) {
             $dashView = $this->load->view('beacons/editcampaign', $adminName, true);
             buildPage($dashView, 'Edit Campaign');
         } else {
             //echo 'hey';
             redirect('company/login', 'refresh');
         }
     }
 }
コード例 #11
0
        $htmlMain .= '<pre>';
        $torrents = getTorrentListFromFS();
        foreach ($torrents as $torrent) {
            $htmlMain .= ' - ' . $torrent . "";
            if (isTorrentRunning($torrent)) {
                $htmlMain .= " (running)";
            }
            $htmlMain .= "\n";
        }
        $htmlMain .= '</pre>';
        printPage();
        exit;
    }
}
// standard-action
buildPage(@trim($_REQUEST["a"]));
printPage();
exit;
// -----------------------------------------------------------------------------
// functions
// -----------------------------------------------------------------------------
/**
 * performAuthentication
 *
 */
function performAuthentication($message = "")
{
    if (!IsSuperAdmin()) {
        header("Content-Type: text/plain");
        echo "\nAccess Error" . "\n\n";
        if (isset($message) && $message != "") {
コード例 #12
0
ファイル: body.inc.php プロジェクト: themohr/cis665
<body>
	<?php 
include_once 'header.inc.php';
?>
	<section class="container">
		<div class="row">
			
				<?php 
@(require_once "controller/PageController.php");
@(include buildPage($_SERVER['QUERY_STRING'], "Title"));
?>
			
		</div>
	</section>
	<?php 
include_once 'footer.inc.php';
?>
	
</body>
コード例 #13
0
ファイル: Member.php プロジェクト: GobYang/thaidh
 public function messageAction()
 {
     //点击进来就让redis中消息状态为已读
     $uid = $this->getSession("uid");
     $redis = Yaf_Registry::get('redis');
     $msg = $redis->get("message_" . $uid);
     if ($msg) {
         $data = json_decode($msg, true);
         if (!$data["comment"]["status"]) {
             $data["comment"]["status"] = 1;
             //标记为已读
             $data["comment"]["total"] = 0;
             //标记为0
             $redis->set("message_" . $uid, json_encode($data));
         }
         if (!$data["reply"]["status"]) {
             $data["reply"]["status"] = 1;
             //标记为已读
             $data["reply"]["total"] = 0;
             //标记为已读
             $redis->set("message_" . $uid, json_encode($data));
         }
     }
     $page = (int) $this->get('p');
     $page = $page ? $page : 1;
     $m_comment = $this->load("comment");
     $size = 10;
     $total = $m_comment->Where("to_id=" . $this->uid)->Total();
     $pages = ceil($total / $size);
     $start = ($page - 1) * $size;
     $limit = $start . ',' . $size;
     $article_list = $m_comment->Where("to_id=" . $this->uid)->Order("ctime desc")->Limit($limit)->Select();
     foreach ($article_list as $k => $v) {
         if ($v["type"] == 1) {
             $title = $this->m_study->Where("id=" . $v["article_id"])->Field("study_name")->SelectOne();
             $article_list[$k]["title"] = $title["study_name"];
             $article_list[$k]["url"] = "/study/detail?id=" . $v["article_id"];
             $from_user = $this->m_user->Where("id=" . $v["from_id"])->Field("email,username")->SelectOne();
             $article_list[$k]["from_username"] = $from_user["username"];
         } else {
             if ($v["type"] == 2) {
                 $title = $this->m_travel->Where("id=" . $v["article_id"])->Field("travel_name")->SelectOne();
                 $article_list[$k]["title"] = $title["travel_name"];
                 $article_list[$k]["url"] = "/travel/detail?id=" . $v["article_id"];
                 $from_user = $this->m_user->Where("id=" . $v["from_id"])->Field("email,username")->SelectOne();
                 $article_list[$k]["from_username"] = $from_user["username"];
             } else {
                 if ($v["type"] == 3) {
                     $title = $this->m_discuss->Where("id=" . $v["article_id"])->Field("discuss_name")->SelectOne();
                     $article_list[$k]["title"] = $title["discuss_name"];
                     $article_list[$k]["url"] = "/discuss/detail?id=" . $v["article_id"];
                     $from_user = $this->m_user->Where("id=" . $v["from_id"])->Field("email,username")->SelectOne();
                     $article_list[$k]["from_username"] = $from_user["username"];
                 }
             }
         }
     }
     $phpfile = "/member/message?p=";
     $buffer["article_list"] = $article_list;
     $buffer['pageNav'] = buildPage($page, $total, $phpfile, $size, 5);
     $buffer['pageTitle'] = "我的消息_泰语导航网";
     $this->getView()->assign($buffer);
 }
コード例 #14
0
    private function getList()
    {
        global $_FANWE;
        $_FANWE['user_click_share_id'] = (int) $_FANWE['request']['sid'];
        unset($_FANWE['request']['sid']);
        $cache_file = getTplCache('page/book/book_index', $_FANWE['request'], 2);
        if (getCacheIsUpdate($cache_file, BOOK_CACHE_PAGE_TIME)) {
            $category = urldecode($_FANWE['request']['cate']);
            $is_root = false;
            $page_args = array();
            if (isset($_FANWE['cache']['goods_category']['cate_code'][$category])) {
                $page_args['cate'] = $_FANWE['request']['cate'];
                $cate_id = $_FANWE['cache']['goods_category']['cate_code'][$category];
                $goods_cate_code = $category;
            } else {
                $is_root = true;
                $cate_id = $_FANWE['cache']['goods_category']['root'];
            }
            $sort = $_FANWE['request']['sort'];
            $sort = !empty($sort) ? $sort : "pop";
            $category_data = $_FANWE['cache']['goods_category']['all'][$cate_id];
            $category_tags = array();
            $_FANWE['nav_title'] = $category_data['cate_name'];
            if (!empty($category_data['seo_keywords'])) {
                $_FANWE['seo_keywords'] = $category_data['seo_keywords'];
                $_FANWE['setting']['site_keywords'] = '';
            }
            if (!empty($category_data['seo_desc'])) {
                $_FANWE['seo_description'] = $category_data['seo_desc'];
                $_FANWE['setting']['site_description'] = '';
            }
            $child_ids = array();
            if (isset($category_data['child'])) {
                $child_ids = $category_data['child'];
                if (!$is_root) {
                    $tagurlpara['cate'] = urlencode($category_data['cate_code']);
                }
                foreach ($category_data['child'] as $child_id) {
                    $child_cate = $_FANWE['cache']['goods_category']['all'][$child_id];
                    $tag_key = 'goods_category_tags_' . $child_id;
                    FanweService::instance()->cache->loadCache($tag_key);
                    foreach ($_FANWE['cache'][$tag_key] as $k => $tag) {
                        $tagurlpara['tag'] = urlencode($tag['tag_name']);
                        $tag['url'] = FU("book/" . ACTION_NAME, $tagurlpara);
                        $child_cate['tags'][] = $tag;
                        if ($k > 16) {
                            break;
                        }
                    }
                    $category_tags[] = $child_cate;
                }
            }
            $hot_tags = array();
            if (!$is_root) {
                $child_ids[] = $cate_id;
                require fimport("function/share");
                $hot_tags = getHotTags($child_ids, $category, 10);
            }
            $condition = " WHERE s.share_data IN ('goods','photo','goods_photo')";
            if (!$is_root) {
                $cids = array();
                FS('Share')->getChildCids($cate_id, $cids);
                $condition .= " AND sc.cate_id IN (" . implode(',', $cids) . ")";
            }
            $title = $category_data['short_name'];
            $is_match = false;
            $tag = urldecode($_FANWE['request']['kw']);
            if (!empty($tag)) {
                $_FANWE['nav_title'] = $tag . ' - ' . $_FANWE['nav_title'];
                $title = htmlspecialchars($tag);
                $is_match = true;
                //$match_key = FS('Words')->segment($tag,10);
                //$match_key = tagToUnicode($match_key,'+');
                $match_key = segmentToUnicode($tag, '+');
                $condition .= " AND match(sm.content_match) against('" . $match_key . "' IN BOOLEAN MODE) ";
                $page_args['tag'] = urlencode($tag);
            }
            //输出排序URL
            $sort_page_args = $page_args;
            $sort_page_args['sort'] = 'hot7';
            $hot7_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args);
            if ($sort == 'hot7') {
                $hot7_url['act'] = 1;
            }
            $sort_page_args['sort'] = 'hot30';
            $hot30_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args);
            if ($sort == 'hot30') {
                $hot30_url['act'] = 1;
            }
            $sort_page_args['sort'] = 'new';
            $new_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args);
            if ($sort == 'new') {
                $new_url['act'] = 1;
            }
            $sort_page_args['sort'] = 'pop';
            $pop_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args);
            if ($sort == 'pop') {
                $pop_url['act'] = 1;
            }
            if (!empty($_FANWE['request']['sort'])) {
                $page_args['sort'] = $sort;
            } else {
                $page_args['sort'] = 'pop';
            }
            $today_time = getTodayTime();
            switch ($sort) {
                //7天最热 点击次数
                case 'hot7':
                    $day7_time = $today_time - 604800;
                    $field = ",(s.create_time > {$day7_time}) AS time_sort ";
                    $sort = " ORDER BY time_sort DESC,s.click_count DESC";
                    break;
                    //30天最热 点击次数
                //30天最热 点击次数
                case 'hot30':
                    $day30_time = $today_time - 2592000;
                    $field = ",(s.create_time > {$day30_time}) AS time_sort ";
                    $sort = " ORDER BY time_sort DESC,s.click_count DESC";
                    break;
                    //最新
                //最新
                case 'new':
                    $field = '';
                    $sort = " ORDER BY s.share_id DESC";
                    break;
                    //潮流  喜欢人数
                //潮流  喜欢人数
                case 'pop':
                default:
                    $day7_time = $today_time - 604800;
                    $field = ",(s.create_time > {$day7_time}) AS time_sort ";
                    $sort = " ORDER BY time_sort DESC,s.collect_count DESC";
                    break;
            }
            $sql = 'SELECT DISTINCT(s.share_id),s.uid,s.content,s.collect_count,s.comment_count,s.create_time,s.cache_data ' . $field . '
					FROM ' . FDB::table('share') . ' AS s ';
            if (!$is_root) {
                $sql .= 'INNER JOIN ' . FDB::table('share_category') . ' AS sc ON s.share_id = sc.share_id ';
            }
            if ($is_match) {
                $sql .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id ';
            }
            $sql .= $condition . $sort;
            $sql_count = 'SELECT COUNT(DISTINCT s.share_id)
				FROM ' . FDB::table('share') . ' AS s ';
            if (!$is_root) {
                $sql_count .= 'INNER JOIN ' . FDB::table('share_category') . ' AS sc ON s.share_id = sc.share_id ';
            }
            if ($is_match) {
                $sql_count .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id ';
            }
            $sql_count .= $condition;
            $page_size = 50;
            $max_page = 100;
            $count = FDB::resultFirst($sql_count);
            if ($count > $max_page * $page_size) {
                $count = $max_page * $page_size;
            }
            if ($_FANWE['page'] > $max_page) {
                $_FANWE['page'] = $max_page;
            }
            $pager = buildPage('book/' . $action, $page_args, $count, $_FANWE['page'], $page_size, '', 3);
            $share_datas = array();
            $sql = $sql . ' LIMIT ' . $pager['limit'];
            $share_list = FDB::fetchAll($sql);
            $share_list = FS('Share')->getShareDetailList($share_list, false, false, false, true, 2);
            $col = 4;
            $index = 0;
            $share_display = array();
            foreach ($share_list as $share) {
                $mod = $index % $col;
                $share_display['col' . $mod][] = $share;
                $index++;
            }
            include template('page/book/book_index');
            display($cache_file);
            exit;
        } else {
            include $cache_file;
            display();
        }
    }
コード例 #15
0
ファイル: handler.php プロジェクト: aerouk/timetabler
<?php

require_once __DIR__ . "/../protected/backbone.php";
$validPages = array("home", "error");
$currentPage = $_GET['page'];
if (!in_array($currentPage, $validPages)) {
    header("Location: /error");
    die;
}
$error = isset($_GET['e']) ? $_GET['e'] : null;
buildPage($currentPage, getTitle($currentPage, $error));
die;
コード例 #16
0
    public function album()
    {
        global $_FANWE;
        $home_uid = $_FANWE['home_uid'];
        $home_user = FS('User')->getUserById($home_uid);
        $current_menu = 'album';
        $album_list = array();
        $pager = array();
        $type = (int) $_FANWE['request']['type'];
        switch ($type) {
            case '2':
                $uids = array();
                //获取我关注的会员编号
                $sql = 'SELECT uid
					FROM ' . FDB::table('user_follow') . '
					WHERE f_uid = ' . $home_uid;
                $res = FDB::query($sql);
                while ($data = FDB::fetch($res)) {
                    $uids[] = (int) $data['uid'];
                }
                if (count($uids) > 0) {
                    $sql = 'SELECT COUNT(id) FROM ' . FDB::table("album") . ' 
						WHERE uid IN (' . implode(',', $uids) . ')';
                    $count = FDB::resultFirst($sql);
                    $args['type'] = 2;
                    $pager = buildPage('u/album', $args, $count, $_FANWE['page'], 10);
                    $sql = 'SELECT * FROM ' . FDB::table('album') . ' 
						WHERE uid IN (' . implode(',', $uids) . ') ORDER BY id DESC LIMIT ' . $pager['limit'];
                    $res = FDB::query($sql);
                    while ($data = FDB::fetch($res)) {
                        $data['imgs'] = array();
                        if (!empty($data['cache_data'])) {
                            $cache_data = fStripslashes(unserialize($data['cache_data']));
                            $data['imgs'] = $cache_data['imgs'];
                            unset($data['cache_data']);
                        }
                        $data['url'] = FU('album/show', array('id' => $data['id']));
                        $album_list[$data['id']] = $data;
                    }
                }
                break;
            case '3':
                $aids = array();
                $sql = 'SELECT album_id 
					FROM ' . FDB::table('album_best') . '
					WHERE uid = ' . $home_uid;
                $res = FDB::query($sql);
                while ($data = FDB::fetch($res)) {
                    $aids[] = (int) $data['album_id'];
                }
                if (count($aids) > 0) {
                    $sql = 'SELECT COUNT(id) FROM ' . FDB::table("album") . ' 
						WHERE id IN (' . implode(',', $aids) . ')';
                    $count = FDB::resultFirst($sql);
                    $args['type'] = 3;
                    $pager = buildPage('u/album', $args, $count, $_FANWE['page'], 10);
                    $sql = 'SELECT * FROM ' . FDB::table('album') . ' 
						WHERE id IN (' . implode(',', $aids) . ') ORDER BY id DESC LIMIT ' . $pager['limit'];
                    $res = FDB::query($sql);
                    while ($data = FDB::fetch($res)) {
                        $data['imgs'] = array();
                        if (!empty($data['cache_data'])) {
                            $cache_data = fStripslashes(unserialize($data['cache_data']));
                            $data['imgs'] = $cache_data['imgs'];
                            unset($data['cache_data']);
                        }
                        $data['url'] = FU('album/show', array('id' => $data['id']));
                        $album_list[$data['id']] = $data;
                    }
                }
                break;
            default:
                $type = 1;
                if ($home_user['albums'] > 0) {
                    $args['type'] = 1;
                    $pager = buildPage('u/album', $args, $home_user['albums'], $_FANWE['page'], 10);
                    $sql = 'SELECT * FROM ' . FDB::table('album') . ' 
						WHERE uid = ' . $home_uid . ' ORDER BY id DESC LIMIT ' . $pager['limit'];
                    $res = FDB::query($sql);
                    while ($data = FDB::fetch($res)) {
                        $data['imgs'] = array();
                        if (!empty($data['cache_data'])) {
                            $cache_data = fStripslashes(unserialize($data['cache_data']));
                            $data['imgs'] = $cache_data['imgs'];
                            unset($data['cache_data']);
                        }
                        $data['url'] = FU('album/show', array('id' => $data['id']));
                        $album_list[] = $data;
                    }
                }
                break;
        }
        include template('page/u/u_album');
        display();
    }
コード例 #17
0
<?php

$count = FDB::resultFirst('SELECT COUNT(uid) FROM ' . FDB::table('user_follow') . ' WHERE uid = ' . $_FANWE['uid']);
$pager = buildPage('', array(), $count, $_FANWE['page'], 30);
$user_list = FDB::fetchAll('SELECT u.uid,u.user_name 
	FROM ' . FDB::table('user_follow') . ' AS uf
	INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = uf.f_uid 
	WHERE uf.uid = ' . $_FANWE['uid'] . ' ORDER BY uf.create_time DESC LIMIT ' . $pager['limit']);
include template('services/user/fans');
display('', false);
コード例 #18
0
/**
 * update
 *
 * @param $action
 */
function sa_update($action = "")
{
    global $cfg, $error, $statusImage, $statusMessage, $htmlTitle, $htmlTop, $htmlMain;
    if ($action == "") {
        return;
    }
    switch ($action) {
        case "0":
            // get updateIndex to check if update from this version possible
            $updateIndexData = trim(getDataFromUrl(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY . "?u=0&v=" . _VERSION));
            if (isset($updateIndexData) && $updateIndexData != "") {
                $updateIndexVars = explode("\n", $updateIndexData);
                $updatePossible = trim($updateIndexVars[0]);
                if ($updatePossible != "1") {
                    buildPage("-u");
                    printPage();
                    exit;
                } else {
                    $htmlTop = "<strong>Update - Check</strong>";
                    $htmlMain = "<br>Update from your Version possible.";
                    $htmlMain .= '<br><br>';
                    $htmlMain .= '<form name="update" action="' . _FILE_THIS . '" method="post">';
                    $htmlMain .= '<input type="Hidden" name="u" value="1">';
                    $htmlMain .= '<input type="submit" value="Next Step - Database-Update">';
                    $htmlMain .= '</form>';
                    $htmlMain .= '<br>';
                    $statusImage = "yellow.gif";
                    $htmlTitle = "Update";
                    printPage();
                    exit;
                }
            } else {
                buildPage("-u");
                printPage();
                exit;
            }
            break;
        case "1":
            // get db-settings
            $updateDBData = trim(getDataFromUrl(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY . "?u=1&v=" . _VERSION));
            if (isset($updateDBData) && $updateDBData != "") {
                $updateDBVars = explode("\n", $updateDBData);
                $updateNeeded = trim($updateDBVars[0]);
                if ($updateNeeded == "0") {
                    $htmlTop = "<strong>Update - Database</strong>";
                    $htmlMain = "<br>Database-Update in this Update not needed.";
                    $htmlMain .= '<br><br>';
                    $htmlMain .= '<form name="update" action="' . _FILE_THIS . '" method="post">';
                    $htmlMain .= '<input type="Hidden" name="u" value="3">';
                    $htmlMain .= '<input type="submit" value="Next Step - File-Update">';
                    $htmlMain .= '</form>';
                    $htmlMain .= '<br>';
                    $statusImage = "yellow.gif";
                    $htmlTitle = "Update";
                    printPage();
                    exit;
                } else {
                    if ($updateNeeded == "1") {
                        $htmlTop = "<strong>Update - Database</strong>";
                        $htmlMain = "<br>Database-Update in this Update is needed.";
                        $htmlMain .= '<br><br>';
                        $htmlMain .= 'Type: <em>' . $cfg["db_type"] . '</em>';
                        $htmlMain .= '<br><br>';
                        $htmlMain .= '<form name="update" action="' . _FILE_THIS . '" method="post">';
                        $htmlMain .= '<input type="Hidden" name="u" value="2">';
                        $htmlMain .= '<input type="submit" value="Next Step - Perform Database-Update">';
                        $htmlMain .= '</form>';
                        $htmlMain .= '<br>';
                        $statusImage = "yellow.gif";
                        $htmlTitle = "Update";
                        printPage();
                        exit;
                    } else {
                        updateError($updateDBData);
                        exit;
                    }
                }
            } else {
                updateError();
            }
            break;
        case "2":
            // get sql-data
            $updateSQLData = @trim(gzinflate(getDataFromUrl(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY . "?u=2&v=" . _VERSION . "&d=" . $cfg["db_type"])));
            if (isset($updateSQLData) && $updateSQLData != "") {
                sendLine('<strong>Update - Database</strong><br><br><em>Updating Database... Please Wait...</em><ul>');
                $updateSQLStates = explode("\n", $updateSQLData);
                // get ado-connection
                $dbCon = getAdoConnection();
                if (!$dbCon) {
                    echo '</em></li></ul><font color="red"><strong>Error updating Database.</strong></font><br><br>Please restore backup and try again (or do manual update).<br><br>';
                    echo $dbCon->ErrorMsg();
                    exit;
                } else {
                    foreach ($updateSQLStates as $sqlState) {
                        $sqlState = trim($sqlState);
                        if (isset($sqlState) && $sqlState != "" && substr($sqlState, 0, 2) != "--") {
                            sendLine('<li>' . $sqlState);
                            $dbCon->Execute($sqlState);
                            if ($dbCon->ErrorNo() == 0) {
                                sendLine(' <font color="green">Ok</font></li>');
                            } else {
                                // damn there was an error
                                // close ado-connection
                                $dbCon->Close();
                                // talk and out
                                echo '</em></li></ul><font color="red"><strong>Error updating Database.</strong></font><br><br>Please restore backup and try again (or do manual update).<br><br>';
                                exit;
                            }
                        }
                    }
                    // close ado-connection
                    $dbCon->Close();
                    // talk and continue
                    sendLine('</ul><p><font color="green">Database-Update done.</font><br><br>');
                    sendLine('<form name="update" action="' . _FILE_THIS . '" method="post"><input type="Hidden" name="u" value="3"><input type="submit" value="Next Step - File-Update"></form><br>');
                    exit;
                }
            } else {
                updateError("\n" . "cant get update-sql." . "\n" . $updateSQLData);
            }
            break;
        case "3":
            // get file-list
            $updateFileList = @trim(gzinflate(getDataFromUrl(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY . "?u=3&v=" . _VERSION)));
            if (isset($updateFileList) && $updateFileList != "") {
                sendLine('<strong>Update - Files</strong>');
                sendLine('<br><br>');
                sendLine('Files that require an update in this Version:');
                sendLine('<pre>');
                sendLine($updateFileList);
                sendLine('</pre>');
                sendLine('<form name="update" action="' . _FILE_THIS . '" method="post">');
                sendLine('<input type="Hidden" name="u" value="4">');
                sendLine('<input type="submit" value="Next Step - Perform File-Update">');
                sendLine('</form>');
                sendLine('<strong>Ensure script can write to docroot <em>' . $cfg['docroot'] . '</em> now !</strong>');
                exit;
            } else {
                updateError("\n" . "cant get file-list." . "\n" . $updateFileList);
            }
            break;
        case "4":
            sendLine('<strong>Update - Files</strong><br><br><em>Updating Files... Please Wait...</em><br><ul>');
            sendLine('<li>Getting Update-Archive:<br>');
            @ini_set("allow_url_fopen", "1");
            @ini_set("user_agent", "torrentflux-b4rt/" . _VERSION);
            // get md5
            $md5hash = getDataFromUrl(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY . "?u=4&v=" . _VERSION);
            if (!isset($md5hash) || strlen($md5hash) != 32) {
                sendLine('</li></ul><br><br><font color="red"><strong>Error getting Update-Archive.</strong></font><br><br>Please restore backup and try again (or do manual update).<br><br>');
                exit;
            }
            // download archive
            $fileHandle = @fopen($cfg['docroot'] . _UPDATE_ARCHIVE, "w");
            $urlHandle = @fopen(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY . "?u=5&v=" . _VERSION, 'r');
            if ($fileHandle && $urlHandle) {
                $results = array();
                $i = 0;
                stream_set_timeout($urlHandle, 15);
                $info = stream_get_meta_data($urlHandle);
                while (!feof($urlHandle) && !$info['timed_out']) {
                    $data = @fgets($urlHandle, 8192);
                    $results[$i] = @fwrite($fileHandle, $data);
                    $info = stream_get_meta_data($urlHandle);
                    sendLine('.');
                    $i++;
                }
                @fclose($fileHandle);
                @fclose($urlHandle);
                $done = true;
                foreach ($results as $result) {
                    if ($result === false) {
                        $done = false;
                    }
                }
                if ($done) {
                    sendLine('<font color="green">done</font></li>');
                } else {
                    sendLine('<br></li></ul><br><br><strong><font color="red">Error writing archive <em>' . $cfg['docroot'] . _UPDATE_ARCHIVE . '</em>.</font></strong><br><br>Please restore backup and try again (or do manual update).<br><br>');
                    exit;
                }
            } else {
                sendLine('</li></ul><br><br><strong><font color="red">Error updating files.</font></strong><br><br>Please restore backup and try again (or do manual update).<br><br>');
                exit;
            }
            // validate archive
            sendLine('<li>Validating Update-Archive: ');
            if (file_exists($cfg['docroot'] . _UPDATE_ARCHIVE) && $md5hash == @md5_file($cfg['docroot'] . _UPDATE_ARCHIVE)) {
                sendLine('<font color="green">Ok</font> (<em>' . $md5hash . '</em>)<br></li>');
            } else {
                sendLine('<font color="red">failed</font></ul><br><br>Please restore backup and try again (or do manual update).</strong><br><br>');
                exit;
            }
            // extract archive
            sendLine('<li>Extracting Update-Archive: <br>');
            sendLine('<em>');
            $cmd = 'cd ' . tfb_shellencode($cfg['docroot']) . ' && tar jxvf ' . _UPDATE_ARCHIVE;
            $cmd .= ' 2>&1';
            $handle = @popen($cmd, 'r');
            while (!@feof($handle)) {
                $read = @fread($handle, 64);
                sendLine(nl2br($read));
            }
            @pclose($handle);
            sendLine('</em>');
            sendLine('<font color="green">done</font></li>');
            // delete archive
            sendLine('<li>Deleting Update-Archive: ');
            if (@unlink($cfg['docroot'] . _UPDATE_ARCHIVE)) {
                sendLine('<font color="green">done</font></li>');
            } else {
                sendLine('<font color="red">failed</font><br>remove archive ' . $cfg['docroot'] . _UPDATE_ARCHIVE . ' manual now.</li>');
            }
            // version-file
            sendLine('<li>Updating Version-Information: ');
            $versionAvailable = trim(getDataFromUrl(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY));
            if (isset($versionAvailable) && $versionAvailable != "") {
                if ($handle = @fopen("version.php", "w")) {
                    if (@fwrite($handle, '<?php define("_VERSION", "' . $versionAvailable . '"); ?>')) {
                        @fclose($handle);
                        sendLine(' <font color="green">done</font></li>');
                    } else {
                        @fclose($handle);
                        sendLine('</li></ul><br><br><font color="red"><strong>Error writing version-file</strong></font><br><br>Please restore backup and try again (or do manual update).<br><br>');
                        exit;
                    }
                } else {
                    sendLine('<br><br>');
                    sendLine('</li></ul><font color="red"><strong>Error writing version-file</strong></font><br><br>Please restore backup and try again (or do manual update).<br><br>');
                    exit;
                }
            } else {
                sendLine('</li></ul><br><br><font color="red"><strong>Error getting version-file</strong></font><br><br>Please restore backup and try again (or do manual update).<br><br>');
                exit;
            }
            sendLine('</ul>');
            // done
            sendLine('<p><em>Done Updating Files.</em></p>');
            sendLine('<hr><br><strong>Update to ' . $versionAvailable . ' completed.</strong><br><br>');
            sendLine('<form name="update" action="#" method="get"><input type="submit" onClick="window.close()" value="Close"></form>');
            sendLine('<br>');
            // flush cache
            cacheFlush();
            // exit
            exit;
    }
    exit;
}
コード例 #19
0
 function detail()
 {
     global $_FANWE;
     $id = intval($_FANWE['request']['tid']);
     if ($id == 0) {
         fHeader('location: ' . FU('ask/index'));
     }
     $topic = FS('Ask')->getTopicById($id);
     if (empty($topic)) {
         fHeader('location: ' . FU('ask/index'));
     }
     $_FANWE['nav_title'] = lang('common', 'ask');
     $_FANWE['nav_title'] = $topic['title'] . ' - ' . $_FANWE['nav_title'];
     FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $topic['share_id']);
     $topic['time'] = getBeforeTimelag($topic['create_time']);
     $topic['share'] = FS('Share')->getShareDetail($topic['share_id']);
     $user_share_collect = FS('Share')->getShareCollectUser($topic['share_id']);
     if (!isset($user_share_collect[$_FANWE['uid']])) {
         if (FS('Share')->getIsCollectByUid($topic['share_id'], $_FANWE['uid'])) {
             $user_share_collect[$_FANWE['uid']] = $_FANWE['uid'];
         }
     }
     $ask_id = $topic['aid'];
     $ask = $_FANWE['cache']['asks'][$ask_id];
     FS('Ask')->updateTopicLooksCache($id);
     $topic_looks = FS('Ask')->getTopicLooks($id, 33);
     $is_follow = FS('Ask')->getIsFollowTid($id);
     $follow_count = FS('Ask')->getTopicFollowCount($id);
     $follow_users = FS('Ask')->getTopicFollows($id, 9);
     $ask_hot_topics = FS('Ask')->getHotAsk($ask_id, 9);
     $ask_hot_pics = FS('Ask')->getImgAsk('hot', 9);
     $new_events = FS('Event')->getHotNewEvent(10);
     $ask_new_topics = FS('Ask')->getNowTopicList($id, $ask_id, 10);
     $best_topics = FS('Topic')->getImgTopic('hot', 12, 1);
     $best_topics = array_chunk($best_topics, 3);
     $page_args = array('tid' => $id);
     $count = $topic['post_count'];
     $pager = buildPage('ask/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 10);
     $post_list = FS('Ask')->getTopicPostList($id, $pager['limit']);
     $args = array('share_list' => &$post_list, 'pager' => &$pager, 'current_share_id' => $topic['share_id']);
     $post_html = tplFetch("inc/share/post_share_list", $args);
     include template('page/ask/ask_detail');
     display();
 }
コード例 #20
0
ファイル: event.module.php プロジェクト: dalinhuang/concourse
    public function listdetail()
    {
        global $_FANWE;
        if (!isset($_FANWE['request']['type'])) {
            $type = "hot";
        } else {
            $type = $_FANWE['request']['type'];
        }
        $page_args = array();
        $where = "";
        if (!isset($_FANWE['request']['order'])) {
            $order = "time";
        } else {
            $order = $_FANWE['request']['order'];
        }
        switch ($order) {
            case "time":
                $sort = 'e.last_share DESC';
                $page_args['sort'] = 'time';
                break;
            case "thread_count":
                $sort = 'e.thread_count DESC';
                $page_args['sort'] = 'pop';
                break;
        }
        $is_query = true;
        switch ($type) {
            case "new":
                $sort = 'e.id DESC';
                unset($page_args['sort']);
                break;
            case "me":
                if ($_FANWE['uid'] == 0) {
                    fHeader("location: " . FU('user/login'));
                }
                $where .= ' AND e.uid = ' . $_FANWE['uid'];
                break;
            case "reply":
                if ($_FANWE['uid'] == 0) {
                    fHeader("location: " . FU('user/login'));
                }
                $count = FDB::resultFirst('SELECT COUNT(DISTINCT event_id) FROM ' . FDB::table('event_share') . ' WHERE uid = ' . $_FANWE['uid']);
                if ($count == 0) {
                    $is_query = false;
                } else {
                    $sql = 'SELECT DISTINCT event_id FROM ' . FDB::table('event_share') . ' 
						WHERE uid = ' . $_FANWE['uid'];
                    $ids = array();
                    $res = FDB::query($sql);
                    while ($data = FDB::fetch($res)) {
                        $ids[] = $data['event_id'];
                    }
                    $ids = implode(',', $ids);
                    $where .= ' AND e.id IN (' . $ids . ')';
                }
                break;
            default:
                $sort = 'e.thread_count DESC';
                unset($page_args['sort']);
                $type = "hot";
                break;
        }
        if (!empty($where)) {
            $where = ' WHERE' . $where;
            $where = str_replace('WHERE AND', 'WHERE', $where);
        }
        $detaillist = array();
        if ($is_query) {
            if ($type != 'reply') {
                $count = FDB::resultFirst('SELECT COUNT(DISTINCT e.id) FROM ' . FDB::table('event') . ' AS e' . $where);
            }
            $pager = buildPage('event/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 20);
            if (empty($sort)) {
                $sort = 'e.id DESC';
            } else {
                $sort .= ',e.id DESC';
            }
            $sql = 'SELECT DISTINCT e.id,e.title,e.uid,e.create_time,e.last_share,e.last_share time,e.thread_count FROM ' . FDB::table('event') . ' AS e' . $where . ' ORDER BY ' . $sort . ' LIMIT ' . $pager['limit'];
            $list_users = array();
            $res = FDB::query($sql);
            while ($data = FDB::fetch($res)) {
                $detaillist[$data['id']] = $data;
                $detaillist[$data['id']]['user'] =& $list_users[$data['uid']];
            }
            FS('User')->usersFormat($list_users);
        }
        //热门话题
        $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);
        }
        include template('page/event/event_list');
        display();
    }
コード例 #21
0
ファイル: index.php プロジェクト: Timmermans/js-calculator
                <div class="row">
                    <button>9</button>
                    <button>8</button>
                    <button>7</button>
                </div>
                <div class="row">
                    <button>6</button>
                    <button>5</button>
                    <button>4</button>
                </div>
                <div class="row">
                    <button>3</button>
                    <button>2</button>
                    <button>1</button>
                </div>
            </div>
            <div id="actions">
                <div class="row">
                    <button>*</button>
                    <button>/</button>
                </div>
                <div class="row">
                    <button>+</button>
                    <button>-</button>
                </div>
                <button class="equal">=</button>
            </div>
        </div>
    </div>';
buildPage($content);
コード例 #22
0
ファイル: html.php プロジェクト: egire/TinyIB
function rebuildThread($id)
{
    $htmlposts = "";
    $posts = postsInThreadByID($id);
    foreach ($posts as $post) {
        $htmlposts .= buildPost($post, TINYIB_RESPAGE);
    }
    $htmlposts .= "<br clear=\"left\">\n<hr>\n";
    writePage('res/' . $id . '.html', fixLinksInRes(buildPage($htmlposts, $id)));
}
コード例 #23
0
    public function index()
    {
        global $_FANWE;
        if ($_FANWE['setting']['second_status'] == 0) {
            fHeader("location: " . FU('index'));
        }
        $sid = (int) $_FANWE['request']['sid'];
        $cid = (int) $_FANWE['request']['cid'];
        $where = ' WHERE s.status = 1 AND sg.status = 1 ';
        $page_args = array();
        if ($sid > 0 && isset($_FANWE['cache']['seconds'][$sid])) {
            $where .= ' AND sg.sid = ' . $sid;
            $page_args['sid'] = $sid;
        } else {
            $sid = 0;
        }
        if ($cid > 0 && isset($_FANWE['cache']['citys']['all'][$cid])) {
            $where .= ' AND sg.city_id = ' . $cid;
            $page_args['cid'] = $cid;
        } else {
            $cid = 0;
        }
        $seconds = array();
        $citys = array();
        $temp_args = $page_args;
        foreach ($_FANWE['cache']['seconds'] as $second) {
            if ($second['sid'] == $sid) {
                $_FANWE['nav_title'] = $second['name'] . ' - ' . $_FANWE['nav_title'];
                $second['current'] = true;
            } else {
                $second['current'] = false;
            }
            $temp_args['sid'] = $second['sid'];
            $second['url'] = FU('second/index', $temp_args);
            $seconds[] = $second;
        }
        unset($temp_args['sid']);
        $second_all_url = FU('second/index', $temp_args);
        $temp_args = $page_args;
        foreach ($_FANWE['cache']['citys']['province'] as $province) {
            $province = $_FANWE['cache']['citys']['all'][$province];
            if ($province['id'] == $cid) {
                $_FANWE['nav_title'] = $province['name'] . $_FANWE['nav_title'];
                $province['current'] = true;
            } else {
                $province['current'] = false;
            }
            $temp_args['cid'] = $province['id'];
            $province['url'] = FU('second/index', $temp_args);
            $citys[] = $province;
        }
        unset($temp_args['cid']);
        $city_all_url = FU('second/index', $temp_args);
        $sql = 'SELECT COUNT(gid) FROM ' . FDB::table('second_goods') . ' AS sg 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id ' . $where;
        $goods_count = FDB::resultFirst($sql);
        $goods_list = array();
        if ($goods_count > 0) {
            $pager = buildPage('book/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 20);
            $sql = 'SELECT sg.*,s.collect_count,s.comment_count,relay_count,s.cache_data FROM ' . FDB::table('second_goods') . ' AS sg 
				INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id ' . $where . ' ORDER BY sg.gid DESC LIMIT ' . $pager['limit'];
            $res = FDB::query($sql);
            while ($data = FDB::fetch($res)) {
                $data['url'] = FU('note/index', array('sid' => $data['share_id']));
                $data['cache_data'] = fStripslashes(unserialize($data['cache_data']));
                $data['time'] = getBeforeTimelag($data['create_time']);
                FS('Share')->shareImageFormat($data);
                unset($data['cache_data']);
                $goods_list[$data['share_id']] = $data;
            }
        }
        include template('page/second/second_index');
        display();
    }
コード例 #24
0
ファイル: Managers.php プロジェクト: Lawrence94/sme4me
 public function editManager($userId)
 {
     # code...
     $query = new ParseQuery("_User");
     $query->equalTo("objectId", $userId);
     $user = $query->find();
     # code...
     $currentUser = ParseUser::getCurrentUser();
     $displayData = 'display:none';
     // Check if the user is logged in.
     // If tahe user is logged in, load the page.
     if ($currentUser) {
         if (empty($user)) {
             $data1 = $this->menu_header($displayData);
             buildPage($this->load->view('managers/managers', $data1, true), 'Manage Users');
         } else {
             $data = $this->edit_header($displayData, $userId);
             buildPage($this->load->view('managers/editManager', $data, true), 'Manage Users - Edit');
         }
     } else {
         redirect('company/login', 'refresh');
     }
 }
コード例 #25
0
ファイル: Dashboard.php プロジェクト: Lawrence94/sme4me
 public function email()
 {
     if ($this->input->post('testmail')) {
         $post = $this->input->post('testmail');
         $message = $post['testmessage'];
         $subject = $post['subject'];
         $to = $post['testemail'];
         $this->mailout($message, $subject, $to);
     } elseif ($this->input->post('fullmail')) {
         $post = $this->input->post('fullmail');
         $message = $post['message'];
         $subject = $post['subject'];
         $result = $this->db->get_where('worker_details', ['email'])->result();
         foreach ($result as $val) {
             $this->mailoutmulti($message, $subject, $val->email);
         }
         notify('info', "Your Mails have been sent successfully", site_url('Admin/Dashboard/email'));
     } else {
         $currentUser = $this->session->userdata('user_vars');
         $adminName = $this->menu_header();
         if ($currentUser) {
             $dashView = $this->load->view('dashboard/email', $adminName, true);
             buildPage($dashView, 'Dashboard - Send Email');
         } else {
             echo 'hey';
             redirect('Admin/Login', 'refresh');
         }
     }
 }
コード例 #26
0
ファイル: tip.php プロジェクト: TheRedJackal/tippchampion
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    if ($result = $MySQLConnection->getQuery('SELECT x.matchID AS matchID, x.matchDate AS matchDate, y.teamName AS matchHomeTeam, y.teamLogo AS matchHomeTeamLogo, z.teamName AS matchForeignTeam, z.teamLogo AS matchForeignTeamLogo FROM matches AS x JOIN teams AS y ON y.teamID = matchHomeTeam JOIN teams AS z ON z.teamID = matchForeignTeam;')) {
        while ($row = mysqli_fetch_assoc($result)) {
            $userTips = getUserTips($MySQLConnection, $row["matchID"]);
            echo '
						<div class="panel panel-default">
							<form id="match_' . $row["matchID"] . '" method="POST">
								<div class="panel-body">
									<div class="panel-heading">' . $row["matchHomeTeam"] . ' vs. ' . $row["matchForeignTeam"] . '</div>
									<div class="input-group">
									 	<label>' . $row["matchHomeTeam"] . '</label>
									 	<input type="number"min="0"value="' . $userTips["tipScoreHome"] . '" name="ScoreHome" id="ScoreHome"  required/>
									 </div>
									<div class="input-group">
									 	<label>' . $row["matchForeignTeam"] . '</label>
									 	<input type="number"min="0" value="' . $userTips["tipScoreForeign"] . '" name="ScoreForeign" id="ScoreForeign" required/>
									 	<input type="button" value="Place Tip" onclick="placeTip(' . $row["matchID"] . ');"/>
									</div>
								</div>
							</form>
						</div>
					';
        }
    }
}
if (sessionCheck()) {
    buildPage();
} else {
    echo '<script type="text/javascript">', 'printError(\'You are not Logged in!\')', '</script>';
}
コード例 #27
0
ファイル: 71.pages.php プロジェクト: vorons/bludit
    $dbPages->cliMode();
}
// Build specific page.
if ($Url->whereAmI() === 'page' && $Url->notFound() === false) {
    $Page = buildPage($Url->slug());
    // The page doesn't exist.
    if ($Page === false) {
        $Url->setNotFound(true);
        unset($Page);
    } elseif (!$Page->published()) {
        $Url->setNotFound(true);
        unset($Page);
    }
}
// Homepage
if ($Url->whereAmI() === 'home' && $Url->notFound() === false) {
    // The user defined as homepage a particular page.
    if (Text::isNotEmpty($Site->homepage())) {
        $Url->setWhereAmI('page');
        $Page = buildPage($Site->homepage());
        if ($Page === false) {
            $Url->setWhereAmI('home');
        }
    }
}
if ($Url->notFound()) {
    $Url->setWhereAmI('page');
    $Page = new Page('error');
}
// Build all pages
$pages = buildAllPages();
コード例 #28
0
    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'] = '';
        $current_img = FDB::resultFirst("select img from " . FDB::table("share_photo") . " where share_id = " . $share_id . " and img <> '' ");
        if ($current_img['img_width'] > 468) {
            $current_img['img_width'] = 468;
        }
        $current_img_arr = FDB::fetchFirst("select * from " . FDB::table("share_photo") . " where share_id = " . $share_id . " and img <> '' ");
        //var_dump($current_img_arr);
        FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $share_id);
        //上一个,下一个分享
        $pns = FS('Share')->getSameAlbumNextShares($share_detail['uid'], $share_id);
        $other_album_share = FS('share')->getSameAlbumShares($share_id);
        $current_location = $other_album_share['location'];
        unset($other_album_share['location']);
        $same_album_count = $other_album_share['count'];
        unset($other_album_share['count']);
        $aid = FDB::resultFirst("select album_id from " . FDB::table('album_share') . " where share_id = " . $share_id);
        $album_sql = 'select al.id as id,al.title as title from ' . FDB::table('album') . ' as al 
					 left join ' . FDB::table('album_share') . ' as als on al.id = als.album_id 
					 where als.share_id = ' . $share_id;
        $album_data = FDB::fetchFirst($album_sql);
        $is_follow_album = FS('album')->getIsFollow($aid, $_FANWE['uid']);
        //发布分享的会员
        $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');
        }
        $current_img_id = FDB::resultFirst("select photo_id from " . FDB::table("share_photo") . " where share_id = " . $share_id);
        //会员最被喜欢的照片
        $best_photo_share = FS('Share')->getBestCollectPhotoShareByUser($share_user['uid']);
        $current_type = FDB::resultFirst("select type from " . FDB::table("share_photo") . " where share_id = " . $share_id);
        if ($current_type == 'video') {
            $current_video = FDB::resultFirst("select video from " . FDB::table("share_photo") . " where share_id = " . $share_id);
        }
        //会员喜欢的照片
        $user_fav_photo = FS('Share')->getUserFavPhotoShare($share_user['uid']);
        $is_follow = FS('Share')->getIsCollectByUid($share_id, $_FANWE['uid']);
        include template('page/note/note_index');
        display();
    }
コード例 #29
0
ファイル: functions.php プロジェクト: kaaleth/bludit
function buildAllPages()
{
    global $pagesParents;
    global $pagesParentsPublished;
    global $pagesPublished;
    global $dbPages;
    // Get the page list
    $list = $dbPages->getDB();
    // Clean pages array.
    $pages = array();
    // Remove the error page
    unset($list['error']);
    // Sorte pages
    uasort($list, 'sortPages');
    foreach ($list as $key => $db) {
        $Page = buildPage($key);
        if ($Page !== false) {
            // Filter pages, with and without parent
            // If the page doesn't have a father, it's a parent page :P
            if ($Page->parentKey() === false) {
                // Add the parent key in the dbPages
                $dbPages->addParentKey($Page->key());
                // Add the page as a parent page in the array
                $pagesParents[NO_PARENT_CHAR][$Page->key()] = $Page;
                // If the page is published
                if ($Page->published()) {
                    $pagesParentsPublished[NO_PARENT_CHAR][$Page->key()] = $Page;
                }
            } else {
                $pagesParents[$Page->parentKey()][$Page->key()] = $Page;
                // If the page is published
                if ($Page->published()) {
                    $pagesParentsPublished[$Page->parentKey()][$Page->key()] = $Page;
                }
            }
            // All pages in one array
            $pages[$Page->key()] = $Page;
            // If the page is published
            if ($Page->published()) {
                $pagesPublished[$Page->parentKey()][$Page->key()] = $Page;
            }
        }
    }
    return $pages;
}
コード例 #30
0
    public function index()
    {
        global $_FANWE;
        FanweService::instance()->cache->loadCache('style_category');
        $sort = $_FANWE['request']['sort'];
        $sort = !empty($sort) ? $sort : "pop";
        $category_data = $_FANWE['cache']['style_category']['all'][3];
        $category_tags = array();
        $_FANWE['nav_title'] = $category_data['cate_name'];
        $child_ids = array();
        if (isset($category_data['child'])) {
            $child_ids = $category_data['child'];
            foreach ($category_data['child'] as $child_id) {
                $child_cate = $_FANWE['cache']['style_category']['all'][$child_id];
                $tag_key = 'style_category_tags_' . $child_id;
                FanweService::instance()->cache->loadCache($tag_key);
                foreach ($_FANWE['cache'][$tag_key] as $k => $tag) {
                    $tagurlpara['tag'] = urlencode($tag['tag_name']);
                    $tag['url'] = FU("style/" . ACTION_NAME, $tagurlpara);
                    $child_cate['tags'][] = $tag;
                }
                $category_tags[] = $child_cate;
            }
        }
        $condition = " WHERE sp.type = 'dapei' AND s.is_best = 1";
        $title = $category_data['short_name'];
        $is_match = false;
        $tag = urldecode($_FANWE['request']['tag']);
        if (!empty($tag)) {
            $_FANWE['nav_title'] = $tag . ' - ' . $_FANWE['nav_title'];
            $title = htmlspecialchars($tag);
            $is_match = true;
            $match_key = segmentToUnicode($tag, '+');
            $condition .= " AND match(sm.content_match) against('" . $match_key . "' IN BOOLEAN MODE) ";
            $page_args['tag'] = urlencode($tag);
        }
        //输出排序URL
        $sort_page_args = $page_args;
        $sort_page_args['sort'] = 'hot7';
        $hot7_url['url'] = FU('style/' . ACTION_NAME, $sort_page_args);
        if ($sort == 'hot7') {
            $hot7_url['act'] = 1;
        }
        $sort_page_args['sort'] = 'hot30';
        $hot30_url['url'] = FU('style/' . ACTION_NAME, $sort_page_args);
        if ($sort == 'hot30') {
            $hot30_url['act'] = 1;
        }
        $sort_page_args['sort'] = 'new';
        $new_url['url'] = FU('style/' . ACTION_NAME, $sort_page_args);
        if ($sort == 'new') {
            $new_url['act'] = 1;
        }
        $sort_page_args['sort'] = 'pop';
        $pop_url['url'] = FU('style/' . ACTION_NAME, $sort_page_args);
        if ($sort == 'pop') {
            $pop_url['act'] = 1;
        }
        if (!empty($_FANWE['request']['sort'])) {
            $page_args['sort'] = $sort;
        } else {
            $page_args['sort'] = 'pop';
        }
        $today_time = getTodayTime();
        $field = '';
        switch ($sort) {
            //7天最热 点击次数
            case 'hot7':
                $day7_time = $today_time - 604800;
                $field = ",(s.create_time > {$day7_time}) AS time_sort ";
                $sort = " ORDER BY time_sort DESC,s.click_count DESC";
                break;
                //30天最热 点击次数
            //30天最热 点击次数
            case 'hot30':
                $day30_time = $today_time - 2592000;
                $field = ",(s.create_time > {$day30_time}) AS time_sort ";
                $sort = " ORDER BY time_sort DESC,s.click_count DESC";
                break;
                //最新
            //最新
            case 'new':
                $field = '';
                $sort = " ORDER BY s.share_id DESC";
                break;
                //潮流  喜欢人数
            //潮流  喜欢人数
            case 'pop':
            default:
                $day7_time = $today_time - 604800;
                $field = ",(s.create_time > {$day7_time}) AS time_sort ";
                $sort = " ORDER BY time_sort DESC,s.collect_count DESC";
                break;
        }
        $sql = 'SELECT s.* ' . $field . '
				FROM ' . FDB::table('share_photo') . ' AS sp 
				INNER JOIN  ' . FDB::table('share') . ' AS s ON s.share_id = sp.share_id ';
        if ($is_match) {
            $sql .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id ';
        }
        $sql .= $condition . ' GROUP BY s.share_id ' . $sort;
        $sql_count = 'SELECT COUNT(DISTINCT s.share_id)
			FROM ' . FDB::table('share_photo') . ' AS sp 
				INNER JOIN  ' . FDB::table('share') . ' AS s ON s.share_id = sp.share_id ';
        if ($is_match) {
            $sql_count .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id ';
        }
        $sql_count .= $condition;
        $page_size = 20;
        $max_page = 100;
        $count = FDB::resultFirst($sql_count);
        if ($count > $max_page * $page_size) {
            $count = $max_page * $page_size;
        }
        if ($_FANWE['page'] > $max_page) {
            $_FANWE['page'] = $max_page;
        }
        $pager = buildPage('style/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], $page_size, '', 3);
        $share_datas = array();
        $sql = $sql . ' LIMIT ' . $pager['limit'];
        $share_list = FDB::fetchAll($sql);
        $share_list = FS('Share')->getShareDetailList($share_list, true, true, true, true);
        //本周最热时尚搭配
        $day7_time = $today_time - 604800;
        $sql = 'SELECT s.* ,(s.create_time > ' . $day7_time . ') AS time_sort 
			FROM ' . FDB::table('share_photo') . ' AS sp 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sp.share_id 
			WHERE sp.type = \'dapei\' AND s.is_best = 1 
			GROUP BY s.share_id 
			ORDER BY time_sort DESC,s.click_count DESC 
			LIMIT 0,5';
        $share_week_hots = FDB::fetchAll($sql);
        $share_week_hots = FS('Share')->getShareDetailList($share_week_hots, true, true, true, true);
        include template('page/style/style_index');
        display();
    }