Ejemplo n.º 1
0
function get_iforum_restore_data($para = NULL)
{
    $uid = format_uid();
    $para = unserialize($para);
    $data['title'] = isset($para['title']) && strip_tags($para['title']) != '' ? strip_tags($para['title']) : '我回复的';
    $limit = isset($para['limit']) && intval($para['limit']) > 0 ? intval($para['limit']) : 5;
    $data['new_page'] = isset($para['new_page']) && intval($para['new_page']) > 0 ? intval($para['new_page']) : 0;
    $days = isset($para['days']) && intval($para['days']) > 0 ? intval($para['days']) : 0;
    if ($days == 0 || $days == '') {
        $days = NULL;
    } else {
        $day = date('Y-m-d H:i:s', strtotime(' - ' . $days . ' days '));
        $days = " AND `time` > '{$day}' ";
    }
    $uids = lazy_get_vars("SELECT `parent_id` FROM `app_iforum_posts`  WHERE `parent_id` > 0 AND `uid` = '" . intval($uid) . "' AND `del_uid` = '0' {$days} GROUP BY `parent_id` ORDER BY `id` DESC LIMIT  {$limit}");
    $list = array();
    if ($uids) {
        $list = lazy_get_data("SELECT * FROM `app_iforum_posts` WHERE `id` IN (" . join(',', $uids) . ") and `parent_id` = 0 AND `is_active` = '1' ORDER BY `last_post_time` DESC LIMIT {$limit}");
        foreach ($list as $v) {
            $uids[$v['uid']] = $v['uid'];
            $uids[$v['last_uid']] = $v['last_uid'];
        }
        $data['names'] = get_name_by_uids($uids);
    }
    $data['list'] = $list;
    return $data;
}
Ejemplo n.º 2
0
function get_view_uids($mid, $cid, $limit = 5)
{
    $uids = lazy_get_vars("select `uid` from `u2_app_view` where `mid` = '{$mid}' and `cid` = '{$cid}' order by `id` desc limit {$limit}");
    if (is_login()) {
        $sql = "replace into `u2_app_view` (`mid`,`cid`,`uid`,`time`)values('{$mid}','{$cid}','" . format_uid() . "','" . date("Y-m-d H:i:s") . "')";
        lazy_run_sql($sql);
    }
    return $uids;
}
Ejemplo n.º 3
0
if (file_exists(dirname(__FILE__) . '/snap.info.txt')) {
    $snap = unserialize(file_get_contents(dirname(__FILE__) . '/snap.info.txt'));
}
foreach ($item as $ik => $iv) {
    $snap_content = isset($snap[$iv['fid']]) ? true : false;
    $item[$ik]['desp'] = format_contents($iv['desp'], $snap_content);
}
$data['item'] = $item;
$times = array();
$diged = array();
if ($item) {
    foreach ($item as $k => $v) {
        $times[$v['id']] = time2Units($v['time']);
        $iids[] = $v['id'];
    }
    $diged = lazy_get_vars("select `iid` from `app_feed_dig` where `uid` = '" . format_uid() . "' and `iid` IN(" . join(',', $iids) . ") ");
}
$data['diged'] = $diged;
$data['times'] = $times;
//分页
$base = '/app/native/ifeedig/index/' . $titleid . '/' . $day . '/' . $hit;
$page_all = ceil($all / $limit);
$data['pager'] = get_pager($page, $page_all, $base);
$feed = lazy_get_data("SELECT * FROM `app_feed`");
if ($feed) {
    foreach ($feed as $k => $v) {
        $by[$v['id']] = $v['title'];
    }
    $data['by'] = $by;
}
$fdig = lazy_get_data("SELECT * FROM `app_feed_dig`");
Ejemplo n.º 4
0
 function get_wishlist_with_ids($sids, $type)
 {
     $data = array();
     if (!is_login() || !$sids || !is_array($sids)) {
         return $data;
     }
     $uid = format_uid();
     $type = intval($type) == 2 ? 2 : 1;
     $data = lazy_get_vars("select `cid` from `u2_shop_wishlist` where `type` = '{$type}' and `uid` = '{$uid}' and `cid` IN(" . join(',', $sids) . ") ");
     return $data;
 }
Ejemplo n.º 5
0
include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
    info_page('请登录后查看');
}
$id = intval(array_shift($args));
if ($id < 1) {
    info_page('错误的id');
}
$text = urldecode(array_shift($args));
if (!$text) {
    info_page('错误的参数');
}
$page = intval(array_shift($args));
$page = $page < 1 ? 1 : $page;
$limit = 5;
$start = ($page - 1) * $limit;
$base = '/app/native/' . $GLOBALS['app'] . '/votepeople/' . $id . '/' . urlencode($text);
$data = array();
$data['text'] = $text;
$data['ci_top_title'] = '谁' . $text . '这' . app_config('model_name');
$uids = lazy_get_vars("select sql_calc_found_rows `uid` from `u2_vote` where `text` = '{$text}' and `tid` = '{$id}' and `mid` = '{$mid}' limit {$start} , {$limit}");
$all = get_count();
$page_all = ceil($all / $limit);
$data['id'] = $id;
if ($uids) {
    $data['names'] = get_name_by_uids($uids);
} else {
    info_page('错误的参数');
}
$data['pager'] = get_pager($page, $page_all, $base);
layout($data, 'default', 'app');