public function doWebActivityEdit() { global $_W, $_GPC; checkaccount(); // $id = $_GPC['id']; $data = $_GPC['data']; $data['uniacid'] = $_W['uniacid']; if (!empty($_GPC['submit'])) { //提交表单 if (empty($data['id'])) { //check $activityList = $this->activityService->selectAll(); if ($activityList) { return message("您已经添加了一个活动", $this->createWebUrl("ActivityManage"), "error"); } $data['create_time'] = time(); } $data['content'] = htmlspecialchars_decode($data['content']); $data['update_time'] = time(); try { $this->activityService->insertOrUpdate($data); return message("保存成功", $this->createWebUrl("ActivityManage"), "success"); } catch (Exception $e) { return message("保存失败", "", "error"); } } else { if (!is_null($id)) { $data = $this->activityService->selectById($id); $data['content'] = htmlspecialchars_decode($data['content']); } load()->func('tpl'); include $this->template('activity_edit'); } }
public function doWebsendlist() { global $_W; checklogin(); checkaccount(); $list = pdo_fetchall("select * from " . tablename($this->table) . " order by id desc"); include $this->template('list'); }
/** * 删除tag */ public function doWebDeleteTag() { global $_GPC, $_W; checkaccount(); $id = $_GPC['id']; try { $this->delete_tag_config($id); return $this->return_json(200, '删除成功', null); } catch (Exception $e) { return $this->return_json($e->getCode(), $e->getMessage(), null); } }
private function getUserInfo($o) { global $_W, $_GPC; checkaccount(); if (empty($o)) { message('重要参数丢失..', '', 'error'); exit; } if (empty($_W['account']['key']) || empty($_W['account']['secret'])) { $user = pdo_fetch('SELECT from_user,weid,nickname,avatar FROM' . tablename('fans') . "WHERE weid = :weid AND from_user = :from_user", array(':from_user' => $o, ':weid' => $_W['weid'])); if (empty($user)) { $user = array('weid' => $_W['weid'], 'from_user' => $o, 'createtime' => TIMESTAMP); /* pdo_insert('fans',$user); */ } if (empty($user['nickname'])) { $user['nickname'] = 'Anonymous-' . substr($o, -4); } if (empty($user['avatar'])) { $user['avatar'] = './source/modules/winestore/template/style/null_header.png'; } return $user; } else { $access_token = account_weixin_token($_W['account']); $content = ihttp_get(sprintf($this->getUserInfoUrl, $access_token, $o)); if ($content['errcode'] != 0) { message(account_weixin_code($content['errcode']), '', 'error'); } $record = @json_decode($content['content'], true); if ($record['subscribe'] == '1') { $user = array('weid' => $_W['weid'], 'from_user' => $record['openid'], 'nickname' => $record['nickname'], 'gender' => $record['sex'], 'residecity' => $record['city'], 'resideprovince' => $record['province'], 'nationality' => $record['country'], 'avatar' => $record['headimgurl'], 'createtime' => $record['subscribe_time']); if (pdo_fetch("SELECT * FROM " . tablename('fans') . " WHERE `from_user` = '{$record['openid']}'")) { pdo_update('fans', $user, array('from_user' => $record['openid'])); } else { pdo_insert('fans', $user); } } if (empty($user['nickname'])) { $user['nickname'] = 'Anonymous_' . substr($o, -4); } if (empty($user['avatar'])) { $user['avatar'] = './source/modules/winestore/template/style/null_header.png'; } return $user; } }
<?php /** * [WeEngine System] Copyright (c) 2013 WE7.CC */ defined('IN_IA') or exit('Access Denied'); $current['designer'] = ' class="current"'; checkaccount(); require_once IA_ROOT . '/source/class/account.class.php'; $acc = WeAccount::create($_W['weid']); if (empty($acc)) { message('非法访问'); } $menusetcookie = 'menuset-' . $_W['weid']; if ($_W['ispost']) { if ($_GPC['do'] == 'remove') { $ret = $acc->menuDelete(); if (is_error($ret)) { message($ret['message'], 'refresh'); } else { isetcookie($menusetcookie, '', -500); message('已经成功删除菜单,请重新创建。', 'refresh'); } } if ($_GPC['do'] == 'refresh') { isetcookie($menusetcookie, '', -500); message('已清空缓存,将重新从公众平台接口获取菜单信息。', 'refresh'); } require model('rule'); $mDat = $_GPC['do']; $mDat = htmlspecialchars_decode($mDat);
<?php include_once '../functions.php'; checklogin(); $conn = opendb(); if ($loggedin == 1) { $id = sanitise('id'); $a = sanitise('a'); checkaccount($user, $id, 0); //Return 0 if not account, therefore affecting no rows in the table AccountID!=0 if ($a != NULL) { $query = "UPDATE accounts SET AccountName='{$a}' WHERE UserID='{$user}' AND AccountID='{$id}'"; mysql_query($query) or die(mysql_error()); echo "<div id='account" . $id . "'>" . stripslashes($a) . " <button onclick=\"editAccountForm(" . $id . ",'" . stripslashes($a) . "')\">Edit</button></div>"; } } else { loginform(); }
public function dovotelist() { global $_W; checklogin(); checkaccount(); $list = pdo_fetchall("select from_user,votes,votetime from " . tablename('vote_fans') . " order by votetime desc"); foreach ($list as &$r) { $votes = ""; $options = pdo_fetchall("select title from " . tablename('vote_option') . " where id in (" . $r['votes'] . ")"); foreach ($options as $o) { $votes .= mb_substr($o['title'], 0, 10, "utf-8") . "<br/>"; } $r['votes'] = $votes; } unset($r); include $this->template('list'); }