public function index() { $page = intval($GLOBALS['request']['page']); //分页 $page = $page == 0 ? 1 : $page; $cate_id = intval($GLOBALS['request']['cate_id']); $city_id = intval($GLOBALS['request']['city_id']); $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; /*输出分类*/ $bigcate_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "topic_group_cate where is_effect=1 order by sort asc"); if ($cate_id > 0) { $cate_condition = " and cate_id = " . $cate_id; } $sql = " select * from " . DB_PREFIX . "topic_group where is_effect = 1 {$cate_condition} order by sort desc limit " . $limit; $sql_count = "select count(*) from " . DB_PREFIX . "topic_group where is_effect = 1 {$cate_condition} "; $list = $GLOBALS['db']->getAll($sql); $count = $GLOBALS['db']->getOne($sql_count); foreach ($list as $k => $v) { $list[$k]['icon'] = get_abs_img_root(get_spec_image($v['icon'], 300, 181, 0)); } $page_total = ceil($count / $page_size); $root = array(); $root['bigcate_list'] = $bigcate_list; $root['return'] = 1; $root['email'] = $email; $root['f_link_data'] = get_link_list(); $root['item'] = $list; $root['page'] = array("page" => $page, "page_total" => ceil($res['count'] / $page_size), "page_size" => $page_size); $root['page_title'] = "小组"; output($root); }
public function index() { $root = array(); $root['return'] = 1; $group_id = intval($_REQUEST['id']); $email = addslashes($GLOBALS['request']['email']); //用户名或邮箱 $pwd = addslashes($GLOBALS['request']['pwd']); //密码 $condition = " and id = " . $group_id; $sql = "select * from " . DB_PREFIX . "topic use index({$sortkey}) where is_effect = 1 and is_delete = 0 {$condition}"; $list = $GLOBALS['db']->getAll($sql); foreach ($list as $k => $v) { $list[$k]['group_title'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "topic_group where id=" . $v['group_id']); $list[$k]['content'] = str_replace("./public/", "../public/", $v['content']); $id = $v['id']; } $root['item'] = $list[0]; $root['email'] = $email; $root['f_link_data'] = get_link_list(); $root['id'] = $group_id; $page = intval($GLOBALS['request']['page']); //分页 $page = $page == 0 ? 1 : $page; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $reply = array(); $reply = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_reply where topic_id=" . $id . " and is_effect = 1 and is_delete = 0 order by create_time desc limit " . $limit); $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where topic_id=" . $id . " and is_effect = 1 and is_delete = 0 "); $root["reply_list"] = $reply; $root['page_title'] = "小组主题"; $root['page'] = array("page" => $page, "page_total" => ceil($count / $page_size), "page_size" => $page_size); output($root); }
public function index() { require_once APP_ROOT_PATH . "system/libs/user.php"; $user_data = $GLOBALS['user_info']; $page = intval($GLOBALS['request']['page']) > 0 ? intval($GLOBALS['request']['page']) : 1; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $user_id = intval($GLOBALS['user_info']['id']); $group_key = addslashes(trim($GLOBALS['request']['mid'])); $sql = "select count(*) as count,max(system_msg_id) as system_msg_id,max(id) as id from " . DB_PREFIX . "msg_box \n\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) \n\t\t\t\tand group_key = '" . $group_key . "'"; $row = $GLOBALS['db']->getRow($sql); if ($row['count'] == 0) { $root['return'] = 0; } elseif ($row['system_msg_id'] > 0) { //系统消息,仅查看 $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_box where id = " . $row['id'] . " and is_delete = 0"); $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set is_read = 1 where id = " . $row['id']); $root['return'] = 1; $root['msg'] = array('mid' => $group_key, 'title' => $data['title'], 'message' => $data['content'], 'time' => pass_date($data['create_time'])); } else { $root['return'] = 1; $root['lid'] = $group_key; //消息记录 $sql = "select * from " . DB_PREFIX . "msg_box \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) \n\t\t\t\t\tand group_key = '" . $group_key . "' \n\t\t\t\t\torder by create_time desc limit " . $limit; $sql_count = "select count(*) from " . DB_PREFIX . "msg_box \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) and group_key = '" . $group_key . "'"; $upd_sql = "update " . DB_PREFIX . "msg_box set is_read = 1 \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) \n\t\t\t\t\tand group_key = '" . $group_key . "' "; $GLOBALS['db']->query($upd_sql); $list = $GLOBALS['db']->getAll($sql); foreach ($list as $k => $v) { if ($v['to_user_id'] != $user_id) { $dest_user_id = $v['to_user_id']; break; } if ($v['from_user_id'] != $user_id) { $dest_user_id = $v['from_user_id']; break; } } $dest_user_name = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $dest_user_id); $root['title'] = "与" . $dest_user_name . "的交流"; $root['t_name'] = $dest_user_name; $count = $GLOBALS['db']->getOne($sql_count); $page_info['page'] = $page; $page_info['page_total'] = ceil($count / $page_size); $page_info['page_size'] = $page_size; $root['page'] = $page_info; $msg_list = array(); foreach ($list as $k => $v) { $msg_list[] = array("miid" => $v['id'], "mlid" => $v['group_key'], "uid" => $v['from_user_id'], "message" => $v['content'], "time" => pass_date($v['create_time']), "tuid" => $v['to_user_id'], "tuser_name" => $v['to_user_id'] == $user_id ? "我" : $dest_user_name, "tuser_avatar" => get_abs_img_root(get_muser_avatar($v['to_user_id'], "big")), "content" => $v['content'], "user_name" => $v['from_user_id'] == $user_id ? "我" : $dest_user_name, "user_avatar" => get_abs_img_root(get_muser_avatar($v['from_user_id'], "big"))); } $root['msg_list'] = $msg_list; } if (strim($GLOBALS['request']['from']) == "wap") { $root['f_link_data'] = get_link_list(); $root['email'] = $email; } // fwb add 2014-08-27 output($root); }
public function index() { $root = array(); $root['return'] = 1; $root['page_title'] = "更多"; $root['f_link_data'] = get_link_list(); output($root); }
public function index() { $root = array(); $root['return'] = 1; //检查用户,用户密码 $user = $GLOBALS['user_info']; $user_id = intval($user['id']); if ($user_id == 0) { $root['user_login_status'] = 0; //用户登陆状态:1:成功登陆;0:未成功登陆 output($root); } else { $root['user_login_status'] = 1; } $brand_ids = $GLOBALS['db']->getOne("select group_concat(brand_id) from " . DB_PREFIX . "brand_dy where uid = " . $user_id); //print_r($brand_ids); if (!$brand_ids) { $brand_ids = -1; } if (substr($brand_ids, -1, 1) == ',') { $brand_ids = substr($brand_ids, 0, -1); } $merchant_ids = $GLOBALS['db']->getOne("select group_concat(supplier_id) from " . DB_PREFIX . "supplier_dy where uid = " . $user_id); if (!$merchant_ids) { $merchant_ids = -1; } if (substr($merchant_ids, -1, 1) == ',') { $merchant_ids = substr($merchant_ids, 0, -1); } $page = intval($GLOBALS['request']['page']); //分页 $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $sql_count = "select count(*) from " . DB_PREFIX . "youhui "; //$sql = "select id,merchant_id,title,content,merchant_logo,create_time,merchant_xpoint,merchant_ypoint,merchant_api_address,image_1 from ".FDB::table("merchant_youhui"); $sql = "select id, supplier_id as merchant_id,name as title,list_brief as content,icon as merchant_logo,create_time,xpoint,ypoint,address as api_address,icon as image_1 from " . DB_PREFIX . "youhui "; $now = get_gmtime(); $where = "1 = 1 and is_effect = 1 and (end_time = 0 or end_time > " . $now . ") and (brand_id in (" . $brand_ids . ") or supplier_id in (" . $merchant_ids . "))"; $sql_count .= " where " . $where; $sql .= " where " . $where; $sql .= " order by create_time desc limit " . $limit; $total = $GLOBALS['db']->getOne($sql_count); $page_total = ceil($total / $page_size); //print_r($sql); exit; $list = $GLOBALS['db']->getAll($sql); $youhui_list = array(); foreach ($list as $item) { $youhui_list[] = m_youhuiItem($item); } if ($GLOBALS['request']['from'] == 'wap') { $root['email'] = $email; $root['f_link_data'] = get_link_list(); } $root['item'] = $youhui_list; $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size); $root['now'] = $now; output($root); }
public function index() { $root = array(); $root['return'] = 1; $page = intval($_FANWE['requestData']['page']); //分页 $page = $page > 0 ? $page : 1; $page = $page == 0 ? 1 : $page; //检查用户,用户密码 $user_return = $GLOBALS['user_info']; //var_dump($user_return);exit; $user = $user_return; $user_id = intval($user['id']); //var_dump($user_id);exit; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; if (strim($GLOBALS['request']['from'] == 'wap')) { $sql_count = "select count(*) from " . DB_PREFIX . "youhui_log as yl left join " . DB_PREFIX . "youhui as yh on yh.id = yl.youhui_id "; $sql = "select yh.id, yh.supplier_id as merchant_id,yh.end_time,yh.name as title,yh.brief as content,yh.icon as merchant_logo,yh.create_time,yh.xpoint,yh.ypoint,yh.icon as image_1,yl.youhui_sn as yl_sn,yl.create_time as yl_create_time,yl.confirm_time as yl_confirm_time,yh.begin_time as begin_time,yh.end_time as end_time,yl.confirm_time as confirm_time from " . DB_PREFIX . "youhui_log as yl left join " . DB_PREFIX . "youhui as yh on yh.id = yl.youhui_id "; } else { $sql_count = "select count(*) from " . DB_PREFIX . "youhui_log as yl left join " . DB_PREFIX . "youhui as yh on yh.id = yl.youhui_id "; $sql = "select yh.id, yh.supplier_id as merchant_id,yh.name as title,yh.brief as content,yh.icon as merchant_logo,yh.create_time,yh.xpoint,yh.ypoint,yh.icon as image_1,yl.youhui_sn as yl_sn,yl.create_time as yl_create_time,yl.confirm_time as yl_confirm_time,yh.begin_time as begin_time,yh.end_time as end_time,yl.confirm_time as confirm_time from " . DB_PREFIX . "youhui_log as yl left join " . DB_PREFIX . "youhui as yh on yh.id = yl.youhui_id "; } // fwb update 2014-08-27 $where = " yl.user_id={$user_id}"; $sql_count .= " where " . $where; $sql .= " where " . $where; $sql .= " order by yl.create_time desc limit " . $limit; $total = $GLOBALS['db']->getOne($sql_count); $page_total = ceil($total / $page_size); //echo $sql; $list = $GLOBALS['db']->getAll($sql); //var_dump($list);exit; $youhui_list = array(); foreach ($list as $item) { $youhui_list[] = m_youhuiLogItem($item); // } $root['item'] = $youhui_list; if ($GLOBALS['request']['from'] == "wap") { $root['email'] = $email; $root['f_link_data'] = get_link_list(); } // fwb add 2014-08-27 $root['count'] = $total; //var_dump($root['item']);exit; $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size); $root['now'] = $now; output($root); }
public function index() { $root = array(); $root['return'] = 1; $group_id = intval($_REQUEST['id']); $forum_title = htmlspecialchars(addslashes(trim($_REQUEST['forum_title']))); $content = addslashes(trim($GLOBALS['request']['content'])); //检查用户,用户密码 $user = $GLOBALS['user_info']; $user_id = intval($user['id']); $user_name = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id=" . $user_id); if ($group_id > 0) { if ($forum_title == '') { $root['status'] = 0; $root['info'] = "请输入要发表的主题"; } else { $group_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where id = " . $group_id); if ($group_info['user_id'] != $user_id) { if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_topic_group where group_id=" . $group_id . " and user_id = " . $user_id) == 0) { $root['status'] = 0; $root['info'] = "不是本组会员, 不能发表主题"; } } else { $addtopic = array('user_id' => $user_id, 'group_id' => $group_id, 'forum_title' => $forum_title, 'content' => $content, 'user_name' => $user_name, 'create_time' => get_gmtime(), 'is_effect' => 1, 'is_delete' => 0); $GLOBALS['db']->autoExecute(DB_PREFIX . "topic", $addtopic, 'INSERT'); $id = $GLOBALS['db']->insert_id(); $root['id'] = $id; if ($id > 0) { $root['status'] = 1; $root['info'] = "添加成功"; } else { $root['status'] = 0; $root['info'] = "添加失败"; } } } } $root['email'] = $email; $root['f_link_data'] = get_link_list(); $root['id'] = $group_id; $root['page_title'] = "发表主题"; output($root); }
public function index() { $root = array(); $root['return'] = 1; $group_id = intval($_REQUEST['id']); $content = addslashes(trim($GLOBALS['request']['content'])); //检查用户,用户密码 $user = $GLOBALS['user_info']; $user_id = intval($user['id']); $user_name = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id=" . $user_id); if ($group_id > 0) { if ($user_id > 0) { $addtopic = array('user_id' => $user_id, 'topic_id' => $group_id, 'content' => $content, 'user_name' => $user_name, 'create_time' => get_gmtime(), 'is_effect' => 1, 'is_delete' => 0); $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_reply", $addtopic, 'INSERT'); $id = $GLOBALS['db']->insert_id(); $root['id'] = $id; if ($id > 0) { $root['status'] = 1; $GLOBALS['db']->query("update " . DB_PREFIX . "topic set reply_count = reply_count + 1,last_time = " . get_gmtime() . ",last_user_id = " . intval($user_id) . " where id = " . $group_id); $root['info'] = "添加成功"; } else { $root['status'] = 0; $root['info'] = "添加失败"; } } else { $root['status'] = 2; $root['info'] = "请先登陆"; } } else { $root['status'] = 0; $root['info'] = "请输入要评论的主题"; } $root['email'] = $email; $root['f_link_data'] = get_link_list(); $root['id'] = $group_id; $root['page_title'] = "发表主题"; output($root); }
function output($data) { header("Content-Type:text/html; charset=utf-8"); $r_type = intval($_REQUEST['r_type']); //返回数据格式类型; 0:base64;1;json_encode;2:array $data['act'] = ACT; $data['act_2'] = ACT_2; //print_r($r_type);exit; if ($GLOBALS['request']['from'] == "wap") { //$data['config']=$GLOBALS['m_config']; //$data['config']['index_logo']=get_abs_img_root($GLOBALS['m_config']['index_logo']); //$data['city_name']=strim($GLOBALS['request']['city_name']);//城市名称 //$data['email']=addslashes($GLOBALS['request']['email']);//用户名或邮箱 //var_dump($user_agent); if (isios()) { // $down_url = app_conf("BIZ_APPLE_PATH"); $down_url = $GLOBALS['db']->getOne("select val from " . DB_PREFIX . "m_config where code = 'ios_down_url'"); } else { //$down_url = app_conf("BIZ_ANDROID_PATH"); $down_url = $GLOBALS['db']->getOne("select val from " . DB_PREFIX . "m_config where code = 'android_filename'"); } $data['mobile_btns_download'] = $down_url; //$data['mobile_btns_download']= get_domain().APP_ROOT.'/../downapp.php'; $data['f_link_data'] = get_link_list(); } if ($r_type == 0) { echo base64_encode(json_encode($data)); } else { if ($r_type == 1) { print_r(json_encode($data)); } else { if ($r_type == 2) { print_r($data); } } } exit; }
function get_category_list($parent = 0, $escape = false) { global $wpdb, $wp_affiliate_prefix; $table_name = $wpdb->prefix . $wp_affiliate_prefix . "_categories"; $results = $wpdb->get_results("SELECT * FROM " . $table_name . " WHERE parent=" . $parent . " ORDER BY category ASC"); if (!$results) { return; } $category_list = "<ul"; if ($parent == 0) { $category_list .= " id=\"wpanav\" "; } $category_list .= ">\n"; foreach ($results as $result) { $js_category = str_replace("-", "_", sanitize_title($result->category)); $category_list .= "<li id=\"catli" . $result->id . "\" >" . $result->category . " <a href=\"#\" onclick=\"wp_affiliate_show_add_link_box(" . $result->id . "," . $result->parent . ", '" . $js_category . "');return false;\">Add A Link</a> <a href=\"#\" onclick=\"wp_affiliate_show_add_sub_category_box(" . $result->id . "," . $result->parent . ", '" . $js_category . "');return false;\">Add Sub Category</a> (<a href=\"#\" onclick=\"wp_affiliate_ajax_delete_category(" . $result->id . "); return false;\">Delete Category</a>)<div id=\"add-link-" . $result->parent . "-" . $js_category . "\" style=\"display:none;\"></div><div id=\"add-sub-category-" . $result->parent . "-" . $js_category . "\" style=\"display:none;\"></div>\n"; $category_list .= get_link_list($result->id, $result->category); $category_list .= get_category_list($result->id); $category_list .= "</li>\n"; } $category_list .= "</ul>\n"; return $category_list; }
system('echo -e "\\033[32m开始获取队列... \\033[0m"'); $taskModel = new TaskModel(); $task_list = $taskModel->getList(); $task_count = count($task_list); system('echo -e "获取到\\033[32m[' . $task_count . ']\\033[0m个任务队列, 开始抓取链接列表..."'); foreach ($task_list as $v) { $task_list_id = $v['id']; $task_status = $v['status']; $chatset = $v['charset']; $rules = array(); if ($task_status == 'yes') { system("echo -e '开始抓取\\033[34m[" . $v['node_name'] . "]\\033[0m...'"); $rules = json_decode($v['link_rules'], true); // 获取内容的链接 $link_list = array(); $link_list = get_link_list($rules['list_rule']); $link_list_count = count($link_list); system("echo -e '获取到\\033[32m[" . $link_list_count . "]\\033[0m个列表列表链接,准备获取文章链接...'"); foreach ($link_list as $vo) { system("echo -e '获取列表内容链接: \\033[32m" . $vo . "\\033[0m'"); $content = ''; $content = http_client_request($vo); if ($chatset != 'utf-8') { iconv($chatset, "UTF-8", $content); } // print_r($content);exit; $target_urls = array(); $target_urls = get_content_url_list($content, $rules['list_area']); // 探测链接失败 if (empty($target_urls)) { system("echo -e '探测链接列表失败: \\033[31m" . $vo . "\\033[0m'");
// 写入到index数组 $index['about_name'] = $about['page_name']; $index['about_content'] = $dou->dou_substr($about['content'], 300); $index['about_link'] = $dou->rewrite_url('page', '1'); $index['cur'] = true; // 赋值给模板-meta和title信息 $smarty->assign('page_title', $dou->page_title()); $smarty->assign('keywords', $_CFG['site_keywords']); $smarty->assign('description', $_CFG['site_description']); // 赋值给模板-导航栏 $smarty->assign('nav_top_list', $dou->get_nav('top')); $smarty->assign('nav_middle_list', $dou->get_nav('middle')); $smarty->assign('nav_bottom_list', $dou->get_nav('bottom')); // 赋值给模板-数据 $smarty->assign('show_list', $dou->get_show_list()); $smarty->assign('link', get_link_list()); $smarty->assign('index', $index); //$smarty->assign('recommend_product', $dou->get_list('product', 'ALL', $_DISPLAY['home_product'], 'sort DESC')); $smarty->assign('recommend_product', $dou->get_category('product_category')); $smarty->assign('recommend_article', $dou->get_list('article', 'ALL', $_DISPLAY['home_article'], 'sort DESC')); //var_dump($dou->get_category('product_category'));exit; $smarty->display('index.dwt'); /** * +---------------------------------------------------------- * 获取下级幻灯列表 * +---------------------------------------------------------- */ function get_link_list() { $sql = "SELECT * FROM " . $GLOBALS['dou']->table('link') . " ORDER BY sort ASC, id ASC"; $query = $GLOBALS['dou']->query($sql);
function get_between($input, $start, $end) { $substr = substr($input, strlen($start) + strpos($input, $start), (strlen($input) - strpos($input, $end)) * -1); return $substr; } $run_environment = 'prod'; // either 'dev' or 'prod' $max_records = 5; // only used for testing if ($run_environment == 'dev') { error_reporting(E_ALL); require 'scraperwiki.php'; } require 'scraperwiki/simple_html_dom.php'; $url = "http://www.nyc.gov/html/cau/html/cb/cb.shtml"; $link_list = get_link_list($url); //$alldata = $link_list; $count = 1; foreach ($link_list as $link) { //if($count < 3) { // $count++; // continue; //} $url = $link['source']; $city = $link['name']; if ($run_environment == 'prod') { get_cb_data($city, $url); } else { $alldata[] = get_cb_data($city, $url); } $count++;
function get_this_time_links($post, $diff) { $links = array(); $post_links = (array) replace_plugin_link2null($post); $diff_links = (array) get_link_list($diff); foreach ($diff_links as $d) { foreach ($post_links as $p) { if ($p == $d) { $links[] = $p; break; } } } unset($post_links, $diff_links); return $links; }