Exemple #1
0
 function index()
 {
     //$data = array();
     $data['ci_top_title'] = '微件列表';
     $args = func_get_args();
     if (isset($args[2])) {
         $search = strip_tags(trim($args[2]));
         $search = urldecode($search);
     } else {
         $search = strip_tags(trim(v('search')));
     }
     $data['search'] = $search;
     $type = intval(v('type'));
     if ($args) {
         $mid = intval($args[0]);
     }
     if (!isset($mid) || $mid == '') {
         $mid = $type;
     }
     //
     if ($mid == '0') {
         $where = " AND `name` LIKE '%" . $search . "%' ";
         //$data['name'] = '全部范围';
     } elseif ($mid > '0') {
         $where = " AND `mid` = '" . intval($mid) . "' AND `name` LIKE '%" . $search . "%'";
         $name = lazy_get_var("SELECT `name` FROM `u2_plugs` WHERE 1 AND `id` = '" . intval($mid) . "'");
         if (!$name) {
             info_page('错误的组件ID');
         }
     } else {
         info_page('错误的组件ID');
     }
     $data['mid'] = $mid;
     $data['plugs_name'] = lazy_get_data("SELECT * FROM `u2_plugs`");
     $data['page'] = $page = !isset($args[1]) || intval($args[1]) < 1 ? 1 : intval($args[1]);
     $limit = 5;
     $start = ($page - 1) * $limit;
     $item = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs_widget` WHERE 1 {$where} ORDER BY `id` DESC  LIMIT {$start},{$limit}");
     $all = get_count();
     $data['item'] = $item;
     //$type = urlencode( $type );
     $base = '/plugs/index/' . $mid;
     $page_all = ceil($all / $limit);
     $text = urlencode($search);
     $data['pager'] = get_pager($page, $page_all, $base, $text);
     $data['is_admin'] = is_admin() ? true : false;
     $domain = _sess('domain');
     if ($domain != '') {
         $data['domain'] = $domain;
     }
     $this->view('list', $data);
 }
Exemple #2
0
function get_system_plugs_data($para = NULL)
{
    $para = unserialize($para);
    $page = 1;
    if (isset($para['args'])) {
        $page = intval(array_shift($para['args']));
    }
    $page = $page < 1 ? 1 : $page;
    $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;
    $start = ($page - 1) * $limit;
    $data['lines'] = 4;
    $apps = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs` WHERE `is_active` = 1 ORDER BY `has_widget` DESC LIMIT {$start},{$limit} ");
    $all = get_count();
    $wid = intval($GLOBALS['widget_id']);
    $page_all = ceil($all / $limit);
    $data['pager'] = get_widget_pager($wid, $page, $page_all);
    if ($apps) {
        foreach ($apps as $k => $v) {
            $aids[$v['aid']] = $v['aid'];
            $uids[$v['uid']] = $v['uid'];
        }
        if ($uids) {
            $data['names'] = get_name_by_uids($uids);
        }
        $data['aids'] = $aids;
        $data['apps'] = $apps;
    }
    $wids = lazy_get_data("SELECT * FROM `u2_plugs_widget`");
    if ($wids) {
        $data['wids'] = $wids;
    }
    $domain = _sess('domain');
    if ($domain != '') {
        $data['domain'] = $domain;
    }
    if (is_login()) {
        $data['is_login'] = true;
    }
    return $data;
}
Exemple #3
0
 function save()
 {
     check_login();
     $mail = z(v('email'));
     if (strpos(_sess('u2_email'), '@') !== false) {
         info_page('你使用是正确的email');
     }
     if (strpos($mail, '@') === false) {
         info_page('请填写正确的email');
     }
     $sql = "select count(*) from u2_user where LCASE(u2_email) = '" . strtolower($mail) . "' ";
     if (lazy_get_var($sql)) {
         info_page('该email已经有人使用了,请重新填写');
     }
     $this->load->database();
     $data['u2_email'] = $mail;
     $uid = format_uid();
     $this->db->where('id', $uid);
     $this->db->update('u2_user', $data);
     $this->load->library('session');
     $this->session->set_userdata('u2_email', $mail);
     info_page('补充E-mail信息成功,以后请用email登陆.', '/', '返回首页');
 }
Exemple #4
0
 private function save_view_infomation()
 {
     if (is_login()) {
         $new['time'] = time();
         $new['date'] = date("Y-m-d");
         if (_sess('statistics')) {
             $statistics = _sess('statistics');
             $staytime = time() - $statistics['time'];
             $secondes = intval(c('online_seconds')) < 60 ? 300 : intval(c('online_seconds'));
             if ($statistics['date'] == date("Y-m-d") && $staytime > 60 && $staytime < $secondes) {
                 if (_sess('online_date') == $statistics['date']) {
                     lazy_run_sql("update `u2_user` set `online_today` = `online_today` + {$staytime} , `onlinetime` = `onlinetime` + {$staytime} where `id` = '" . format_uid() . "' limit 1");
                 } else {
                     lazy_run_sql("update `u2_user` set `online_date` = '" . date("Y-m-d") . "' , `online_today` =  {$staytime} , `onlinetime` = `onlinetime` + {$staytime} where `id` = '" . format_uid() . "' limit 1");
                     $res['online_date'] = date("Y-m-d");
                 }
             } elseif ($statistics['date'] == date("Y-m-d") && $staytime < 60) {
                 $new = $statistics;
             }
         }
         $res['statistics'] = $new;
         set_sess($res);
         $this->load->database();
         $uid = format_uid();
         $data['u2_stay_time'] = date("Y-m-d H:i:s");
         $data['u2_stay_location'] = $_SERVER['REQUEST_URI'];
         $data['u2_sid'] = _sess('session_id');
         $data['u2_uid'] = $uid;
         $this->db->select('count(*)')->from('u2_online')->where('u2_uid', $uid);
         if (lazy_get_var()) {
             $this->db->where('u2_uid', $uid);
             $this->db->update('u2_online', $data);
         } else {
             $this->db->insert('u2_online', $data);
         }
     }
 }
Exemple #5
0
 function save($info, $extra = NULL)
 {
     if (is_array($extra)) {
         $data = $extra;
     }
     $data['u2_title'] = $info['u2_title'];
     $data['u2_desp'] = $info['u2_desp'];
     $data['u2_uid'] = format_uid();
     $data['u2_nickname'] = _sess('u2_nickname');
     $data['u2_addtime'] = date("Y-m-d H:i:s");
     $data['u2_hit'] = 0;
     $data['u2_pic'] = $info['u2_pic'];
     if (check_active()) {
         $data['u2_is_active'] = 1;
     } else {
         $data['u2_is_active'] = 0;
     }
     $data['u2_cate'] = $info['cate'];
     $this->db->insert('u2_content', $data);
     $id = $this->db->insert_id();
     $type = _text('system_pro');
     $desc = '<a href="/riki/display/' . $id . '" target="_blank">' . $info['u2_title'] . '</a>';
     add_to_manager('u2_content', $id, $desc, $type, $data['u2_is_active']);
 }
Exemple #6
0
if (!is_login()) {
    info_page('请登录后查看');
}
if (v('email') == NULL) {
    info_page('请输入转账账号');
}
$money = intval(v('money'));
if ($money < 1) {
    info_page('请输入正确的金额');
}
$touid = lazy_get_var("select id from u2_user where u2_email = '" . z(v('email')) . "' ", db());
if (!$touid) {
    info_page('没有此用户');
}
if ($touid == _sess('id')) {
    info_page('不能对自己转账.');
}
$now = lazy_get_var("SELECT g FROM `app_ihome_user` WHERE `uid` = '" . format_uid() . "' LIMIT 1");
if ($now < $money) {
    info_page('你身上没有足够的现金.');
}
$sql = "update app_ihome_user set g = g - {$money} WHERE `uid` = '" . format_uid() . "' LIMIT 1";
lazy_run_sql($sql);
$sql = "select * from app_ibank_account where uid='{$touid}' limit 1";
if (is_array(lazy_get_line($sql))) {
    $sql = "update app_ibank_account set g_count = g_count + {$money} where uid='{$touid}' limit 1 ";
} else {
    ${$key} = $money;
    $sql = "insert into app_ibank_account (uid , g_count , glod_count )values ( '{$touid}','{$money}','0' ) ";
}
Exemple #7
0
 function save_user_profile($uid = NULL)
 {
     $id = format_uid($uid);
     if (z(v('nick_name')) != _sess('u2_nickname')) {
         $check = lazy_get_var("select count(*) from u2_user where LCASE(u2_nickname) = '" . strtolower(z(v('nick_name'))) . "' and id != '{$id}' ");
         if ($check) {
             return false;
         }
     }
     $this->db->where('id', $id);
     $data = array();
     $data['u2_nickname'] = z(v('nick_name'));
     $data['u2_true_name'] = z(v('true_name'));
     $data['u2_sex'] = z(v('sex'));
     $data['u2_msn'] = z(v('msn'));
     $data['u2_qq'] = z(v('qq'));
     $data['u2_mobile'] = z(v('mobile'));
     $data['u2_city'] = z(v('city'));
     $data['u2_address'] = z(v('address'));
     $data['u2_zipcode'] = z(v('zipcode'));
     //$data['u2_desp'] = v('status');
     $this->db->update('u2_user', $data);
     set_sess($data);
     return true;
 }
Exemple #8
0
if (!$forum) {
    info_page('错误的论坛id');
}
$now = date("Y-m-d H:i:s");
lazy_run_sql("update `app_iforum_posts` set `reply` = `reply` + 1 , `last_post_time` = '{$now}' ,`last_uid` = '" . format_uid() . "' WHERE id = '{$id}' AND `is_active` = 1 AND `parent_id` = '0' LIMIT 1");
global $CI;
$CI->load->database();
$data['fid'] = $check['fid'];
$data['parent_id'] = $id;
$data['title'] = '';
$data['desp'] = r($desp);
$data['floor'] = intval(v('floor'));
$data['last_uid'] = $data['uid'] = format_uid();
$data['last_post_time'] = $data['time'] = $now;
$CI->db->insert('app_iforum_posts', $data);
$count = lazy_get_var("select count(*) from `app_iforum_posts`  WHERE fid = '{$data['fid']}' AND `parent_id` = '{$id}' AND `is_active` = 1 AND `parent_id` != '0' ");
$page_all = ceil($count / $limit);
$rid = intval(v('rid'));
if (!$rid) {
    $nuid = $check['uid'];
} else {
    $temp = lazy_get_var("SELECT `uid` FROM `app_iforum_posts` WHERE id = '{$rid}' AND `is_active` = 1 AND `parent_id` = '{$id}' LIMIT 1");
    $nuid = $temp ? $temp : $check['uid'];
}
if ($nuid != format_uid()) {
    $title = '<a href="/user/space/' . format_uid() . '" target="_blank">' . _sess('u2_nickname') . '</a>回复了主题<a href="/app/native/iforum/display/' . $id . '/' . $page_all . '/" target="_blank">' . strip_tags($check['title']) . '</a>';
    send_to_notice($nuid, 'iforum', $title);
}
$title = '<a href="/user/space/' . format_uid() . '" target="_blank">' . _sess('u2_nickname') . '</a>回复了主题<a href="/app/native/iforum/display/' . $id . '/" target="_blank">' . strip_tags($check['title']) . '</a>';
send_to_feed(format_uid(), 'iforum', $title);
header("Location: /app/native/iforum/display/" . $id . "/" . $page_all . "/" . $return_page . '/' . $return_key);
Exemple #9
0
function check_active()
{
    global $CI;
    if (_sess('u2_level') < $CI->config->item('pro_no_check_level')) {
        return 0;
    } else {
        return 1;
    }
}
Exemple #10
0
 function shop_update_rreply($id)
 {
     if (!is_admin()) {
         die("<script>alert('你没有权限进行此操作')</script>");
     }
     $id = intval($id);
     $line = lazy_get_line("select * from `u2_shop_replys` where `id` = '{$id}' limit 1 ");
     if (!$line) {
         die("<script>alert('错误的参数')</script>");
     }
     $rinfo = trim(strip_tags(v('rinfo')));
     if ($rinfo == NULL) {
         die("<script>alert('请填写留言内容')</script>");
     }
     lazy_run_sql("update `u2_shop_replys` set `rinfo` = " . s($rinfo) . " ,`ruid`='" . format_uid() . "' , `rtime`='" . date("Y-m-d H:i:s") . "' where `id` = '{$id}'  limit 1");
     die("<script>\$('rreply_item_" . $id . "').setHTML('<br/><a href=\"/user/space/" . format_uid() . "\" target=\"_blank\" style=\"color:orange\">" . _sess('u2_nickname') . "</a>回复: " . str_replace("\n", "", nl2br(addslashes($rinfo))) . "<a href=\"JavaScript:void(0)\" onclick=\"show_shop_rreply_div(" . $id . ",this)\"><img src=\"/static/images/updates.gif\" alt=\"修改\"/></a>')</script>");
 }
Exemple #11
0
 function modify($id = NULL)
 {
     check_admin();
     $data = NULL;
     if ($id) {
         $pro = $this->pro->load_item(intval($id));
         if (!$pro) {
             info_page(_text('system_error_id'));
         }
         if ($pro['u2_uid'] != _sess('u2_uid') && !is_admin()) {
             info_page(_text('system_limit_rights'));
         }
         $data['pro'] = $pro;
         $data['added'] = null;
         $data['cates'] = load_cates();
         $meta_field = $this->pro->load_meta_field($data['pro']['u2_cate']);
         if ($meta_field) {
             foreach ($meta_field as $m) {
                 $temp['key'] = $m['u2_en_name'];
                 $temp['value'] = $data['pro'][$m['u2_en_name']];
                 $temp['name'] = $m['u2_cn_name'];
                 $data['added'][] = $temp;
             }
         }
     } else {
         info_page(_text('system_error_id'));
     }
     $this->view('modify', $data);
 }
Exemple #12
0
 function wall()
 {
     $uid = intval(v('uid'));
     $content = n(v('content'));
     // check if is empty
     if ($uid > 0 && $content != '') {
         $this->user->wall_save($uid, format_uid(), $content);
         send_to_notice($uid, 'system_guestbook', '<a href="/user/space/' . format_uid() . '">' . _sess('u2_nickname') . '</a>给你留言了 ', '<img src="/static/images/quote_left.gif" />&nbsp;<a href="/user/space#">' . word_substr($content, 15) . '</a>&nbsp;<img src="/static/images/quote_right.gif" />');
         $uname = $this->user->get_nickname_by_uid($uid);
         $title = '<a href="/user/space/' . format_uid() . '">' . _sess('u2_nickname') . '</a>给<a href="/user/space/' . $uid . '#wall">' . $uname . '</a>留言了';
         $desp = word_substr($content, 15);
         send_to_feed(format_uid(), 'system_miniblog', $title, $desp);
     }
     header('Location: /user/space/' . $uid);
 }
Exemple #13
0
 function touser($id)
 {
     $this->check_admin();
     $user = $this->admin->get_user_by_uid($id);
     if (!$user) {
         info_page(_text('user_error_login_bad_uid'));
         die;
     } elseif ($user['u2_level'] >= _sess('u2_level')) {
         info_page(_text('system_limit_rights'));
         die;
     }
     set_sess($user);
     header('Location: /');
 }
Exemple #14
0
$data = array();
$data['type'] = $type;
$data['link'] = $url;
$data['time'] = date("Y-m-d H:i:s");
$data['desp'] = $desp;
switch ($type) {
    case VIDEO:
        $info = parse_url($url);
        $data['video_domain'] = $info['host'];
        $cnname = '视频';
        break;
    case MUSIC:
        $data['music_url'] = $url;
        $cnname = '音乐';
        break;
    case WEBPAGE:
        $cnname = '网页';
        break;
}
$data['uid'] = format_uid();
global $CI;
$CI->load->database();
$CI->db->insert('app_fav', $data);
$aid = $CI->db->insert_id();
if ($aid) {
    $aname = 'ishare';
    $appname = get_app_name_with_aid($aname);
    $title = '<a href="/user/space/' . format_uid() . '" target="_blank">' . _sess('u2_nickname') . '</a>' . $appname . '了一个<a href="/app/native/' . $aname . '/show/' . $aid . '/" target="_blank">' . $cnname . '</a>';
    send_to_feed(format_uid(), 'ishare', $title, mb_substr($data['desp'], 0, 20, 'utf-8'));
}
header('Location: /app/native/' . $GLOBALS['app'] . '/index');
Exemple #15
0
			<TD valign="top" style="padding:10px;"><img src="http://' . $_SERVER['HTTP_HOST'] . show_user_icon('big') . '" style="border:1px solid #c8c8c8;padding:1px;"></TD>
			<TD valign="top" style="padding:10px;">
			
				<p><strong>亲爱的朋友,我是' . _sess('u2_nickname') . '~</strong></p>
				
				最近我加入了 ' . c('site_name') . ' ,每天在这里种仙豆养宠物,感觉还不错哦.你也来和我一起玩,顺便帮我挣点银币吧,呵呵.<br/>

				<br/>点下边的链接就可以了,我会仔细的给你做向导的哦~<br/><br/>
				<a href="http://' . $_SERVER['HTTP_HOST'] . '/gate/index/' . $icode . '">http://' . $_SERVER['HTTP_HOST'] . '/gate/index/' . $icode . '</a>
				<p>如果点击无效,你可以复制上边的链接,粘贴到地址栏,再按回车就行了</p><br/>
				<p>邀请函我好不容易才弄到的呢,如果你没兴趣的话,就转发给你的朋友吧~</p>
			</TD>
		</TR>
		</TABLE>';
        /*
        		$message = '<TABLE><TR><TD valign="top"><img src="http://'.$_SERVER['HTTP_HOST'].show_user_icon('big').'" style="border:1px solid #c8c8c8;padding:1px;"></TD><TD valign="top" style="padding:10px;"><b>你好我是'._sess('u2_nickname').'我在'.c('site_name').'上建立了个人主页,请你也加入并成为我的好友。</b><br/><br/>请点击以下链接,接受好友邀请:<br/><a href="http://'.$_SERVER['HTTP_HOST'].'/gate/index/'.$icode.'">http://'.$_SERVER['HTTP_HOST'].'/gate/index/'.$icode.'</a></TD></TR></TABLE>';*/
        if (!sendmail($v, $title, $message, _sess('u2_email'))) {
            die('邮件系统不可用,请稍候在试');
        }
        $i++;
    }
    $sql = "update u2_invite set u2_is_copied = '1' where id in (" . join(',', $copyid) . ")";
    lazy_run_sql($sql);
    $sql = "delete from app_iinvite_emails where uid = '" . format_uid() . "' ";
    lazy_run_sql($sql);
    die('发送邮件成功.');
} else {
    die('网站目前不允许注册');
}
?>
 
Exemple #16
0
 function change_level($ids, $level)
 {
     $iid = join(',', $ids);
     $data['u2_level'] = intval($level);
     $mylevel = _sess('u2_level');
     if ($mylevel != 9) {
         $this->db->where("`u2_level` < '" . intval($mylevel) . "'");
     }
     $this->db->where("`id` IN (" . $iid . ")");
     $this->db->update('u2_user', $data);
     $this->db->select('u2_sid')->from('u2_online')->where("`u2_uid` IN (" . $iid . ")");
     $users = lazy_get_data();
     if ($users) {
         $mysid = session_id();
         foreach ($users as $u) {
             if ($u['u2_sid']) {
                 session_id($u['u2_sid']);
                 session_destroy();
             }
         }
         session_id($mysid);
     }
 }
Exemple #17
0
 private function save_viewed_item($id)
 {
     $id = intval($id);
     if ($id > 0) {
         $shopinfo = _sess('shopinfo');
         $viewed = isset($shopinfo['viewed']) ? $shopinfo['viewed'] : array();
         if (!in_array($id, $viewed)) {
             while (count($viewed) >= 5) {
                 array_shift($viewed);
             }
             $viewed[] = $id;
         }
         $shopinfo['viewed'] = $viewed;
         $data['shopinfo'] = $shopinfo;
         set_sess($data);
     }
 }