Exemplo n.º 1
0
 /**
  * 用户登录检查
  *
  */
 public function checklogin()
 {
     $this->_globals();
     $_POST["username"] = strtolower($_POST["username"]);
     $rs = $this->mCustomer->checkLogin();
     if ($rs) {
         $sql = "SELECT * FROM " . get_table("customers") . " WHERE email = '" . $_POST["username"] . "'";
         $r = $this->mDb->getRow($sql);
         if ($r["status"] == 1) {
             $msg["status"] = "true";
             $this->mCustomer->upHits($_SESSION["login_user"]["id"]);
             $_SESSION["login_user"] = $r;
             $msg["message"] = "登录成功";
             $this->mLog->userLog("前台登录成功");
         } else {
             $msg["status"] = "false";
             $msg["message"] = "您的邮箱还没有验证,请查看邮件进行验证";
         }
     } else {
         $msg["status"] = "false";
         $msg["message"] = "错误的用户名或密码";
         $_SESSION["tmpuser"] = $_POST["username"];
     }
     echo json_encode($msg);
     die;
 }
Exemplo n.º 2
0
 /**
  * 系统初始化
  */
 private static function init()
 {
     set_exception_handler(array('AWS_APP', 'exception_handle'));
     self::$config = load_class('core_config');
     self::$db = load_class('core_db');
     self::$plugins = load_class('core_plugins');
     self::$settings = self::model('setting')->get_settings();
     if ((!defined('G_SESSION_SAVE') or G_SESSION_SAVE == 'db') and get_setting('db_version') > 20121123) {
         Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable(array('name' => get_table('sessions'), 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime')));
         self::$session_type = 'db';
     }
     Zend_Session::setOptions(array('name' => G_COOKIE_PREFIX . '_Session', 'cookie_domain' => G_COOKIE_DOMAIN));
     if (G_SESSION_SAVE == 'file' and G_SESSION_SAVE_PATH) {
         Zend_Session::setOptions(array('save_path' => G_SESSION_SAVE_PATH));
     }
     Zend_Session::start();
     self::$session = new Zend_Session_Namespace(G_COOKIE_PREFIX . '_Anwsion');
     if ($default_timezone = get_setting('default_timezone')) {
         date_default_timezone_set($default_timezone);
     }
     if ($img_url = get_setting('img_url')) {
         define('G_STATIC_URL', $img_url);
     } else {
         define('G_STATIC_URL', base_url() . '/static');
     }
     if (self::config()->get('system')->debug) {
         if ($cornd_timer = self::cache()->getGroup('crond')) {
             foreach ($cornd_timer as $cornd_tag) {
                 if ($cornd_runtime = self::cache()->get($cornd_tag)) {
                     AWS_APP::debug_log('crond', 0, 'Tag: ' . str_replace('crond_timer_', '', $cornd_tag) . ', Last run time: ' . date('Y-m-d H:i:s', $cornd_runtime));
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public function defshow()
 {
     //检查登录
     if (!$_SESSION["login_user"]) {
         $_SESSION["fromurl"] = $_SERVER["HTTP_REFERER"];
         header("Location: /user/login.html");
     } else {
         $this->result["login_user"] = $_SESSION["login_user"];
     }
     $this->result["sites"]["pagetitle"] = "课程设置";
     $this->result["nav1"] = $this->mArt->getPidLists(7);
     // 项目
     $this->result["nav2"] = $this->mArt->getPidLists(10);
     // 招生
     $this->result["logout"] = $this->mClient->isOrLogin();
     $this->result["sites"]["course"] = 'current';
     $this->result["ads"]["indexlbanner"] = $this->mAd->getAd("indexlbanner", "list");
     $sql1 = "select id,cname from " . get_table("art_cates") . " where pid = 14";
     $info = $this->mDb->getall($sql1);
     $this->result["info"] = $info;
     $sql2 = "select c.id as cid,a.id as aid,a.title from sb_art_cates AS c,sb_articles AS a where c.id=a.class_id and c.id in (select id from sb_art_cates where pid = 14)";
     $rs = $this->mDb->getall($sql2);
     $this->result["rs"] = $rs;
     $sql3 = "select id,cname from " . get_table("art_cates") . " where pid = 23";
     $infos = $this->mDb->getall($sql3);
     $this->result["infos"] = $infos;
     $sql4 = "select c.id as cid,a.id as aid,a.title from sb_art_cates AS c,sb_articles AS a where c.id=a.class_id and c.id in (select id from sb_art_cates where pid = 23)";
     $rse = $this->mDb->getall($sql4);
     $this->result["rse"] = $rse;
     $this->tplname = $_GET["lang"] . '/course';
 }
Exemplo n.º 4
0
 public function batch()
 {
     $this->_globals();
     //$rs = $this->mArticle->Batch();
     $i = 0;
     while ($i < count($_POST["selected"])) {
         if ($_POST["more"] == "0") {
             $sql = "DELETE FROM " . get_table("download") . " WHERE id=" . $_POST["selected"][$i];
         } else {
             $sql = "UPDATE " . get_table("download") . " SET class_id='" . $_POST["class_id"] . "' WHERE id=" . $_POST["selected"][$i];
         }
         $rs = $this->mDb->execute($sql);
         $i++;
     }
     $this->mLog->adminLog("批量移动/删除内容");
     /*if($rs)
      				{
      					$msg["status"] = "true";
      				}
      				else
      				{
      					$msg["false"] = "true";
      					$msg["message"] = "保存错误,请联系管理员";
     
      				}
      				echo json_encode($msg);*/
     die;
 }
Exemplo n.º 5
0
 function revert()
 {
     $this->build();
     $sql = "SELECT * FROM " . get_table("backuplist") . " WHERE id=" . $_POST["dataid"];
     $rs = $this->mDb->getrow($sql);
     $path = $rs["path"] . $rs["filename"];
     system("mysql -h " . _DB_HOST . " -u " . _DB_USER . " -p" . _DB_PASS . " " . _DB_NAME . " < " . $this->mPath . "/" . $rs["filename"]);
 }
Exemplo n.º 6
0
 public function db_clean()
 {
     $users_columns = $this->query_all("SHOW COLUMNS FROM `" . get_table('users') . "`");
     foreach ($users_columns as $key => $val) {
         if (in_array($val['Field'], array('avatar_type', 'url'))) {
             $this->query("ALTER TABLE `" . get_table('users') . "` DROP `" . $val['Field'] . "`;");
         }
     }
 }
Exemplo n.º 7
0
 public function count_favorite_items($uid, $tag = null)
 {
     if ($tag) {
         $favorite_items = $this->query_all('SELECT DISTINCT item_id FROM ' . get_table('favorite_tag') . ' WHERE uid = ' . intval($uid) . " AND title = '" . $this->quote($tag) . "'");
         return sizeof($favorite_items);
     } else {
         return $this->count('favorite', 'uid = ' . intval($uid));
     }
 }
Exemplo n.º 8
0
 public function get_topics_by_feature_id($feature_id)
 {
     if (!($topics = $this->query_all('SELECT topic_id FROM ' . get_table('feature_topic') . ' WHERE feature_id = ' . intval($feature_id)))) {
         return false;
     }
     foreach ($topics as $key => $val) {
         $topic_ids[] = $val['topic_id'];
     }
     return $topic_ids;
 }
Exemplo n.º 9
0
 public static function _saveAnswer($aid, $qid, $username, $content, $vote)
 {
     $a = get_table('answer');
     $update = array('id' => $aid, 'q_id' => $qid, 'user' => $username, 'text' => $content, 'vote' => $vote, 'fetched' => time());
     $where = array('id' => $aid);
     $rs = $a->update($where, array('$set' => $update), array('upsert' => true));
     if (!$rs['ok']) {
         echo basename(__FILE__) . ':' . __LINE__ . ' ' . $rs['err'] . "\n";
     }
     return $rs;
 }
Exemplo n.º 10
0
 public function savePost()
 {
     foreach ($_POST as $key => $val) {
         $sql[] = $key . " = '{$val}'";
     }
     $sql = implode(",", $sql);
     $sql = "UPDATE " . get_table("sites") . " SET {$sql} WHERE id=1";
     $rs = $this->mDb->execute($sql);
     $this->building();
     return $rs;
 }
Exemplo n.º 11
0
 public function pay_to_project_order_id($order_id, $project_product_order_id)
 {
     if (!($order_info = $this->get_order($order_id))) {
         return false;
     }
     if (!($project_order_info = $this->model('project')->get_project_order_info_by_id($project_product_order_id))) {
         return false;
     }
     $this->query("UPDATE " . get_table('project') . " SET paid = paid + " . $order_info['amount'] . " WHERE id = " . intval($project_order_info['project_id']));
     return $this->set_order_payment_time($project_product_order_id);
 }
Exemplo n.º 12
0
 public function update_dialog_count($dialog_id, $uid)
 {
     if (!($inbox_dialog = $this->get_dialog_by_id($dialog_id))) {
         return false;
     }
     $this->update('inbox_dialog', array('sender_count' => $this->count('inbox', 'uid IN(' . $inbox_dialog['sender_uid'] . ', ' . $inbox_dialog['recipient_uid'] . ') AND sender_remove = 0 AND dialog_id = ' . intval($dialog_id)), 'recipient_count' => $this->count('inbox', 'uid IN(' . $inbox_dialog['sender_uid'] . ', ' . $inbox_dialog['recipient_uid'] . ') AND recipient_remove = 0 AND dialog_id = ' . intval($dialog_id)), 'update_time' => time()), 'id = ' . intval($dialog_id));
     if ($inbox_dialog['sender_uid'] == $uid) {
         $this->query("UPDATE " . get_table('inbox_dialog') . " SET recipient_unread = recipient_unread + 1 WHERE id = " . intval($dialog_id));
     } else {
         $this->query("UPDATE " . get_table('inbox_dialog') . " SET sender_unread = sender_unread + 1 WHERE id = " . intval($dialog_id));
     }
 }
Exemplo n.º 13
0
 public function search_users($q, $page, $limit = 20)
 {
     if (is_array($q) and sizeof($q) > 1) {
         $where[] = "user_name = '" . $this->quote(implode(' ', $q)) . "' OR user_name = '" . $this->quote(implode('', $q)) . "'";
     } else {
         if (is_array($q)) {
             $q = implode('', $q);
         }
         $where[] = "user_name LIKE '" . $this->quote($q) . "%'";
     }
     return $this->query_all('SELECT uid, last_login FROM ' . get_table('users') . ' WHERE ' . implode(' OR ', $where), calc_page_limit($page, $limit));
 }
Exemplo n.º 14
0
function get_reason($reason)
{
    global $db, $L;
    $str = '';
    $arr = explode('|', $reason);
    switch ($arr[0]) {
        case 'deposit':
            $str = $L['charge_reason_deposit'];
            break;
        case 'credit':
            $str = $L['charge_reason_credit'];
            break;
        case 'vip':
            $str = $L['charge_reason_vip'];
            break;
        case 'pay':
            if (is_numeric($arr[1]) && is_numeric($arr[2])) {
                $t = $db->get_one("SELECT title FROM " . get_table(intval($arr[1])) . " WHERE itemid=" . intval($arr[2]));
                if ($t) {
                    $str = $t['title'];
                }
            }
            break;
        case 'trade':
            if (is_numeric($arr[1])) {
                $t = $db->get_one("SELECT title FROM " . $db->pre . "mall_order WHERE itemid=" . intval($arr[1]));
                if ($t) {
                    $str = $t['title'];
                }
            }
            break;
        case 'trades':
            $ids = explode(',', $arr[1]);
            $t = $db->get_one("SELECT title FROM " . $db->pre . "group_order WHERE itemid=" . intval($ids[0]));
            if ($t) {
                $str = $L['charge_reason_muti'] . $t['title'] . '...';
            }
            break;
        case 'group':
            if (is_numeric($arr[1])) {
                $t = $db->get_one("SELECT title FROM " . $db->pre . "group_order WHERE itemid=" . intval($arr[1]));
                if ($t) {
                    $str = $t['title'];
                }
            }
            break;
        default:
            break;
    }
    return $str;
}
Exemplo n.º 15
0
 private function check_dunning($bdname, $time, $status)
 {
     $sql = "select * from " . get_table($bdname) . " where etime >=now() and etime <='" . $time . "' and emailstatus<>" . $status;
     $rs = $this->mDb->getall($sql);
     foreach ($rs as $key => $value) {
         $r = $this->getRow("customers", $value["uid"]);
         $rs[$key]["email"] = $r["email"];
         if ($value["emailstatus"] == $status - 1) {
             if ($this->to_email($rs[$key]["email"], $status, $bdname)) {
                 $this->Update($bdname, $value["id"], " emailstatus =" . $status);
             }
         }
     }
 }
Exemplo n.º 16
0
 public function canceldomain()
 {
     $this->_globals();
     $root = "/data/wwwroot/vhost/";
     system("rm -f " . $root . $_POST["host"]);
     $sql = "DELETE FROM " . get_table("domain") . " WHERE domain='" . $_POST["host"] . "'";
     $rs = $this->mDb->execute($sql);
     if ($rs == false) {
         $msg["status"] = "false";
     } else {
         $msg["status"] = "true";
     }
     echo json_encode($msg);
     die;
 }
Exemplo n.º 17
0
 public function defshow()
 {
     $this->_globals();
     include _APP_PATH . "libs/adodb/adodb-pager2.inc.php";
     $r = $this->mBasic->getList("orderprodlist", array("uid = '" . $_SESSION["login_user"]["id"] . "'", " payflag != 2 "));
     $payflag = $this->mOrder->getPayflagList();
     foreach ($r["logs"] as $key => $val) {
         $r["logs"][$key]["payflagname"] = $payflag[$val["payflag"]];
         $r["logs"][$key]["infolist"] = $this->mDb->getall("SELECT * FROM " . get_table("orderprod") . " p ," . get_table("orderprodlist") . " o ," . get_table("products") . " pr WHERE p.oid=o.id AND p.pid = pr.id AND p.oid = '" . $val["id"] . "'");
         $r["logs"][$key]["infos"] = $this->mDb->getall("SELECT * FROM " . get_table("orderprod") . " p ," . get_table("orderprodlist") . " o  WHERE p.oid=o.id  AND p.oid = '" . $val["id"] . "'");
     }
     $this->result["logs"] = $r["logs"];
     $this->result["pages"] = $r["pages"];
     $this->result["sites"]["pagetitle"] = "订单中心";
     $this->tplname = 'orderlist';
 }
Exemplo n.º 18
0
 public function savepost()
 {
     $this->_globals();
     $password = md5($_POST["password"]);
     $sql = "UPDATE " . get_table("customers") . " SET password = '******' WHERE id= '" . $_POST["id"] . "'";
     $rs = $this->mDb->execute($sql);
     if ($rs) {
         $msg["status"] = "true";
         $msg["message"] = "密码重设成功,请重新登录";
     } else {
         $msg["status"] = "false";
         $msg["message"] = "密码重设失败,请稍后重试";
     }
     echo json_encode($msg);
     die;
 }
Exemplo n.º 19
0
 public function index_action()
 {
     $publisher_projects = $this->model('project')->query_all('SELECT id FROM ' . get_table('project') . ' WHERE uid = ' . intval($this->user_id));
     if (!$publisher_projects) {
         exit;
     }
     foreach ($publisher_projects as $value) {
         $project_ids[] = $value['id'];
     }
     $order_list = $this->model('project')->fetch_all('product_order', 'project_id IN (' . implode(',', $project_ids) . ')', 'id ASC');
     if (!$order_list) {
         exit;
     }
     foreach ($order_list as $order_info) {
         $uids[] = $order_info['uid'];
     }
     $users = $this->model('account')->get_user_info_by_uids($uids);
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setTitle('活动列表');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', '活动 ID')->setCellValue('B1', '联系人')->setCellValue('C1', '报名时间')->setCellValue('D1', '手机号')->setCellValue('E1', '邮箱')->setCellValue('F1', '收货地址')->setCellValue('G1', '邮编')->setCellValue('H1', '支持金额')->setCellValue('I1', '状态');
     $i = 1;
     foreach ($order_list as $order_info) {
         $i++;
         $order_info['order_status'] = $this->model('project')->get_order_status($order_info);
         switch ($order_info['order_status']) {
             case 'pay':
                 $order_info['order_status'] = '未支付';
                 break;
             case 'refunded':
                 $order_info['order_status'] = '已退款';
                 break;
             case 'shipped':
                 $order_info['order_status'] = '已回报';
                 break;
             case 'donate':
                 $order_info['order_status'] = '无需回报';
                 break;
             default:
                 $order_info['order_status'] = '等待回报';
                 break;
         }
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i, $order_info['project_id'] ?: '')->setCellValue('B' . $i, $order_info['shipping_name'] ?: '')->setCellValue('C' . $i, date('Y-m-d H:i:s', $order_info['add_time']) ?: '')->setCellValue('D' . $i, $order_info['shipping_mobile'] ?: '')->setCellValue('E' . $i, $order_info['project_type'] == 'DEFAULT' ? $users[$order_info['uid']]['email'] : $order_info['shipping_address'])->setCellValue('F' . $i, $order_info['project_type'] == 'DEFAULT' ? $order_info['shipping_province'] . $order_info['shipping_city'] . $order_info['shipping_address'] : $order_info['address'])->setCellValue('G' . $i, $order_info['shipping_zipcode'] ?: '')->setCellValue('H' . $i, $order_info['amount'] ?: '')->setCellValue('I' . $i, $order_info['order_status']);
     }
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     exit;
 }
Exemplo n.º 20
0
 public function online_active($uid, $last_active)
 {
     if (!$uid or $last_active + 60 > time()) {
         return false;
     }
     $online_data = array('uid' => $uid, 'last_active' => time(), 'ip' => ip2long(fetch_ip()), 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'active_url' => $_SERVER['HTTP_REFERER']);
     if ($user_online = $this->fetch_row('users_online', 'uid = ' . intval($uid))) {
         $this->shutdown_update('users_online', $online_data, 'uid = ' . $user_online['uid']);
     } else {
         $this->insert('users_online', $online_data);
     }
     $online_time = time() - $last_active;
     if ($online_time > 300) {
         $online_time = 1;
     }
     $this->shutdown_query("UPDATE " . get_table('users') . ' SET online_time = online_time + ' . intval($online_time) . ', last_active = ' . time() . ' WHERE uid = ' . intval($uid));
     return true;
 }
Exemplo n.º 21
0
 public function slist()
 {
     $this->_globals();
     $sql = "SELECT * FROM " . get_table("brands");
     if ($_GET["keyword"]) {
         $sql .= " WHERE cname  LIKE '%" . $_GET["keyword"] . "%'";
     }
     //echo $sql;
     $rs = $this->mDb->getall($sql);
     if ($rs) {
         foreach ($rs as $val) {
             $str .= "<option value=\"" . $val["id"] . "\">" . $val["cname"] . "</option>";
         }
     } else {
         $str = "<option value=\"\">无结果</option>";
     }
     echo $str;
     die;
 }
Exemplo n.º 22
0
 public function defshow()
 {
     $this->checkLogin();
     $this->result["sites"]["dashboard"] = "selected";
     $this->result["sites"]["title"] = "首页";
     $rs = $this->mOrd->getNewList();
     $this->result["statuslist"] = $this->mOrd->getStatusList();
     $log["order_total"] = $this->mDb->getone("SELECT COUNT(*) FROM " . get_table("orders") . "");
     $log["product_total"] = $this->mDb->getone("SELECT COUNT(*) FROM " . get_table("products") . "");
     $log["product_warn_quantity"] = $this->mDb->getone("SELECT COUNT(*) FROM " . get_table("products") . " WHERE warn_quantity>=quantity");
     $log["order_succeed"] = $this->mDb->getone("SELECT COUNT(*) FROM " . get_table("orders") . " WHERE status=6");
     foreach ($rs as $key => $val) {
         $rs[$key]["status"] = $this->result["statuslist"][$val["status"]];
     }
     $this->result["log"] = $log;
     $this->result["logs"] = $rs;
     $this->result["sites"]["url"] = encrypt("index");
     $this->tplname = 'admin/index';
 }
Exemplo n.º 23
0
 /**
  * 数据定义 列表,编辑,添加时自动创建页面时用
  */
 public static function get_table()
 {
     $tableinfo = get_table('user');
     $keys = array('username', 'password', 'name', 'addr', 'tel', 'mobile', 'member_lv_id', 'grade', 'disabled');
     $FromName = array('username' => '用户名', 'password' => '密码', 'name' => '姓名', 'grade' => '管理级别', 'mobile' => '手机', 'email' => '邮箱', 'remark' => '备注');
     //$FromType['member_lv_id']=array('select',self:: get_member_lv());
     $FromType['grade'] = array('select', self::get_grades());
     //$FromType['disabled']=array('select',array('false'=>'启用','true'=>'停用'));
     //$FromMsg['member_lv_id']='会员级别';
     $FromMsg['username'] = '******';
     $FromMsg['password'] = '******';
     foreach ($tableinfo as $k => &$info) {
         $info['FromType'] = $FromType[$k];
         $info['FromMsg'] = $FromMsg[$k];
         $info['FromName'] = $FromName[$k] ? $FromName[$k] : $k;
         $info['FromView'] = in_array($k, $keys);
         $info['size'] = substr($invo['Type'], 0, 7) == 'varchar';
     }
     return $tableinfo;
 }
Exemplo n.º 24
0
 public function defshow()
 {
     $lang = $_GET["lang"] == 'cn' ? "1" : "3";
     include _APP_PATH . "libs/adodb/adodb-pager" . $lang . ".inc.php";
     $this->result["sites"]["pagetitle"] = "搜索";
     $this->result["sites"]["en_pagetitle"] = "search";
     $this->result["ads"]["indexlbanner"] = $this->mAd->getAd("indexlbanner", "list");
     $this->tplname = $_GET["lang"] . '/search';
     $_GET["lang"] = "cn";
     $this->result["nav1"] = $this->mArt->getPidLists(7);
     // 项目
     $this->result["nav2"] = $this->mArt->getPidLists(10);
     // 招生
     $this->result["logout"] = $this->mClient->isOrLogin();
     $keys = $_POST['search_name'];
     $sql = "SELECT id,title,addtime,en_title FROM " . get_table("articles") . " where class_id !=17 and class_id !=18 and class_id !=19 and title like '%" . $keys . "%'";
     $rs = $this->mDb->getAll($sql);
     $this->result["rs"] = $rs;
     $this->result["sites"]["news"] = 'current';
 }
Exemplo n.º 25
0
 public function defshow()
 {
     $this->_globals();
     //查询成功案例
     //echo $_GET["id"];
     $this->result["log"] = $this->mBasic->getRow("articles", $_GET["id"]);
     if (!$this->result["log"] or $this->result["log"]['status'] == 0) {
         $this->loadEorr();
     }
     //下一个
     $this->result["log1"] = $this->mDb->getrow("SELECT *  FROM " . get_table("articles") . " WHERE id > " . $_GET["id"] . " AND class_id = '46'");
     //上一个
     $this->result["log2"] = $this->mDb->getrow("SELECT *  FROM " . get_table("articles") . " WHERE id < " . $_GET["id"] . " AND class_id = '46'");
     $this->result["sites"]["pagetitle"] = $this->result["log"]["title"];
     $this->result["aboutlogs"] = $this->mBasic->getNavList("articles", " class_id = '46' AND id != '" . $_GET["id"] . "'", 3);
     //读取行业新闻
     $this->result["news"] = $this->mArticle->getNavList(54, 6);
     //读取广告
     $this->result["teacher"] = $this->mAd->getAd("teacher");
     $this->tplname = 'artile_detail';
 }
Exemplo n.º 26
0
function property_update($post_ppt, $moduleid, $catid, $itemid)
{
    global $db;
    if (!$post_ppt || !$moduleid || !$catid || !$itemid) {
        return;
    }
    $OP = property_option($catid);
    if (!$OP) {
        return;
    }
    if (!defined('DT_ADMIN')) {
        $post_ppt = dhtmlspecialchars($post_ppt);
    }
    $db->query("DELETE FROM {$db->pre}category_value WHERE moduleid={$moduleid} AND itemid={$itemid}");
    $ppt = array();
    foreach ($OP as $v) {
        if ($v['type'] > 1 && $v['search']) {
            $ppt[] = $v['oid'];
        }
    }
    $pptword = '';
    foreach ($post_ppt as $k => $v) {
        if (in_array($k, $ppt)) {
            if (is_array($v)) {
                foreach ($v as $_v) {
                    $pptword .= 'O' . $k . ':' . $_v . ';';
                }
            } else {
                $pptword .= 'O' . $k . ':' . $v . ';';
            }
        }
        if (is_array($v)) {
            $v = implode(',', $v);
        }
        $db->query("INSERT INTO {$db->pre}category_value (oid,moduleid,itemid,value) VALUES ('{$k}','{$moduleid}','{$itemid}','{$v}')");
    }
    if ($pptword) {
        $db->query("UPDATE " . get_table($moduleid) . " SET pptword='{$pptword}' WHERE itemid={$itemid}");
    }
}
Exemplo n.º 27
0
 public function getList($classid, $t, $lang, $size = 30)
 {
     if ($_GET["auditing"]) {
         $t = $_GET["auditing"];
     }
     $sql = "SELECT * FROM " . get_table("goods") . " ORDER BY id DESC";
     $pager = new Page();
     $get_page = is_numeric($_GET["page"]) ? $get_page : 1;
     $pagesize = $_GET["pagesize"] ? $_GET["pagesize"] : _PAGES;
     $pager->Page($key = '', $pagesize, $groupsize = 0, $current = $get_page);
     $pager->execute($this->mDb, $sql);
     $pages['link'] = $pager->pageLinks();
     $pages['fromto'] = $pager->fromto();
     $pages['total'] = $pager->getTotalpage();
     $pages['current'] = $pager->getCurrent();
     $pages['totalnum'] = $pager->getTotalnum();
     $pages['jump'] = $pager->jump();
     $pages['pagenum'] = $pagesize;
     $rs = $pager->getResult();
     $r["logs"] = $rs;
     $r["pages"] = $pages;
     return $r;
 }
Exemplo n.º 28
0
 public function fetch_answers_list_by_topic_ids($topic_ids, $page, $limit)
 {
     if (!is_array($topic_ids)) {
         return false;
     }
     array_walk_recursive($topic_ids, 'intval_string');
     $result_cache_key = 'reader_list_by_topic_ids_' . md5(implode('_', $topic_ids) . $page . $limit);
     if (!($result = AWS_APP::cache()->get($result_cache_key))) {
         $topic_relation_where[] = '`topic_id` IN(' . implode(',', $topic_ids) . ')';
         $topic_relation_where[] = "`type` = 'question'";
         if ($topic_relation_query = $this->query_all("SELECT item_id FROM " . get_table('topic_relation') . " WHERE " . implode(' AND ', $topic_relation_where))) {
             foreach ($topic_relation_query as $key => $val) {
                 $question_ids[$val['item_id']] = $val['item_id'];
             }
         }
         if (!$question_ids) {
             return false;
         }
         $result = $this->fetch_all('answer', 'question_id IN (' . implode(',', $question_ids) . ') AND add_time > ' . (time() - 86400 * intval(get_setting('reader_questions_last_days'))) . ' AND agree_count >= ' . intval(get_setting('reader_questions_agree_count')), 'add_time DESC', calc_page_limit($page, $limit));
         AWS_APP::cache()->set($result_cache_key, $result, get_setting('cache_level_low'));
     }
     return $result;
 }
Exemplo n.º 29
0
 public function defshow()
 {
     $this->result["ads"]["indexlbanner"] = $this->mAd->getAd("indexlbanner", "list");
     $this->tplname = $_GET["lang"] . '/artile';
     $_GET["lang"] = "cn";
     $this->result["log"] = $this->mArt->getRow($_GET["id"]);
     if (!$this->result["log"]) {
         $this->loadEorr();
     }
     $this->result["next"] = $_GET["id"] + 1;
     $this->result["sites"]["en_pagetitle"] = $this->result["log"]["en_title"];
     $this->result["sites"]["pagetitle"] = $this->result["log"]["title"];
     //如果是新闻活动选项卡,显示创建时间
     $sql = "SELECT id FROM " . get_table("articles") . " WHERE class_id=6 ";
     $rs = $this->mDb->getall($sql);
     foreach ($rs as $key => $val) {
         $result[] = $val["id"];
     }
     if (in_array($_GET["id"], $result)) {
         $this->result["news"] = 'news';
     }
     //师资力量处理
     $sql = "SELECT id FROM " . get_table("articles") . " WHERE class_id = 31 ";
     $r = $this->mDb->getall($sql);
     foreach ($r as $key => $val) {
         $rs[] = $val["id"];
     }
     if (in_array($_GET["id"], $rs)) {
         $this->result["teacher"] = 'teacher';
     }
     $this->result["logout"] = $this->mClient->isOrLogin();
     if ($_GET["id"] == 121) {
         $this->result["sites"]["project"] = 'current';
     }
     $this->result["sites"][$_GET["cate"]] = 'current';
 }
Exemplo n.º 30
0
 public function Update($table, $id, $set)
 {
     $sql = "UPDATE " . get_table($table) . " SET {$set} WHERE id={$id}";
     $rs = $this->mDb->execute($sql);
 }