示例#1
0
 function add_page($page_info)
 {
     $this->db->select('COUNT(*)')->from('u2_page')->where('u2_tag', $page_info['page_title']);
     $data['u2_link'] = NULL;
     if (lazy_get_var()) {
         return false;
     }
     $data = $this->get_page_data($page_info);
     $this->db->select('MAX(u2_order)')->from('u2_page');
     $data['u2_order'] = lazy_get_var() + 1;
     $data['u2_is_system'] = '0';
     $data['u2_in_tab'] = '1';
     $this->db->insert('u2_page', $data);
     return $this->db->insert_id();
 }
示例#2
0
 function add($keywords, $modules, $sid)
 {
     // 检查是否存在
     $data = array();
     $data['sid'] = $sid;
     $data['keywords'] = $keywords;
     $data['modules'] = $modules;
     $data['created'] = date("Y-m-d H:i:s");
     $this->db->select('count(*) as c')->from('s_conf')->where('sid', $sid);
     if (lazy_get_var() > 0) {
         $this->db->where('sid', $sid);
         return $this->db->update('s_conf', $data);
     } else {
         return $this->db->insert('s_conf', $data);
     }
 }
示例#3
0
 function form_save()
 {
     $this->check_admin();
     $name = z(v('name'));
     $title = z(v('title'));
     if (!$name || !$title) {
         info_page('英文标示和标题不能为空');
     }
     $path = 'application/app/' . $name . '/';
     if (is_dir(ROOT . $path)) {
         info_page($path . '目录已被占用');
     }
     $count = lazy_get_var("select count(*) from `w2_form` where `name` = '{$name}' ");
     if ($count) {
         info_page('英文唯一标示已被占用!');
     }
     $this->form->save();
 }
示例#4
0
文件: extra.php 项目: yunsite/easysns
 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登陆.', '/', '返回首页');
 }
示例#5
0
 function check_pincode($uid, $pincode)
 {
     $id = format_uid($uid);
     $this->db->select('count(*)')->from('u2_user')->where('id', $id)->where('u2_pincode', $pincode);
     return lazy_get_var();
 }
示例#6
0
<?php

include_once dirname(__FILE__) . '/function.php';
$data['ci_top_title'] = 'ITEM列表';
if (!is_login()) {
    info_page('请登录后查看');
}
if (!is_admin()) {
    info_page('你没有权限进行操作!');
}
$fid = intval(array_shift($args));
if (!isset($fid) || $fid < 1) {
    info_page("参数错误!");
}
$fnum = lazy_get_var("SELECT COUNT(*) FROM `app_feed` WHERE `id` = '" . intval($fid) . "'");
if ($fnum == '0') {
    info_page("没有此条Feed!");
}
$data['items'] = lazy_get_data("SELECT sql_calc_found_rows * FROM `app_feed_item` WHERE `fid` = '" . intval($fid) . "' LIMIT 10");
$data['count'] = get_count();
$data['fid'] = $fid;
layout($data, 'default', 'app');
?>
 

示例#7
0
文件: del.php 项目: yunsite/easysns
<?php

if (!is_login()) {
    die('请登陆后操作');
}
include_once dirname(__FILE__) . '/function.php';
$id = intval(array_shift($args));
$floor = intval(array_shift($args));
$line = lazy_get_line("SELECT * FROM `app_iforum_posts` WHERE id = '{$id}' AND `is_active` = 1 LIMIT 1");
if (!$line) {
    die('错误的参数');
}
$post_uid = $line['parent_id'] ? lazy_get_var("SELECT `uid` FROM `app_iforum_posts` WHERE id = '{$line['parent_id']}' AND `parent_id` = '0' AND `is_active` = 1 LIMIT 1") : $line['uid'];
$uid = format_uid();
if (!is_admin() && $uid != $line['uid'] && $uid != $post_uid) {
    die('你没有权限进行此操作');
}
$del_uid = $uid;
lazy_run_sql("update `app_iforum_posts` set `del_uid` = '{$uid}' WHERE id = '{$id}' LIMIT 1 ");
echo '成功删除文章';
$name = $uid == $post_uid ? '楼主' : ($uid == $line['uid'] ? '发布者' : '管理员');
$js_data[] = '$("display_img_' . $id . '").setHTML("")';
$js_data[] = '$("display_info_' . $id . '").setHTML(\'<span class="r">' . show_floor($floor) . '</span><del>该楼已被' . $name . '删除</del>\')';
echo '<script>' . join(';', $js_data) . ';</script>';
?>
 
示例#8
0
function check_app_install($id)
{
    $sql = "SHOW TABLES LIKE 'app_content_" . intval($id) . "' ";
    return lazy_get_var($sql);
}
示例#9
0
<?php

include_once dirname(__FILE__) . '/function.php';
$data['ci_top_title'] = '添加Feed';
if (!is_login()) {
    info_page('请登录后查看');
}
if (!is_admin()) {
    info_page('你没有权限进行操作!');
}
$feed_id = intval(array_shift($args));
if ($feed_id != '0') {
    $feed = lazy_get_var("SELECT `feed` FROM `app_feed_recommend` WHERE `id` = '" . $feed_id . "' LIMIT 1");
} else {
    $feed = v('fblog');
    if (!$feed || $feed == 'http://') {
        info_page('你提交的博客地址错误');
    }
    if (strpos($feed, 'http://') === false) {
        $feed = 'http://' . $feed;
    }
}
$CI =& get_instance();
$CI->load->library('simplepie');
MakeDir(ROOT . 'static/data/cache');
$CI->simplepie->set_cache_location(ROOT . 'static/data/cache');
$CI->simplepie->set_feed_url($feed);
$CI->simplepie->init();
$data['ftitle'] = $CI->simplepie->get_title();
//标题
$flink = $CI->simplepie->get_link();
示例#10
0
文件: index.php 项目: yunsite/easysns
}
$data = array();
$data['ci_top_title'] = '分享';
$view_type = array_shift($args);
if ($view_type == 'friends') {
    $fid = get_friends_by_uid();
    if ($fid) {
        $where = " uid IN ( " . join(' , ', $fid) . " ) ";
    } else {
        $where = " 0 ";
    }
} elseif ($view_type == 'self') {
    $where = " uid = '" . format_uid() . "' ";
} else {
    $view_type = 'all';
    $where = " 1 ";
}
$data['view_type'] = $view_type;
$page = array_shift($args);
$page = intval($page) < 1 ? 1 : intval($page);
$limit = '10';
$start = ($page - 1) * $limit;
$data['fav'] = lazy_get_data("SELECT sql_calc_found_rows *,f.id as fid  FROM `app_fav` as f LEFT JOIN `u2_user` as u ON ( f.uid = u.id ) WHERE {$where} ORDER BY `time` DESC  LIMIT {$start} , {$limit} ");
$sql = "select found_rows()";
$all = lazy_get_var($sql);
$base = '/app/native/ishare/index/' . $view_type;
$page_all = ceil($all / $limit);
$data['pager'] = get_pager($page, $page_all, $base);
//$data['user'] = lazy_get_data( "SELECT * FROM `u2_user` LIMIT 1" );
//echo '123';
layout($data, 'default', 'app');
示例#11
0
文件: ajax.php 项目: yunsite/easysns
 function admin_shop_del($action, $id)
 {
     $this->is_admin();
     $array = array('brands', 'type');
     if (in_array($action, $array)) {
         $id = intval($id);
         lazy_run_sql("delete from `u2_shop_" . $action . "` where `id` = '{$id}' limit 1");
     }
     if ($action == 'type') {
         lazy_run_sql("delete from `u2_shop_items` where `type` = '{$id}'");
         $eid = lazy_get_var("SHOW TABLES LIKE 'shop_extra_" . intval($id) . "' ");
         if ($eid) {
             lazy_run_sql("DROP TABLE `shop_extra_" . intval($id) . "`");
         }
     }
     if ($action == 'cate') {
         $count = lazy_get_var("select count(*) from `u2_shop_cate` where `pid` = '{$id}' limit 1");
         if ($count) {
             die('此分类下有其他分类,不能删除此分类');
         }
         $count = lazy_get_var("select count(*) from `u2_shop_items` where `type` = '{$id}' limit 1");
         if ($count) {
             die('此分类下有商品,不能删除此分类');
         }
         lazy_run_sql("delete from `u2_shop_cate` where `id` = '{$id}' limit 1");
     }
 }
示例#12
0
<?php

include_once dirname(__FILE__) . '/function.php';
$data['ci_top_title'] = '验证文章信息成功!';
if (!is_login()) {
    info_page('请登录后查看');
}
if (!is_admin()) {
    info_page('你没有权限进行操作!');
}
$num = lazy_get_var("SELECT COUNT(*) FROM `app_feed_item` WHERE `state` = '1'");
if ($num == '0') {
    info_page('没有需要验证的文章!!', '/app/native/' . $GLOBALS['app'] . '/item/1/all');
}
lazy_run_sql("UPDATE `app_feed_item` SET `state` = '2'");
info_page('验证文章信息成功!!', '/app/native/' . $GLOBALS['app'] . '/item/1/all');
示例#13
0
    $i++;
}
$ware = serialize($ware);
$money_end = $money_sum * ($agio / 100);
//应付
$stint = $money_sum - $money_end;
//节省
$data = array();
$data['toname'] = $toname;
$data['totell'] = $totell;
$data['tocode'] = intval($tocode);
$data['tohome'] = $tohome;
$data['need'] = $need;
$data['carry_type'] = intval($carry);
$data['pack_type'] = intval($pack);
$data['ware'] = $ware;
$data['money'] = $money_end;
$data['stint'] = $stint;
global $CI;
$CI->load->database();
$CI->db->where('id', $id);
$CI->db->update('app_shoporder', $data);
$name_num = lazy_get_var("SELECT COUNT(*) FROM `app_shopuser` WHERE `uid` = '" . intval($uid) . "' AND `name` = " . s($toname) . " ");
if ($name_num == '0') {
    $sql = "INSERT INTO `app_shopuser` (`uid`, `name`, `tell`, `code`, `home`) VALUES";
    $sql .= "('" . intval($uid) . "' , " . s($toname) . ", " . s($totell) . ", '" . intval($tocode) . "', " . s($tohome) . ")";
    lazy_run_sql($sql);
} else {
    lazy_run_sql("UPDATE `app_shopuser` SET `tell` = " . s($totell) . " , `code` = '" . intval($tocode) . "', `home` = " . s($tohome) . " WHERE `id` = '" . intval($suid) . "'");
}
header('Location: /app/native/' . $GLOBALS['app'] . '/order_modify/' . $id);
示例#14
0
文件: del.php 项目: yunsite/easysns
<?php

include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
    info_page('请登录后查看');
}
$cid = intval(array_shift($args));
$uid = format_uid();
$num = lazy_get_var("SELECT `uid` FROM `app_content_{$mid}` WHERE `id` = '" . intval($cid) . "' limit 1");
if (!$num) {
    info_page('错误的参数');
}
if ($num != $uid) {
    info_page('您没有权限进行此操作');
}
$com = lazy_get_var("SELECT COUNT(*) FROM `u2_comment` WHERE `tid` = '" . intval($cid) . "'");
if ($com != '0') {
    lazy_run_sql("DELETE FROM `u2_comment` WHERE `tid` = '" . $cid . "'");
    lazy_run_sql("DELETE FROM `u2_comment_vote` WHERE `tid` = '" . $cid . "'");
    lazy_run_sql("DELETE FROM `u2_comment_reply` WHERE `tid` = '" . $cid . "'");
}
lazy_run_sql("DELETE FROM `app_content_{$mid}` WHERE `id` = '" . intval($cid) . "'");
lazy_run_sql("DELETE FROM `u2_comment_reply` WHERE `tid` = '" . $cid . "'");
lazy_run_sql("DELETE FROM `u2_manager` WHERE `tid` = '" . intval($cid) . "' AND `u2_table` = 'app_content_{$mid}' ");
lazy_run_sql("DELETE FROM `u2_rate` WHERE `cid` = '" . intval($cid) . "' AND `mid` = '{$mid}' ");
info_page('成功删除' . app_config('model_name'), '/app/native/' . $GLOBALS['app'] . '/', '返回');
?>
	
示例#15
0
文件: admin.php 项目: yunsite/easysns
 private function shop_update_type($args)
 {
     $id = intval(array_shift($args));
     $line = $this->admin->get_shop_type_by_id($id);
     if (!$line) {
         info_page('此商品类型已被删除', '/admin/shop/add/type/', '添加商品类型');
     }
     $data['name'] = z(v('name'));
     if (!$data['name']) {
         info_page('请填写商品类型名称');
     }
     if ($line['name'] != $data['name']) {
         if ($this->admin->check_shop_type($data['name'])) {
             info_page("错误, 已存在此商品类型");
         }
     }
     $brand_array = v('brand');
     if (v('all_brand')) {
         $brand_array = array();
     }
     $extra_field = v('extra_field');
     $field = array();
     $sql_fields = array();
     if ($extra_field) {
         foreach ($extra_field as $v) {
             if ($v) {
                 $v = unserialize(base64_decode($v));
                 $field[$v['id']] = $v;
                 $sql_fields[] = '`extra_' . $v['id'] . '` varchar( 255 ) NULL';
             }
         }
     }
     $extra['field'] = $field;
     $extra['brands'] = $brand_array;
     $data['extra'] = serialize($extra);
     $this->admin->update_shop_type($data, $id);
     $new = $field;
     $line['extra'] = unserialize($line['extra']);
     $old = $line['extra']['field'];
     if (!$new) {
         $eid = lazy_get_var("SHOW TABLES LIKE 'shop_extra_" . intval($id) . "' ");
         if ($eid) {
             lazy_run_sql("DROP TABLE `shop_extra_" . intval($id) . "`");
         }
     } elseif (!$old && $sql_fields) {
         lazy_run_sql('CREATE TABLE IF NOT EXISTS `shop_extra_' . $line['id'] . '`(`id` int(11) NOT NULL auto_increment,`cid` int(11) NOT NULL ,' . join(',', $sql_fields) . ' ,PRIMARY KEY  (`id`) ) ENGINE=MyISAM ;');
     } else {
         $acts = array();
         foreach ($new as $v) {
             if (isset($old[$v['id']])) {
                 unset($old[$v['id']]);
             } else {
                 $acts[] = 'ADD `extra_' . $v['id'] . '` VARCHAR( 255 ) NULL ';
             }
         }
         if ($old) {
             foreach ($old as $v) {
                 $acts[] = 'DROP `extra_' . $v['id'] . '`';
             }
         }
         if ($acts) {
             lazy_run_sql("ALTER TABLE `shop_extra_" . intval($id) . "` " . join(',', $acts) . ";");
         }
     }
     info_page("修改商品类型成功", '/admin/shop/modify/type/' . $id, '返回');
 }
示例#16
0
文件: plugs.php 项目: yunsite/easysns
 function widgets_update()
 {
     if (!is_login()) {
         info_page('请登录后查看');
     }
     if (!is_admin()) {
         info_page('你没有权限进行操作!');
     }
     $id = intval(v('id'));
     $name = strip_tags(trim(v('name')));
     $desp = strip_tags(v('desp'));
     $pic = strip_tags(v('plugs_file'));
     $big_pic = strip_tags(v('plugsbig_file'));
     if ($id < 1) {
         info_page('微件ID错误!');
     }
     $mid = lazy_get_var("SELECT `mid` FROM `u2_plugs_widget` WHERE `id` = '" . intval($id) . "'");
     if (!$mid) {
         info_page('微件ID错误!');
     }
     if ($name == '') {
         info_page('微件名称不能为空!');
     }
     if ($desp == '') {
         info_page('请填写微件简介!');
     }
     $widgets_update = "UPDATE `u2_plugs_widget` SET `name` = " . s($name) . ", `pic` = " . s($pic) . ", `big_pic` = " . s($big_pic) . ",";
     $widgets_update .= "`desp` = " . s($desp) . ", `time` = '" . date('Y-m-d') . "' ";
     $widgets_update .= "WHERE `id` = '" . intval($id) . "'";
     //echo $widgets_update;
     lazy_run_sql($widgets_update);
     info_page('修改成功!', '/plugs/index/' . $mid, '| 返回');
 }
示例#17
0
<?php

include_once dirname(__FILE__) . '/function.php';
$sql = "select `u2_folder` from `u2_app` where `aid` = 'ishopcart' limit 1 ";
$folder = lazy_get_var($sql);
$id = intval(array_shift($args));
$html = NULL;
if ($folder && isset($bind['price'])) {
    $html = '<INPUT TYPE="button" class="button" onclick="location=\'/app/native/' . $folder . '/insert/' . $GLOBALS['app'] . '/' . $id . '\'" value=" 加入购物车 ">';
}
echo $html;
示例#18
0
文件: carry.php 项目: yunsite/easysns
$js_data = array();
$use = '装备';
$count = lazy_get_var("select `count` from `global_user_items` where `uid` = '{$uid}' and `iid` = '{$id}' limit 1");
if ($count < 1) {
    die('你没有此物品');
}
$item = lazy_get_line("select * FROM `global_items` WHERE `id` = '{$id}' limit 1 ");
if (!$item) {
    die('没有找道具资料');
}
//装备检查
$weared = lazy_get_var("select count(*) from `global_items_carry` where `iid`='{$id}' and `uid` = '{$uid}' ");
if ($weared) {
    die('你已经携带了此道具');
}
$weared_count = lazy_get_var("select count(*) from `global_items_carry` where `uid` = '{$uid}' ");
if ($weared_count >= 5) {
    die('你已经不能再携带东西了');
}
if ($count == '1') {
    lazy_run_sql("DELETE FROM `global_user_items`  WHERE `uid` ='{$uid}' and `iid` = '{$id}' limit 1 ");
    $js_data[] = '$("item_' . $id . '").remove()';
    $js_data[] = '$("baggage_count").value =parseInt($("baggage_count").value) - 1 ';
} else {
    lazy_run_sql("UPDATE `global_user_items` SET `count` = `count` - 1  WHERE `uid` = '{$uid}' and `iid` = '{$id}' limit 1 ");
    $js_data[] = '$("item_count_value_' . $id . '").value = parseInt($("item_count_value_' . $id . '").value ) - 1 ';
    $js_data[] = '$("item_count_' . $id . '").innerHTML =$("item_count_value_' . $id . '").value';
}
lazy_run_sql("INSERT INTO `global_items_carry` (`uid` , `iid` ,`taked` )VALUES('{$uid}','{$item['id']}' , '0' )  ");
$js_data[] = 'ihome_carry_item("' . $id . '","' . $item['pic'] . '" ,"' . $item['desp'] . '")';
//$js_data[] = '$("wear_'.$item['type'].'").setHTML("<a href=\"JavaScript:irpg_unset_item('.$item['id'].')\"><img src=\''.$item['pic'].'\' alt=\"'.$item['desp'].'\" /></a>")';
示例#19
0
    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' ) ";
}
lazy_run_sql($sql);
info_page('已成功转账到您的指定的用户.', '/app/native/ibank/transfer');
示例#20
0
function user_value_sub($field, $value, $fname, $uid = NULL, $return = NULL)
{
    $uid = format_uid($uid);
    $sql = "SELECT `" . $field . "` FROM `app_ihome_user` WHERE `uid` = '" . intval($uid) . "' LIMIT 1 ";
    if (lazy_get_var($sql) < $value) {
        if ($return) {
            return false;
        }
        info_page('您的' . $fname . '不足');
        exit;
    }
    $sql = "UPDATE `app_ihome_user` SET `" . $field . "` = `" . $field . "` - " . intval($value) . " WHERE `uid` = '" . intval($uid) . "' LIMIT 1 ";
    lazy_run_sql($sql);
    return true;
}
示例#21
0
 function count_invite_code($code)
 {
     $this->db->select('count(*)')->from('u2_invite')->where('u2_invite_code', $code)->where('u2_is_use', '0');
     return lazy_get_var();
 }
示例#22
0
<?php

include_once dirname(__FILE__) . '/function.php';
$data['ci_top_title'] = '悦读推荐';
if (!is_login()) {
    info_page('请登录后查看');
}
$uid = format_uid();
$feed = trim(v('fblog'));
if ($feed == 'http://') {
    info_page('博客地址错误!');
}
if (strpos($feed, 'http://') === false) {
    $feed_link = 'http://' . $feeds;
} else {
    $feed_link = $feed;
}
$feeds = lazy_get_var("SELECT COUNT(*) FROM `app_feed_recommend` WHERE `feed` = " . s($feed_link) . "");
if ($feeds > 0) {
    info_page("此BLOG地址已经存在!");
}
$sql = "INSERT INTO `app_feed_recommend` (`uid`, `feed`, `timeline`) VALUES";
$sql .= "('" . $uid . "', " . s($feed_link) . ", '" . date('Y-m-d H:i:s') . "')";
lazy_run_sql($sql);
info_page("提交成功,已加入验证列队!");
?>
 
示例#23
0
<?php

include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
    info_page('请登录后查看');
}
if (!is_admin()) {
    info_page('你没有权限进行操作!');
}
$wid = intval(array_shift($args));
if (!isset($wid) || $wid < 1) {
    info_page("ID错误!");
}
$wnum = lazy_get_var("SELECT * FROM `app_feed_recommend` WHERE `id` = '" . intval($wid) . "'");
if (!$wnum) {
    info_page("没有此条记录");
}
lazy_run_sql("DELETE FROM `app_feed_recommend` WHERE `id` = '" . intval($wid) . "' LIMIT 1");
header('Location:/app/native/' . $GLOBALS['app'] . '/feed');
?>
 

示例#24
0
文件: cloth.php 项目: yunsite/easysns
<?php

include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
    info_page('请登录后查看');
}
$data = array();
$data['ci_top_title'] = '我的衣柜';
$tab_type = 'cloth';
$page = array_shift($args);
$page = intval($page) < 1 ? 1 : intval($page);
$limit = '6';
$start = ($page - 1) * $limit;
$base = '/app/native/ihome/cloth';
$sql = "SELECT count(*) FROM `app_ihome_shop` WHERE `uid` = '" . format_uid() . "' ";
$count = lazy_get_var($sql);
$page_all = ceil($count / $limit);
$data['pager'] = get_pager($page, $page_all, $base);
$data['tab_type'] = $tab_type;
$data['tab_array'] = $tab_array;
//$data['user'] = lazy_get_line( "SELECT * FROM `app_ihome_user` WHERE `uid` = '" . format_uid() . "' LIMIT 1" );
$data['shop'] = lazy_get_data("SELECT * FROM `app_ihome_shop` as s LEFT JOIN `app_ishop_items` as i ON ( s.item_id = i.fid )   WHERE `uid` = '" . format_uid() . "' order by s.id desc LIMIT {$start} , {$limit} ");
layout($data, 'default', 'app');
示例#25
0
    $img = null;
}
//状态$status
$states = $state;
if ($states) {
    foreach ($states as $k => $v) {
        $statu[$k] = $k;
    }
    if (!in_array($status, $statu)) {
        info_page('状态错误!');
    }
}
if (strpos($feed, 'http://') === false) {
    $feed = 'http://' . $feed;
}
$fnum = lazy_get_var("SELECT COUNT(*) FROM `app_feed` WHERE `feed` = " . s($feed) . "");
if ($fnum != '0') {
    info_page("此博客已经存在!");
}
//
$uid = format_uid();
$insert_feed = "INSERT INTO `app_feed` (`feed`, `tid`, `uid`, `title`, `time`, `img`, `state`) VALUES";
$insert_feed .= "(" . s($feed) . ", '" . intval($tid) . "', '" . intval($uid) . "', " . s($title) . ", '" . date('Y-m-d H:i:s') . "', '" . $img . "' , '" . $status . "')";
lazy_run_sql($insert_feed);
$fid = lazy_last_id();
//add feed item
$CI =& get_instance();
$CI->load->library('simplepie');
//MakeDir(ROOT.'static/data/cache');
//$CI->simplepie->set_cache_location(ROOT.'static/data/cache');
$CI->simplepie->set_feed_url($feed);
示例#26
0
 private function feedig_auto_update()
 {
     $ifeed = lazy_get_line("SELECT * FROM `u2_app` WHERE `aid` = 'ifeedig' LIMIT 1");
     if ($ifeed) {
         $ftime = file_get_contents(dirname(__FILE__) . '/feed_auto.txt');
         if ($ftime) {
             $time = date('Y-m-d H:i:s', time() - app_config('update_time', $ifeed['u2_folder']));
             if ($time > $ftime) {
                 $info = lazy_get_data("SELECT * FROM `app_feed`");
                 foreach ($info as $k => $v) {
                     $feed = $v['feed'];
                     $tid = $v['tid'];
                     $id = $v['id'];
                     $state = $v['state'];
                     $fuid = $v['uid'];
                     if (!empty($feed)) {
                         $CI =& get_instance();
                         $CI->load->library('simplepie');
                         $CI->simplepie->set_feed_url($feed);
                         $CI->simplepie->init();
                         $items = $CI->simplepie->get_items();
                         foreach ($items as $item) {
                             $title = $item->get_title();
                             //
                             $desp = $item->get_content();
                             //
                             $link = $item->get_link();
                             $date = date('Y-m-d H:i:s', strtotime($item->get_date()));
                             $unistring = md5($link) . $date;
                             $itid = lazy_get_var("SELECT `tid` FROM `app_feed_item` WHERE `unistring` = '" . $unistring . "'");
                             if ($itid > 0) {
                                 //update
                                 $sql = "UPDATE `app_feed_item` SET `tid` = '" . intval($itid) . "',";
                                 $sql .= " `fid` = '" . intval($id) . "', `title` = " . s($title) . ",";
                                 $sql .= "`desp` = " . s($desp) . ",`time` = " . s($date) . ", `link` = " . s($link) . "";
                                 $sql .= "WHERE `unistring` = '" . $unistring . "' LIMIT 1 ";
                                 lazy_run_sql($sql);
                             } else {
                                 //insert
                                 $sql = "INSERT INTO `app_feed_item` (`tid`, `fid`, `title`,";
                                 $sql .= " `desp`, `time`, `link`, `state`, `unistring`, `admin_uid`)";
                                 $sql .= "VALUES ('" . intval($tid) . "', '" . intval($id) . "', " . s($title) . ",";
                                 $sql .= " " . s($desp) . ", " . s($date) . " , " . s($link) . ",";
                                 $sql .= "'" . $state . "', " . s($unistring) . ", '" . intval($fuid) . "')";
                                 lazy_run_sql($sql);
                             }
                             lazy_run_sql("UPDATE `app_feed` SET `time` = '" . date('Y-m-d H:i:s') . "' WHERE `id` = '" . $id . "'");
                         }
                     }
                 }
                 file_put_contents(dirname(__FILE__) . '/feed_auto.txt', date('Y-m-d H:i:s'));
             }
         } else {
             file_put_contents(dirname(__FILE__) . '/feed_auto.txt', date('Y-m-d H:i:s'));
         }
     }
 }
示例#27
0
 function check_shopcate_install()
 {
     $this->db->select('count(*)')->from('u2_app')->where('aid', 'ishopcart')->limit(1);
     return lazy_get_var();
 }
示例#28
0
文件: reply.php 项目: yunsite/easysns
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);
示例#29
0
include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
    info_page('请登录后查看');
}
$uid = format_uid();
$folder = z(array_shift($args));
$cid = intval(array_shift($args));
$mid = app_config('mid', $folder);
$bind = app_config('bind', $folder);
if (!isset($mid)) {
    info_page('没有此表!');
}
if ($bind['price'] == '' || $bind['price'] <= '0') {
    info_page('价格错误!');
}
foreach ($bind as $k => $v) {
    $selected[] = " `{$v}` as {$k} ";
}
$com = lazy_get_line("SELECT  " . join(',', $selected) . " FROM `app_content_{$mid}` WHERE `id` = '" . intval($cid) . "'");
$cnum = get_count();
if ($cnum == '0') {
    info_page('没有此件物品!');
}
$num = lazy_get_var("SELECT COUNT(*) FROM `app_shopcart` WHERE `cid` = '" . intval($cid) . "' AND `uid` = '" . intval($uid) . "'");
if ($num != '0') {
    lazy_run_sql("UPDATE `app_shopcart` SET `num` = `num`+1 WHERE `cid` = '" . intval($cid) . "' AND `uid` = '" . intval($uid) . "'");
} else {
    lazy_run_sql("INSERT INTO `app_shopcart` ( `uid`, `cid`, `name`, `desp`, `num`, `money`, `date`, `folder` ) VALUES ( '" . intval($uid) . "' , '" . intval($cid) . "' , " . s($com['title']) . " , " . s($com['desp']) . " , '1' , " . s($com['price']) . " , '" . date('Y-m-d H:i:s') . "' , " . s($folder) . " )");
}
header('Location: /app/native/' . $GLOBALS['app']);
示例#30
0
文件: index.php 项目: yunsite/easysns
$data['days'] = app_config('days');
$date = date('Y-m-d H:i:s');
if ($day) {
    if ($day == '7') {
        $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -7 day")) . "'";
    } elseif ($day == '365') {
        $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -365 day")) . "'";
    } else {
        $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -1 day")) . "'";
    }
} else {
    $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -1 day")) . "'";
    $day = '1';
}
$data['day'] = $day;
$data['inum'] = lazy_get_var("SELECT COUNT(*) FROM `app_feed_item` WHERE 1 AND `state` = '2'");
$item = lazy_get_data("SELECT sql_calc_found_rows * FROM `app_feed_item` WHERE 1 AND `state` = '2'  {$where} {$time} {$hi} LIMIT {$start} , {$limit} ");
$data['all'] = $all = get_count();
$snap = array();
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) {