/** 上线下线更新 */ public function onofflineAjax() { $uid = (int) $this->request('uid'); $online = (int) $this->request('online'); m('admin')->update("`imonline`='{$online}',`imlastdt`='{$this->now}'", $uid); echo 'success'; }
/** Delete file controller */ public function __async_delete() { /** @var \samsonphp\fs\FileService $fsModule */ $fsModule = $this->system->module('fs'); /** @var \samsoncms\input\Field $field */ $this->createField(new dbQuery(), $_GET['e'], $_GET['f'], $_GET['i']); // Build uploaded file path $file = $this->field->value(); // Delete thumbnails if (class_exists('\\samson\\scale\\ScaleController', false) && $this->isImage($fsModule->extension($file))) { /** @var string $path Path to file */ $path = ''; // Get file path preg_match('/.*\\//', $file, $path); $path = $path[0]; // Get image src $src = substr($file, strlen($path)); /** @var \samson\scale\ScaleController $scale */ $scale = m('scale'); foreach (array_keys($scale->thumnails_sizes) as $folder) { // Form image path for scale module $imageScalePath = $path . $folder . '/' . $src; if ($fsModule->exists($imageScalePath)) { $fsModule->delete($imageScalePath); } } } if ($fsModule->exists($file)) { $fsModule->delete($file); } // TODO Save empty field value $this->field->save(' '); return array('status' => true); }
function _get_data() { $cache_server =& cache_server(); $key = $this->_get_cache_id(); $data = $cache_server->get($key); if ($data === false) { $recom_mod =& m('recommend'); $brand_mod =& m('brand'); $data = array('goodslist' => $recom_mod->get_recommended_goods($this->options['img_recom_id'], $this->_num, true, $this->options['img_cate_id']), 'slides' => array(), 'brand' => $brand_mod->find(array('conditions' => "tag like '%{$this->options['bcategory']}'", 'order' => 'sort_order', 'limit' => 16)), 'model_name' => $this->options['model_name'], 'keyword_list' => explode(' ', $this->options['keyword_list']), 'ad0_image_url' => $this->options['ad0_image_url']); for ($i = 1; $i <= count($data['keyword_list']) * 5; $i++) { $data['ad' . $i . '_image_url'] = $this->options['ad' . $i . '_image_url']; $data['ad' . $i . '_link_url'] = $this->options['ad' . $i . '_link_url']; $data['ad' . $i . '_title'] = $this->options['ad' . $i . '_title']; } $cache_server->set($key, $data, $this->_ttl); } $keyword_list_ss = array(); foreach ($data['keyword_list'] as $key => $value) { if (!empty($value)) { for ($i = 1; $i <= 5; $i++) { $k = $key * 5 + $i; $keyword_list_ss[$key][$i]['img_url'] = $data['ad' . $k . '_image_url']; $keyword_list_ss[$key][$i]['link'] = $data['ad' . $k . '_link_url']; $keyword_list_ss[$key][$i]['title'] = $data['ad' . $k . '_title']; } } } // echo "<pre>"; // print_r($keyword_list_ss); $this->assign('keyword_list_ss', $keyword_list_ss); return $data; }
function get_type_logist($logist, $city_id, $types) { $logist_fee = array(); // 通过运送目的地city_id(城市id),获取该城市的上级id,即省id,如果 $city_id=0(等于0是在通过淘宝IP数据库无法返回正常的城市名称的前提下出现,当出现该情况时,取默认运费,即设置:province_id=1 if ($city_id) { $region_mod =& m('region'); $region = $region_mod->get(array('conditions' => 'region_id=' . $city_id, 'fields' => 'parent_id')); $porovince_id = $region['parent_id']; } else { $porovince_id = 1; } foreach ($types as $type) { $find = false; if (isset($logist['area_fee'][$type])) { if (isset($logist['area_fee'][$type]['other_fee'])) { foreach ($logist['area_fee'][$type]['other_fee'] as $key => $val) { $dest_ids = explode('|', $val['dest_ids']); if (in_array($city_id, $dest_ids) || in_array($porovince_id, $dest_ids)) { $logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $val['start_standards'], 'start_fees' => $val['start_fees'], 'add_standards' => $val['add_standards'], 'add_fees' => $val['add_fees']); $find = true; break; } } if (!$find) { $logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $logist['area_fee'][$type]['default_fee']['start_standards'], 'start_fees' => $logist['area_fee'][$type]['default_fee']['start_fees'], 'add_standards' => $logist['area_fee'][$type]['default_fee']['add_standards'], 'add_fees' => $logist['area_fee'][$type]['default_fee']['add_fees']); } } else { $logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $logist['area_fee'][$type]['default_fee']['start_standards'], 'start_fees' => $logist['area_fee'][$type]['default_fee']['start_fees'], 'add_standards' => $logist['area_fee'][$type]['default_fee']['add_standards'], 'add_fees' => $logist['area_fee'][$type]['default_fee']['add_fees']); } } } return $logist_fee; }
public function checkAjax() { $adminuser = $this->request('adminuser'); $adminpass = $this->request('adminpass'); $msg = ''; if ($this->isempt($adminuser)) { $msg = '帐号不能为空'; } $log = m('log'); $db = m('admin'); if ($msg == '') { $us = $db->getone("`user`='{$adminuser}' and `status`=1 and `type`=1 and `state`<>5", '`pass`,`id`,`name`,`user`,`imonline`'); if (!$us) { $msg = '帐号不存在'; } else { $pass = $us['pass']; if (md5($adminpass) != $pass) { $msg = '密码不对'; } } } if ($msg == '') { if ($us['imonline'] == 1) { //$msg = '请不要重复登录'; } } if ($msg == '') { $adminid = $us['id']; m('admin')->update("`imonline`=1", $adminid); $keystr = $this->jm->strrocktoken(array('m' => 'index', 'd' => 'webim', 'uid' => $adminid)); $msg = 'success@@@' . $keystr . ''; } echo $msg; }
/** * 查看 * * @author Garbin * @param none * @return void */ function view() { $order_id = isset($_GET['id']) ? intval($_GET['id']) : 0; if (!$order_id) { $this->show_warning('no_such_order'); return; } /* 获取订单信息 */ $model_order =& m('order'); $order_info = $model_order->get(array('conditions' => $order_id, 'join' => 'has_orderextm', 'include' => array('has_ordergoods'))); if (!$order_info) { $this->show_warning('no_such_order'); return; } $order_type =& ot($order_info['extension']); $order_detail = $order_type->get_order_detail($order_id, $order_info); $order_info['group_id'] = 0; if ($order_info['extension'] == 'groupbuy') { $groupbuy_mod =& m('groupbuy'); $groupbuy = $groupbuy_mod->get(array('fields' => 'groupbuy.group_id', 'join' => 'be_join', 'conditions' => "order_id = {$order_info['order_id']} ")); $order_info['group_id'] = $groupbuy['group_id']; } foreach ($order_detail['data']['goods_list'] as $key => $goods) { if (substr($goods['goods_image'], 0, 7) != 'http://') { $order_detail['data']['goods_list'][$key]['goods_image'] = SITE_URL . '/' . $goods['goods_image']; } } $this->assign('order', $order_info); $this->assign($order_detail['data']); $this->display('order.view.html'); }
/** * Init current file system module and server requests handler */ protected function initFileSystem() { /** @var \samsonphp\fs\FileService $fs */ $fs = !isset($this->fs) ? m('fs') : $this->fs; // Store pointer to file system module $this->fs = $fs; }
public function getCategory() { global $_W; $shopset = m('common')->getSysset('shop'); $allcategory = array(); $category = pdo_fetchall("SELECT * FROM " . tablename('ewei_shop_category') . " WHERE uniacid=:uniacid and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(':uniacid' => $_W['uniacid'])); $category = set_medias($category, array('thumb', 'advimg')); foreach ($category as $c) { if (empty($c['parentid'])) { $children = array(); foreach ($category as $c1) { if ($c1['parentid'] == $c['id']) { if (intval($shopset['catlevel']) == 3) { $children2 = array(); foreach ($category as $c2) { if ($c2['parentid'] == $c1['id']) { $children2[] = $c2; } } $c1['children'] = $children2; } $children[] = $c1; } } $c['children'] = $children; $allcategory[] = $c; } } return $allcategory; }
public function getmontlistAjax() { $enddt = $this->get('enddt'); $dt = $this->get('startdt'); $uid = $this->get('uid'); $dtc = c('date', true); $jg = $dtc->datediff('d', $dt, $enddt); $dtaa1 = strtotime($this->date); $dbw = m('schedule'); $arr = array(); for ($i = 0; $i <= $jg; $i++) { if ($i > 0) { $dt = $dtc->adddate($dt, 'd', 1); } $dtaa2 = strtotime($dt); $s = ''; $col = ''; $rows = $dbw->getdtarr($dt, $uid); foreach ($rows as $a => $ars) { $s .= '' . ($a + 1) . '.' . $ars['title'] . '<br>'; } if ($dtaa2 == $dtaa1) { } else { if ($dtaa2 < $dtaa1) { $col = '#888888'; } else { $col = '#888888'; } } $arr[$i + 1] = array('str' => '<font color="' . $col . '">' . $s . '</font>'); } echo json_encode($arr); }
function write(&$frm) { if (isset($_REQUEST["btn_back"])) { return enter($frm); } if ($frm->validate("write")) { return confirm($frm); } $upd = new dbUpdate("suppstock", "cubit"); $del = new dbDelete("suppstock", "cubit"); foreach ($_REQUEST["stkcod"] as $suppid => $stkcod) { if (empty($stkcod)) { $del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'"); $del->run(); continue; } $cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkcod", $stkcod)); $upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'"); $upd->run(DB_REPLACE); } foreach ($_REQUEST["stkdes"] as $suppid => $stkdes) { if (empty($stkcod)) { $del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'"); $del->run(); continue; } $cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkdes", $stkdes)); $upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'"); $upd->run(DB_REPLACE); } $OUT = "<script>window.close();</script>"; return $OUT; }
public function pagesetAction() { $setid = $this->get('setid'); $rs = m('flow_set')->getone("`id`='{$setid}'"); if (!$rs) { exit('sorry!'); } $this->smartydata['rs'] = $rs; $this->title = $rs['name'] . '_页面设置'; $table = $rs['table']; $farr = c('edit')->getfield($table, 1); $fleft = array(); $fleft[] = array('base_name', '申请人'); $fleft[] = array('base_deptname', '申请部门'); $fleft[] = array('base_sericnum', '单号'); foreach ($farr as $k => $rs1) { $fleft[] = array($k, $rs1['name']); } $fleft[] = array('file_content', '相关文件'); $this->smartydata['fleft'] = $fleft; $path = '' . ROOT_PATH . '/webrock/flow/applyview/page/page_' . $rs['num'] . '.html'; $content = ''; if (file_exists($path)) { $content = file_get_contents($path); } $this->smartydata['content'] = $content; }
function AlipayconnectApp() { parent::__construct(); $this->_bink_mod =& m('member_bind'); $this->_app = 'alipay'; $this->alipay_config = $this->_hook('on_alipay_login'); }
public function setFooter() { global $_GPC; $openid = m('user')->getOpenid(); if (empty($openid)) { return; } $mid = intval($_GPC['mid']); $this->footer['first'] = array('text' => '首页', 'ico' => 'home', 'url' => $this->createMobileUrl('shop')); $this->footer['second'] = array('text' => '分类', 'ico' => 'list', 'url' => $this->createMobileUrl('shop/category')); $this->footer['commission'] = false; if (p('commission')) { $set = p('commission')->getSet(); if (empty($set['level'])) { return; } $member = m('member')->getMember($openid); $isagent = $member['isagent'] == 1 && $member['status'] == 1; if ($_GPC['do'] == 'plugin') { $this->footer['first'] = array('text' => '小店', 'ico' => 'home', 'url' => $this->createPluginMobileUrl('commission/myshop', array('mid' => $member['id']))); if ($_GPC['method'] == '') { $this->footer['first']['text'] = "我的小店"; } $this->footer['commission'] = array('text' => '分销中心', 'ico' => 'sitemap', 'url' => $this->createPluginMobileUrl('commission')); } else { if (!$isagent) { $this->footer['commission'] = array('text' => '成为分销商', 'ico' => 'sitemap', 'url' => $this->createPluginMobileUrl('commission/register')); } else { $this->footer['commission'] = array('text' => '小店', 'ico' => 'heart', 'url' => $this->createPluginMobileUrl('commission/myshop', array('mid' => $member['mid']))); } } } }
public function saveAjax() { $stotal = (int) $this->rock->post('stotal'); $mnum = $this->rock->post('mnum'); $ids = array(); $db = m('where'); $ida = '0'; for ($i = 0; $i < $stotal; $i++) { $id = $this->rock->post('id_' . $i); if ($this->rock->contain($id, 'rand')) { $id = '0'; } $id = (int) $id; $where = ''; if ($id > 0) { $where = "`id`='{$id}'"; } $arr = array('name' => $this->rock->post('name_' . $i), 'field' => $this->rock->post('field_' . $i), 'optlx' => $this->rock->post('optlx_' . $i), 'value' => $this->rock->post('value_' . $i), 'values' => $this->rock->post('values_' . $i), 'luoji' => $this->rock->post('luoji_' . $i), 'sort' => $i, 'mnum' => $mnum, 'optdt' => $this->now, 'optid' => $this->adminid); if ($i == 0) { $arr['explain'] = $this->rock->post('explain'); } $db->record($arr, $where); if ($id == 0) { $id = $this->db->insert_id(); } $ids[] = $id; $ida .= ',' . $id . ''; } $db->delete("`mnum`='{$mnum}' and `id` not in({$ida})"); echo json_encode($ids); }
function XwbconnectApp() { parent::__construct(); $this->_bink_mod =& m('member_bind'); $this->_app = 'xwb'; $this->xwb_config = $this->_hook('on_xwb_login'); }
function KmenusinfoApp() { parent::__construct(); $this->_store_id = intval($this->visitor->get('manage_store')); $this->_kmenus_mod =& m('kmenus'); $this->_kmenusinfo_mod =& m('kmenusinfo'); }
private function _index() { $where = array(); $shop_ids = getMyShopId(); $from_shop_id = get('from_shop_id'); if ($from_shop_id && in_array($from_shop_id, $shop_ids)) { $where[] = "from_shop_id ='{$from_shop_id}'"; } else { $where[] = 'from_shop_id in(' . implode(',', $shop_ids) . ')'; } $to_shop_id = get('to_shop_id'); if ($to_shop_id && in_array($to_shop_id, $shop_ids)) { $where[] = "to_shop_id ='{$to_shop_id}'"; } else { $where[] = 'to_shop_id in(' . implode(',', $shop_ids) . ')'; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(sn LIKE '%{$kw}%' OR user_name LIKE '%{$kw}%' OR memo LIKE '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $goods_mod = m('StockAccount'); $data = array(); $data['data'] = $goods_mod->getList($where, $order, page()); $data['count'] = $goods_mod->getCount($where); echo json_encode($data); }
public function testAddField() { $urlQuery = new CUrlQuery(); $urlQuery->addField("name0", "value"); $urlQuery->addField("name1", true); $urlQuery->addField("name2", 1234); $urlQuery->addField("name3", 56.78); $this->assertTrue($urlQuery->queryString()->equals("name0=value&name1=1&name2=1234&name3=56.78")); $urlQuery = new CUrlQuery("name0=value0&name1=value1"); $urlQuery->addField("name2", "value2"); $this->assertTrue($urlQuery->queryString()->equals("name0=value0&name1=value1&name2=value2")); $urlQuery = new CUrlQuery("name0=value0&name1=value1"); $urlQuery->addField("name2", a("elem0", "elem1")); $this->assertTrue($urlQuery->queryString()->equals("name0=value0&name1=value1&name2[]=elem0&name2[]=elem1")); $urlQuery = new CUrlQuery("name0=value0&name1=value1"); $urlQuery->addField("name2", m(["key0" => "value0", "key1" => "value1"])); $this->assertTrue($urlQuery->queryString()->equals("name0=value0&name1=value1&name2[key0]=value0&name2[key1]=value1")); $urlQuery = new CUrlQuery("name0=value0&name1=value1"); $urlQuery->addField("name2", a(true, false)); $this->assertTrue($urlQuery->queryString()->equals("name0=value0&name1=value1&name2[]=1&name2[]=0")); $urlQuery = new CUrlQuery("name0=value0&name1=value1"); $urlQuery->addField("name2", a(1234, 5678)); $this->assertTrue($urlQuery->queryString()->equals("name0=value0&name1=value1&name2[]=1234&name2[]=5678")); $urlQuery = new CUrlQuery("name0=value0&name1=value1"); $urlQuery->addField("name2", a(12.34, 56.78)); $this->assertTrue($urlQuery->queryString()->equals("name0=value0&name1=value1&name2[]=12.34&name2[]=56.78")); $urlQuery = new CUrlQuery(); $urlQuery->addField("arr", a("one", "two")); $urlQuery->addField("map", m(["key0" => "one", "key1" => a("one", "two")])); $this->assertTrue($urlQuery->queryString()->equals("arr[]=one&arr[]=two&map[key0]=one&map[key1][]=one&map[key1][]=two")); }
protected function _initialize() { $this->user_session = session('user'); $this->assign('user_session', $this->user_session); $this->config = d('Config')->get_config(); $this->config['now_city'] = 2035; $this->assign('config', $this->config); c('config', $this->config); $levelDb = m('User_level'); $tmparr = $levelDb->where('22=22')->order('id ASC')->select(); $levelarr = array(); if ($tmparr) { foreach ($tmparr as $vv) { $levelarr[$vv['level']] = $vv; } } $this->user_level = $levelarr; unset($tmparr); unset($levelarr); $this->assign('levelarr', $this->user_level); $this->common_url['group_category_all'] = c('config.site_url') . '/category/all/all'; $this->static_path = $this->config['site_url'] . '/tpl/Static/' . c('DEFAULT_THEME') . '/'; $this->static_public = $this->config['site_url'] . '/static/'; $this->assign('static_path', $this->static_path); $this->assign('static_public', $this->static_public); $this->assign($this->common_url); }
function _get_data() { $cache_server =& cache_server(); $key = $this->_get_cache_id(); $data = $cache_server->get($key); if ($data === false) { $acategory_mod =& m('acategory'); $article_mod =& m('article'); $data = $article_mod->find(array('conditions' => 'cate_id=' . $acategory_mod->get_ACC(ACC_NOTICE) . ' AND if_show = 1', 'order' => 'sort_order ASC, add_time DESC', 'fields' => 'article_id, title, add_time', 'limit' => $this->_num)); $cache_server->set($key, $data, $this->_ttl); } //取yahoo汇率 $amount = urlencode($amount); $from_Currency = urlencode($from_Currency); $to_Currency = urlencode($to_Currency); $url = "http://download.finance.yahoo.com/d/quotes.csv?s=CNYPHP=X&f=sl1d1t1ba&e=.csv"; $ch = curl_init(); $timeout = 0; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $rawdata = curl_exec($ch); curl_close($ch); $huilv = explode(',', $rawdata); $phphuilv = isset($huilv['1']) ? $huilv['1'] : 7.3943; $this->assign('phphuilv', $phphuilv); //在线人数 $onlinepersons = 20 + rand(10, 100); $this->assign('onlinepersons', $onlinepersons); return $data; }
function get_header_gcategories($amount, $position, $brand_is_recommend = 1) { $gcategory_mod =& bm('gcategory', array('_store_id' => 0)); $gcategories = array(); if (!$amount) { $gcategories = $gcategory_mod->get_list(-1, true); } else { $gcategory = $gcategory_mod->get_list(0, true); $gcategories = $gcategory; foreach ($gcategory as $val) { $result = $gcategory_mod->get_list($val['cate_id'], true); $result = array_slice($result, 0, $amount); $gcategories = array_merge($gcategories, $result); } } import('tree.lib'); $tree = new Tree(); $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name'); $gcategory_list = $tree->getArrayList(0); $i = 0; $brand_mod =& m('brand'); foreach ($gcategory_list as $k => $v) { $gcategory_list[$k]['top'] = isset($position[$i]) ? $position[$i] : '0px'; $i++; $gcategory_list[$k]['brands'] = $brand_mod->find(array('conditions' => "tag = '" . $v['value'] . "' AND recommended=" . $brand_is_recommend, 'order' => 'sort_order asc,brand_id desc')); } return array('gcategories' => $gcategory_list); }
protected function contentother() { $headstr = 'address,发送地点@items,所属项目@startdt,发生日期@moneys,金额@explain,说明'; $rows = m('fininfos')->getall("`mid`='{$this->id}' order by `sort`"); $arr[] = array('fields' => 'hdhhd', 'fields_style' => '', 'name' => '报销明细', 'data' => c('html')->createrows($rows, $headstr)); return $arr; }
public function savelistAjax() { $mnum = $this->post('mnum'); $total = (int) $this->post('total'); $pid = ''; $msg = 'success'; $db = m('option'); $pid = $db->getmou('id', "`num`='{$mnum}'"); for ($i = 0; $i < $total; $i++) { $id = (int) $this->post('id_' . $i . ''); $num = $this->post('num_' . $i . ''); $num = str_replace('{rand}', rand(10, 9999), $num); if (!$this->isempt($num)) { if ($db->rows("`num`='{$num}' and `id`<>'{$id}'") > 0) { $msg = '编号[' . $num . ']已存在'; break; } } $where = "`id`='{$id}'"; if ($id == 0) { $where = ''; } $db->record(array('name' => $this->post('name_' . $i . ''), 'value' => $this->post('value_' . $i . ''), 'mnum' => $mnum, 'pid' => $pid, 'num' => $num, 'xu' => $i, 'optid' => $this->adminid, 'optdt' => $this->now), $where); } echo $msg; }
private function _index() { $where = array(); $shop_id = get('shop_id'); $shop_ids = getMyShopId(); if ($shop_id && in_array($shop_id, $shop_ids)) { $where[] = "shop_id ='{$shop_id}'"; } else { $where[] = 'shop_id in(' . implode(',', $shop_ids) . ')'; } $cate_id = get('cate_id'); if (!empty($cate_id)) { $where[] = "cate_id={$cate_id}"; } $kw = get('kw'); if (!empty($kw)) { $where[] = "(sku LIKE '%{$kw}%' OR \n name LIKE '%{$kw}%' OR \n pinyin LIKE '%{$kw}%' OR \n barcode LIKE '%{$kw}%')"; } $order = array(); $sort = get('sort'); if (is_array($sort)) { foreach ($sort as $key => $val) { $order[] = $key . ' ' . $val; } } $goods_mod = m('Stock'); $data = array(); $data['data'] = $goods_mod->getList($where, $order, page()); $data['count'] = $goods_mod->getCount($where); echo json_encode($data); }
function AdApp() { parent::__construct(); //初始化数据模型 $this->_ad_mod =& m('ad'); $this->_ad_position_mod =& m('ad_position'); }
/** * Generic material form controller * * @param int|null $materialId Editing material identifier if not null. * If null is passed material creation form will be displayed * @param int|null $navigation Structure material belongs to. */ public function __form($materialId = null, $navigation = null) { // If this is form for a new material with structure relation if ($materialId == 0 && isset($navigation)) { // Create new material db record $material = new \samson\cms\CMSMaterial(false); $material->Active = 1; $material->Created = date('Y-m-d H:m:s'); $user = m('social')->user(); $material->UserID = $user->user_id; $material->save(); // Set new material as current $materialId = $material->id; // Convert parent CMSNavigation to an array $navigationArray = !is_array($navigation) ? array($navigation) : $navigation; // Fill parent CMSNavigation relations for material foreach ($navigationArray as $navigation) { // Create relation with structure $structureMaterial = new \samson\activerecord\structurematerial(false); $structureMaterial->MaterialID = $material->id; $structureMaterial->StructureID = $navigation; $structureMaterial->Active = 1; $structureMaterial->save(); } } // Create form object $form = new Form($materialId, $navigation); if ($materialId == 0) { $this->set('new_material', true); } // Render form $this->html($form->render()); }
public function yudingcarlist($table, $rows) { $dt = $this->date; $dtobj = c('date'); $db = m('careserve'); for ($i = 0; $i < 5; $i++) { if ($i > 0) { $dt = $dtobj->adddate($dt, 'd', 1); } foreach ($rows as $k => $rs) { $carid = $rs['id']; $arr = $db->getall("`carid`='{$carid}' and `status` in(0,1) and `startdt`<='{$dt} 23:59:59' and `enddt`>='{$dt} 00:00:00' order by `startdt` asc", '`usename`,`status`,`startdt`,`enddt`'); $str = ''; foreach ($arr as $k1 => $rs1) { $stz = '<font color=blue>待审核</font>'; if ($rs1['status'] == 1) { $stz = '<font color=green>已审核</font>'; } $str .= '' . $rs1['usename'] . '使用(' . $stz . ')<br>' . substr($rs1['startdt'], 5, 11) . '→' . substr($rs1['enddt'], 5, 11) . '<br>'; } $rows[$k]['dt' . $i . ''] = $str; } } return array('rows' => $rows); }
public function delete_planet(array $params) { $planetID = array_val_required($params, 'planetID'); $planet = m('Planet', $planetID); $planet->delete(); v('json/success', 'Planet deleted'); }
function SwfuploadApp() { /* 建立会话 */ if (isset($_POST["ECM_ID"]) && isset($_POST['HTTP_USER_AGENT'])) { $_COOKIE['ECM_ID'] = $_POST["ECM_ID"]; $_SERVER['HTTP_USER_AGENT'] = $_POST['HTTP_USER_AGENT']; } else { $this->json_error('no_post_params_authorize'); exit; } parent::__construct(); /* 初始化 */ if (isset($_POST['belong'])) { $this->belong = $_POST['belong']; } else { $this->json_error('no_post_param_belong'); exit; } if (isset($_POST['item_id'])) { $this->item_id = $_POST['item_id']; } else { $this->json_error('no_post_param_item_id'); exit; } switch ($this->belong) { case BELONG_ARTICLE: $this->save_path = 'data/files/mall/article'; break; } $this->mod_uploadedfile =& m('uploadedfile'); }
function doLogin() { if (!verifyHash($_POST['hash'])) { $this->error('非验证的来源!'); } if (empty($_POST['username'])) { $this->error('帐号不能为空!'); } if (empty($_POST['password'])) { $this->error('密码不能为空!'); } if (empty($_POST['verify'])) { $this->error('验证码不能为空!'); } if ($_SESSION['verify'] != strtolower($_POST['verify'])) { $this->error('验证码错误!'); } $info = m('User')->getRowByName($_POST['username']); if (empty($info)) { $this->error('账号不存在'); } if ($info['password'] != md5($_POST['password'])) { $this->error('密码错误!'); } $_SESSION['user_id'] = $info['id']; $_SESSION['user_name'] = $info['username']; $_SESSION['shop_id'] = $info['shop_id']; $_SESSION['shop_name'] = $info['shop_name']; $_SESSION['role_id'] = $info['role_id']; $data = array(); $data['login_time'] = time(); $data['ip_address'] = getIp(); m('User')->update($data, "id='{$info['id']}'"); $this->success('登录成功!', url()); }