示例#1
0
 public function set_setting($application, $setting = null)
 {
     if (!is_null($setting)) {
         return $this->where(array('application' => $application))->update(array('setting' => array2string($setting)));
     }
     return false;
 }
示例#2
0
 /**
  * 保存配置信息
  */
 public function save()
 {
     $setting = array();
     $setting['admin_email'] = is_email($_POST['setting']['admin_email']) ? trim($_POST['setting']['admin_email']) : showmessage(L('email_illegal'), HTTP_REFERER);
     $setting['maxloginfailedtimes'] = intval($_POST['setting']['maxloginfailedtimes']);
     $setting['minrefreshtime'] = intval($_POST['setting']['minrefreshtime']);
     $setting['mail_type'] = intval($_POST['setting']['mail_type']);
     $setting['mail_server'] = trim($_POST['setting']['mail_server']);
     $setting['mail_port'] = intval($_POST['setting']['mail_port']);
     $setting['category_ajax'] = intval(abs($_POST['setting']['category_ajax']));
     $setting['mail_user'] = trim($_POST['setting']['mail_user']);
     $setting['mail_auth'] = intval($_POST['setting']['mail_auth']);
     $setting['mail_from'] = trim($_POST['setting']['mail_from']);
     $setting['mail_password'] = trim($_POST['setting']['mail_password']);
     $setting['errorlog_size'] = trim($_POST['setting']['errorlog_size']);
     $setting = array2string($setting);
     $this->db->update(array('setting' => $setting), array('module' => 'admin'));
     //存入admin模块setting字段
     //如果开始盛大通行证接入,判断服务器是否支持curl
     $snda_error = '';
     if ($_POST['setconfig']['snda_akey'] || $_POST['setconfig']['snda_skey']) {
         if (function_exists('curl_init') == FALSE) {
             $snda_error = L('snda_need_curl_init');
             $_POST['setconfig']['snda_enable'] = 0;
         }
     }
     set_config($_POST['setconfig']);
     //保存进config文件
     $this->setcache();
     showmessage(L('setting_succ') . $snda_error, HTTP_REFERER);
 }
示例#3
0
 function add()
 {
     if ($_POST['dosubmit']) {
         $siteid = intval($_POST['siteid']) ? intval($_POST['siteid']) : showmessage(L('parameter_error'), HTTP_REFERER);
         if ($this->db->get_one(array('siteid' => $siteid))) {
             showmessage(L('wap_add_samesite_error'), HTTP_REFERER);
         }
         $sitename = trim(new_addslashes($_POST['sitename']));
         $logo = trim($_POST['logo']);
         $domain = trim($_POST['domain']);
         $setting = array2string($_POST['setting']);
         $return_id = $this->db->insert(array('siteid' => $siteid, 'sitename' => $sitename, 'logo' => $logo, 'domain' => $domain, 'setting' => $setting), '1');
         $this->wap_site_cache();
         showmessage(L('operation_success'), '', '', 'add');
     } else {
         $sitelists = array();
         $current_siteid = get_siteid();
         $sitelists = $this->sites->get_list();
         if ($_SESSION['roleid'] == '1') {
             foreach ($sitelists as $key => $v) {
                 $sitelist[$key] = $v['name'];
             }
         } else {
             $sitelist[$current_siteid] = $sitelists[$current_siteid]['name'];
         }
         $show_header = true;
         include $this->admin_tpl('m_add');
     }
 }
示例#4
0
 public function ajaxeditAction()
 {
     $user = $this->userinfo;
     $userid = $user['userid'];
     if ($this->post('submit')) {
         $usermenu = $this->post('menu');
         $menu = array();
         foreach ($usermenu['name'] as $id => $v) {
             if ($v && $usermenu['url'][$id]) {
                 $menu[$id] = array('name' => $v, 'url' => $usermenu['url'][$id]);
             }
         }
         $data = array('realname' => $this->post('realname'), 'email' => $this->post('email'), 'usermenu' => array2string($menu));
         if ($this->post('password')) {
             $data['password'] = md5(md5($this->post('password')) . $user['salt'] . md5($this->post('password')));
         }
         $this->user->update($data, 'userid=' . $userid);
         $this->adminMsg(lang('success'), url('admin/user/ajaxedit/'), 3, 1, 1);
     }
     if (empty($user)) {
         $this->adminMsg(lang('a-use-3'));
     }
     $this->view->assign(array('data' => $user, 'menu' => string2array($user['usermenu'])));
     $this->view->display('admin/user_edit');
 }
示例#5
0
 /**
  * 广告修改
  */
 public function edit()
 {
     $_GET['id'] = intval($_GET['id']);
     if (!$_GET['id']) {
         showmessage(L('illegal_action'), HTTP_REFERER);
     }
     if (isset($_POST['dosubmit'])) {
         $poster = $this->check($_POST['poster']);
         $setting = $this->check_setting($_POST['setting'], $poster['type']);
         $poster['setting'] = array2string($setting);
         $this->db->update($poster, array('id' => $_GET['id'], 'siteid' => $this->get_siteid()));
         $this->create_js(intval($_GET['spaceid']));
         foreach ($setting as $im) {
             $imgs[] = $im['imageurl'];
         }
         if (pc_base::load_config('system', 'attachment_stat')) {
             $this->attachment_db = pc_base::load_model('attachment_model');
             $this->attachment_db->api_update($imgs, 'poster-' . $_GET['id'], 1);
         }
         showmessage(L('edit_ads_success'), 'index.php?m=poster&c=poster&a=init&spaceid=' . $_GET['spaceid']);
     } else {
         $info = $this->db->get_one(array('id' => $_GET['id'], 'siteid' => $this->get_siteid()));
         $sinfo = $this->s_db->get_one(array('spaceid' => $info['spaceid'], 'siteid' => $this->get_siteid()), 'name, type');
         $setting = $this->get_setting($sinfo['type']);
         $TYPES = get_types();
         $info['setting'] = string2array($info['setting']);
         $default = count($setting) > 0 ? L('please_select') . '    ' : '';
         $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=poster&c=space&a=add\', title:\'' . L('add_space') . '\', width:\'540\', height:\'320\'}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_space'));
         pc_base::load_sys_class('form', '', 0);
         include $this->admin_tpl('poster_edit');
     }
 }
示例#6
0
 /**
  * member list
  */
 function manage()
 {
     if (isset($_POST['dosubmit'])) {
         $member_setting = array2string($_POST['info']);
         $this->db->update(array('module' => 'member', 'setting' => $member_setting), array('module' => 'member'));
         setcache('member_setting', $_POST['info']);
         showmessage(L('operation_success'), HTTP_REFERER);
     } else {
         $show_scroll = true;
         $member_setting = $this->db->get_one(array('module' => 'member'), 'setting');
         $member_setting = string2array($member_setting['setting']);
         $email_config = getcache('common', 'commons');
         $this->sms_setting_arr = getcache('sms', 'sms');
         $siteid = get_siteid();
         if (empty($email_config['mail_user']) || empty($email_config['mail_password'])) {
             $mail_disabled = 1;
         }
         if (!empty($this->sms_setting_arr[$siteid])) {
             $this->sms_setting = $this->sms_setting_arr[$siteid];
             if ($this->sms_setting['sms_enable'] == '0') {
                 $sms_disabled = 1;
             } else {
                 if (empty($this->sms_setting['userid']) || empty($this->sms_setting['productid']) || empty($this->sms_setting['sms_key'])) {
                     $sms_disabled = 1;
                 }
             }
         } else {
             $sms_disabled = 1;
         }
         include $this->admin_tpl('member_setting');
     }
 }
示例#7
0
文件: poster.php 项目: hxzyzz/ddc
	/**
	 * 广告修改
	 */
	public function edit() {
		$_GET['id'] = intval($_GET['id']);
		if (!$_GET['id']) showmessage(L('illegal_action'), HTTP_REFERER);
		if (isset($_POST['dosubmit'])) {
			$poster = $this->check($_POST['poster']);
			$setting = $this->check_setting($_POST['setting'], $poster['type']);
			$poster['setting'] = array2string($setting);
			$this->db->update($poster, array('id'=>$_GET['id'], 'siteid'=>$this->get_siteid()));
			$this->create_js(intval($_GET['spaceid']));
			foreach ($setting as $im) {
				$imgs[] = $im['imageurl'];
			}
			if(pc_base::load_config('system','attachment_stat')) {
				$this->attachment_db = pc_base::load_model('attachment_model');
				$this->attachment_db->api_update($imgs, 'poster-'.$_GET['id'], 1);
			}
			showmessage(L('operation_success'), HTTP_REFERER, '', 'edit');
		} else {
			
			$info = $this->db->get_one(array('id'=>$_GET['id'], 'siteid'=>$this->get_siteid()));
			$sinfo = $this->s_db->get_one(array('spaceid' => $info['spaceid'], 'siteid'=>$this->get_siteid()), 'name, type');
			$setting = $this->get_setting($sinfo['type']);
			$TYPES = get_types();
			$info['setting'] = string2array($info['setting']);
			$default = count($setting)>0 ? L('please_select').'    ' : '';
			pc_base::load_sys_class('form', '', 0);
			include $this->admin_tpl('poster_edit');
		}
	}
示例#8
0
 /**
  * 编辑表单向导
  */
 public function edit()
 {
     if (!isset($_GET['formid']) || empty($_GET['formid'])) {
         showmessage(L('illegal_operation'), HTTP_REFERER);
     }
     $formid = intval($_GET['formid']);
     if (isset($_POST['dosubmit'])) {
         if ($_POST['setting']['starttime']) {
             $_POST['setting']['starttime'] = strtotime($_POST['setting']['starttime']);
         }
         if ($_POST['setting']['endtime']) {
             $_POST['setting']['endtime'] = strtotime($_POST['setting']['endtime']);
         }
         $_POST['info'] = $this->check_info($_POST['info'], $formid);
         $_POST['info']['setting'] = array2string($_POST['setting']);
         $_POST['info']['js_template'] = $_POST['info']['show_js_template'];
         unset($_POST['info']['show_js_template']);
         $this->db->where(array('modelid' => $formid))->update($_POST['info']);
         showmessage(L('update_success'), U('formguide/formguide/edit', array('formid' => $formid)), '', 'edit');
     } else {
         $template_list = template_list(0);
         foreach ($template_list as $k => $v) {
             $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($template_list[$k]);
         }
         $data = $this->db->getby_modelid($formid);
         $data['setting'] = string2array($data['setting']);
         $show_header = $show_validator = $show_scroll = 1;
         include $this->view('formguide_edit');
     }
 }
示例#9
0
 public function edit()
 {
     if (isset($_POST['dosubmit'])) {
         $infos = $this->method->get_payment($_POST['pay_code']);
         $config = $infos['config'];
         foreach ($_POST['config_name'] as $key => $value) {
             $config[$value]['value'] = trim($_POST['config_value'][$key]);
         }
         $info['config'] = array2string($config);
         $info['name'] = trim($_POST['name']);
         $info['pay_name'] = trim($_POST['pay_name']);
         $info['pay_desc'] = trim($_POST['description']);
         $info['pay_id'] = $_POST['pay_id'];
         $info['pay_code'] = trim($_POST['pay_code']);
         $info['pay_order'] = intval($_POST['pay_order']);
         $info['pay_method'] = intval($_POST['pay_method']);
         $info['pay_fee'] = intval($_POST['pay_method']) == 0 ? intval($_POST['pay_rate']) : intval($_POST['pay_fix']);
         $info['is_cod'] = trim($_POST['is_cod']);
         $info['is_online'] = trim($_POST['is_online']);
         $info['enabled'] = '1';
         $info['author'] = $infos['author'];
         $info['website'] = $infos['website'];
         $info['version'] = $infos['version'];
         $infos = $this->db->update($info, array('pay_id' => $info['pay_id']));
         showmessage(L('edit') . L('succ'), '', '', 'edit');
     } else {
         $pay_id = intval($_GET['id']);
         $infos = $this->db->get_one(array('pay_id' => $pay_id));
         extract($infos);
         $config = string2array($config);
         $show_header = true;
         $show_validator = true;
         include $this->admin_tpl('payment_detail');
     }
 }
示例#10
0
 /**
  * 添加、修改内容数据
  */
 public function set($id, $data)
 {
     //数组转化为字符
     foreach ($data as $i => $t) {
         if (is_array($t)) {
             $data[$i] = array2string($t);
         }
     }
     if ($id) {
         //修改
         unset($data['id']);
         $this->update($data, 'id=' . $id);
     } else {
         //添加
         $id = $this->get_form_id();
         //生成唯一id
         $data['id'] = $id;
         if (empty($id)) {
             return false;
         }
         $this->insert($data);
         // 回调函数
         $table = str_replace($this->prefix, '', $this->table_name);
         $function = 'callback_' . $table;
         $file = MODEL_DIR . 'callback/' . $table . '.php';
         if (is_file($file)) {
             include_once $file;
             if (function_exists($function)) {
                 $function($data);
             }
         }
     }
     return $id;
 }
示例#11
0
 /**
  * 资料修改
  */
 public function editAction()
 {
     $modelid = $this->memberinfo[modelid];
     $fields = $this->membermodel[$modelid]['fields'];
     if ($this->isPostForm()) {
         $data = $this->input->post('data', TRUE);
         $this->checkFields($fields, $data, 2);
         $this->member->update(array('nickname' => $data['nickname']), 'id=' . $this->memberinfo['id']);
         $memberdata = $this->memberdata->find($this->memberinfo['id']);
         foreach ($data as $i => $t) {
             if (is_array($t)) {
                 $data[$i] = array2string($t);
             }
         }
         if ($memberdata) {
             //修改附表内容
             $this->memberdata->update($data, 'id=' . $this->memberinfo['id']);
         } else {
             $data['id'] = $this->memberinfo['id'];
             $this->memberdata->insert($data);
         }
         //增加会员统计表
         $count = $this->model('member_count');
         $data = $count->find($this->memberinfo['id']);
         if (!$data) {
             $count->insert(array('id' => $this->memberinfo['id']));
         }
         $this->memberMsg(lang('success'), url('member/info/edit'), 1);
     }
     //自定义字段
     $data_fields = $this->getFields($fields, $this->memberinfo);
     $this->view->assign(array('data_fields' => $data_fields, 'meta_title' => lang('m-inf-0') . '-' . lang('member') . '-' . $this->site['SITE_NAME']));
     $this->view->display('member/edit');
 }
示例#12
0
 public function set($catid, $data)
 {
     unset($data['catid']);
     $data['site'] = $this->getSiteId();
     if ($catid) {
         unset($data['typeid'], $data['modelid']);
         if ($data['synpost']) {
             //同步子栏目
             $childs = $this->child($catid);
             $childs = explode(',', $childs);
             if (count($childs) > 2) {
                 foreach ($childs as $id) {
                     if (empty($id) || $id == $catid) {
                         continue;
                     }
                     $cdata = $this->find($id);
                     $cset = string2array($cdata['setting']);
                     $cset['memberpost'] = $data['setting']['memberpost'];
                     $cset['modelpost'] = $data['setting']['modelpost'];
                     $cset['adminpost'] = $data['setting']['adminpost'];
                     $cset['rolepost'] = $data['setting']['rolepost'];
                     $cset['grouppost'] = $data['setting']['grouppost'];
                     $cset['guestpost'] = $data['setting']['guestpost'];
                     $cset['verifypost'] = $data['setting']['verifypost'];
                     $cset['verifyrole'] = $data['setting']['verifyrole'];
                     $this->update(array('setting' => array2string($cset)), 'catid=' . $id);
                 }
             }
         }
         unset($data['synpost']);
         $data['setting'] = array2string($data['setting']);
         $this->update($data, 'catid=' . $catid);
         $this->repair();
         return $catid;
     } else {
         //继承父栏目权限配置
         if (!empty($data['parentid']) && empty($data['child'])) {
             $pdata = $this->find($data['parentid']);
             $pset = string2array($pdata['setting']);
             $data['setting']['memberpost'] = $data['setting']['memberpost'] ? $data['setting']['memberpost'] : ($pset['memberpost'] ? $pset['memberpost'] : null);
             $data['setting']['modelpost'] = $data['setting']['modelpost'] ? $data['setting']['modelpost'] : ($pset['modelpost'] ? $pset['modelpost'] : null);
             $data['setting']['adminpost'] = $data['setting']['adminpost'] ? $data['setting']['adminpost'] : ($pset['adminpost'] ? $pset['adminpost'] : null);
             $data['setting']['rolepost'] = $data['setting']['rolepost'] ? $data['setting']['rolepost'] : ($pset['rolepost'] ? $pset['rolepost'] : null);
             $data['setting']['grouppost'] = $data['setting']['grouppost'] ? $data['setting']['grouppost'] : ($pset['grouppost'] ? $pset['grouppost'] : null);
             $data['setting']['guestpost'] = $data['setting']['guestpost'] ? $data['setting']['guestpost'] : ($pset['guestpost'] ? $pset['guestpost'] : null);
             $data['setting']['verifypost'] = $data['setting']['verifypost'] ? $data['setting']['verifypost'] : ($pset['verifypost'] ? $pset['verifypost'] : null);
             $data['setting']['verifyrole'] = $data['setting']['verifyrole'] ? $data['setting']['verifyrole'] : ($pset['verifyrole'] ? $pset['verifyrole'] : null);
             unset($pdata, $pset);
         }
         unset($data['synpost']);
         $data['setting'] = array2string($data['setting']);
         $data['child'] = 0;
         $data['arrchildid'] = '';
         $data['arrparentid'] = '';
         $this->insert($data);
     }
     $catid = $this->get_insert_id();
     $this->repair();
     return empty($catid) ? lang('failure') : $catid;
 }
示例#13
0
 /**
  * 广告修改
  */
 public function edit()
 {
     $_GET['id'] = intval($_GET['id']);
     if (!$_GET['id']) {
         showmessage(L('illegal_action'), HTTP_REFERER);
     }
     if (isset($_POST['dosubmit'])) {
         $poster = $this->check($_POST['poster']);
         $setting = $this->check_setting($_POST['setting'], $poster['type']);
         $poster['setting'] = array2string($setting);
         $this->db->where(array('id' => $_GET['id']))->update($poster);
         $this->create_js(intval($_GET['spaceid']));
         foreach ($setting as $im) {
             $imgs[] = $im['imageurl'];
         }
         if (C('attachment', 'stat')) {
             $this->attachment_db = Loader::model('attachment_model');
             $this->attachment_db->api_update($imgs, 'poster-' . $_GET['id'], 1);
         }
         showmessage(L('operation_success'), HTTP_REFERER, '', 'edit');
     } else {
         $info = $this->db->where(array('id' => $_GET['id']))->find();
         $sinfo = $this->s_db->field('name, type')->where(array('spaceid' => $info['spaceid']))->find();
         $setting = $this->get_setting($sinfo['type']);
         $TYPES = get_types();
         $info['setting'] = string2array($info['setting']);
         $default = count($setting) > 0 ? L('please_select') . '    ' : '';
         include $this->view('poster_edit');
     }
 }
示例#14
0
 public function edit()
 {
     $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : $this->error(L('illegal_parameters'));
     if ($site = $this->db->where(array('id' => $siteid))->find()) {
         if (IS_POST) {
             $this->checkToken();
             $data = $_POST['info'];
             $data['setting'] = array2string($_POST['setting']);
             if ($this->db->where(array('id' => $siteid))->save($data) !== false) {
                 $this->db->set_cache();
                 $this->success(L('setting_succ'));
             } else {
                 $this->error(L('operation_failure'));
             }
         } else {
             $template_list = template_list();
             $setting = string2array($site['setting']);
             $setting['watermark_img'] = str_replace('statics/images/water/', '', $setting['watermark_img']);
             $this->assign('template_list', $template_list);
             $this->assign('setting', $setting);
             $this->assign('data', $site);
             $this->display();
         }
     } else {
         $this->error(L('notfound'));
     }
 }
示例#15
0
 public function editAction()
 {
     $userid = (int) $this->get('userid');
     $data = $this->db->setTableName('admin')->find($userid);
     $auth = string2array($data['auth']);
     $cats = get_cache('category');
     if (empty($data)) {
         $this->show_message('该用户不存在', 2);
     }
     if ($this->post('submit')) {
         $data = $this->post('data');
         if (!empty($data['password'])) {
             if (strlen($data['password']) < 6) {
                 $this->show_message('密码最少6位数', 2, 1);
             }
             $data['password'] = md5(md5($data['password']));
         } else {
             unset($data['password']);
         }
         $auth = $this->post('auth');
         $data['auth'] = array2string($auth);
         $this->db->setTableName('admin')->update($data, 'userid=?', $userid);
         $this->cacheAction();
         $this->show_message('修改成功', 1);
     }
     include $this->admin_tpl('admin_add');
 }
示例#16
0
文件: credit.php 项目: hxzyzz/ddc
	/**
	 * 添加规则
	 */
	public function add() {
		if (isset($_POST['dosubmit'])) {
			$ruledata['fromid'] = isset($_POST['fromid']) ? intval($_POST['fromid']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
			$ruledata['toid'] = isset($_POST['toid']) ? intval($_POST['toid']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
			$ruledata['fromrate'] = isset($_POST['fromrate']) ? intval($_POST['fromrate']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
			$ruledata['torate'] = isset($_POST['torate']) ? intval($_POST['torate']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
			if(empty($_POST['from']) || empty($_POST['to'])) {
				showmessage(L('illegal_parameters'), HTTP_REFERER);
			}
			$fromarr = explode('_', $_POST['from']);
			$toarr = explode('_', $_POST['to']);
			$ruledata['from'] = isset($fromarr[0]) ? $fromarr[0] : '';
			$ruledata['fromname'] = isset($fromarr[1]) ? $fromarr[1] : '';
			$ruledata['fromunit'] = isset($fromarr[2]) ? $fromarr[2] : '';
			$ruledata['to'] = isset($toarr[0]) ? $toarr[0] : '';
			$ruledata['toname'] = isset($toarr[1]) ? $toarr[1] : '';
			$ruledata['tounit'] = isset($toarr[2]) ? $toarr[2] : '';
			
			$creditlistarr = $this->db->get_one(array('name'=>'creditrate'));
			
			$creditlist = string2array($creditlistarr['data']);
			$creditlist[] = $ruledata;
			$noticedata['creditlist'] = $creditlist;
			//加入消息队列
			messagequeue::add('credit_update', $noticedata);
			
			setcache('creditlist', $creditlist);
			$this->db->insert(array('name'=>'creditrate', 'data'=>array2string($creditlist)), 1, 1);
			showmessage(L('operation_success'), HTTP_REFERER);
		}
		$applist = getcache('applist');
	
		include $this->admin_tpl('credit_add');
	}
示例#17
0
 /**
  * 编辑联动菜单
  */
 public function edit()
 {
     if (isset($_POST['dosubmit'])) {
         $info = array();
         $linkageid = intval($_POST['linkageid']);
         $info['name'] = isset($_POST['info']['name']) && trim($_POST['info']['name']) ? trim($_POST['info']['name']) : showmessage(L('linkage_not_empty'));
         $info['description'] = trim($_POST['info']['description']);
         $info['style'] = trim(intval($_POST['info']['style']));
         $info['siteid'] = trim(intval($_POST['info']['siteid']));
         $info['setting'] = array2string(array('level' => intval($_POST['info']['level'])));
         if ($_POST['info']['keyid']) {
             $info['keyid'] = trim($_POST['info']['keyid']);
         }
         if ($_POST['info']['parentid']) {
             $info['parentid'] = trim($_POST['info']['parentid']);
         }
         $this->db->update($info, array('linkageid' => $linkageid));
         $id = $info['keyid'] ? $info['keyid'] : $linkageid;
         showmessage(L('operation_success'), '', '', 'edit');
     } else {
         $linkageid = intval($_GET['linkageid']);
         $info = $this->db->get_one(array('linkageid' => $linkageid));
         extract($info);
         $setting = string2array($setting);
         $sitelist = $this->sites->get_list();
         foreach ($sitelist as $id => $v) {
             $sitelist[$id] = $v['name'];
         }
         $show_header = true;
         $show_validator = true;
         include $this->admin_tpl('linkage_edit');
     }
 }
示例#18
0
 /**
  * 编辑广告版位
  */
 public function edit()
 {
     if (!isset($_GET['spaceid'])) {
         showmessage(L('illegal_operation'), HTTP_REFERER);
     }
     $_GET['spaceid'] = intval($_GET['spaceid']);
     if (isset($_POST['dosubmit'])) {
         $space = $this->check($_POST['space']);
         $space['setting'] = array2string($_POST['setting']);
         if ($space['type'] == 'code') {
             $space['path'] = '{show_ad(' . $_GET['spaceid'] . ')}';
         } else {
             $space['path'] = 'poster_js/' . $_GET['spaceid'] . '.js';
         }
         if (isset($_POST['old_type']) && $_POST['old_type'] != $space['type']) {
             $poster_db = Loader::model('poster_model');
             $poster_db->where(array('spaceid' => $_GET['spaceid']))->delete();
             $space['items'] = 0;
         }
         if ($this->db->where(array('spaceid' => $_GET['spaceid']))->update($space)) {
             showmessage(L('edited_successful'), U('poster/space'), '', 'testIframe' . $_GET['spaceid']);
         } else {
             showmessage(L('edited_successful'), U('poster/space'), '', 'testIframe' . $_GET['spaceid']);
         }
     } else {
         $info = $this->db->getby_spaceid($_GET['spaceid']);
         $setting = string2array($info['setting']);
         $types = $this->template_type();
         $poster_template = S('common/poster_template');
         $show_header = $show_validator = true;
         include $this->view('space_edit');
     }
 }
示例#19
0
 /**
  * 添加会员模型
  */
 function add()
 {
     if (isset($_POST['dosubmit'])) {
         $info = array();
         $info['name'] = $_POST['info']['modelname'];
         $info['tablename'] = 'member_' . $_POST['info']['tablename'];
         $info['description'] = $_POST['info']['description'];
         $info['type'] = 2;
         $info['siteid'] = $this->get_siteid();
         if (!empty($_FILES['model_import']['tmp_name'])) {
             $model_import = @file_get_contents($_FILES['model_import']['tmp_name']);
             if (!empty($model_import)) {
                 $model_import_data = string2array($model_import);
             }
         }
         $is_exists = $this->db->table_exists($info['tablename']);
         if ($is_exists) {
             showmessage(L('operation_failure'), '?m=member&c=member_model&a=manage', '', 'add');
         }
         $modelid = $this->db->insert($info, 1);
         if ($modelid) {
             $model_sql = file_get_contents(MODEL_PATH . 'model.sql');
             $tablepre = $this->db->db_tablepre;
             $tablename = $info['tablename'];
             $model_sql = str_replace('$tablename', $tablepre . $tablename, $model_sql);
             $this->db->sql_execute($model_sql);
             if (!empty($model_import_data)) {
                 $this->sitemodel_field_db = pc_base::load_model('sitemodel_field_model');
                 $tablename = $tablepre . $tablename;
                 foreach ($model_import_data as $v) {
                     //修改模型表字段
                     $field = $v['field'];
                     $minlength = $v['minlength'] ? $v['minlength'] : 0;
                     $maxlength = $v['maxlength'] ? $v['maxlength'] : 0;
                     $field_type = $v['formtype'];
                     require MODEL_PATH . $field_type . DIRECTORY_SEPARATOR . 'config.inc.php';
                     if (isset($v['setting']['fieldtype'])) {
                         $field_type = $v['setting']['fieldtype'];
                     }
                     require MODEL_PATH . 'add.sql.php';
                     $v['setting'] = array2string($v['setting']);
                     $v['modelid'] = $modelid;
                     unset($v['fieldid']);
                     $fieldid = $this->sitemodel_field_db->insert($v, 1);
                 }
             }
             //更新模型缓存
             pc_base::load_app_class('member_cache', '', '');
             member_cache::update_cache_model();
             showmessage(L('operation_success'), '?m=member&c=member_model&a=manage', '', 'add');
         } else {
             showmessage(L('operation_failue'), '?m=member&c=member_model&a=manage', '', 'add');
         }
     } else {
         $show_header = $show_scroll = true;
         include $this->admin_tpl('member_model_add');
     }
 }
示例#20
0
文件: function.php 项目: JZLeung/mall
function array2string($array)
{
    foreach ($array as $key => $value) {
        if (is_array($value)) {
            $data[] = "[{$key}] => " . array2string($value);
        } else {
            $data[] = "[{$key}] => " . $value;
        }
    }
    return 'Array( ' . implode($data, ",") . ' )';
}
示例#21
0
 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_W, $_GPC;
     $reid = intval($_GPC['reply_id']);
     $data = array('rid' => $rid, 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'description' => $_GPC['description'], 'background' => $_GPC['background'], 'content' => $_GPC['content'], 'share_title' => $_GPC['share_title'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt'], 'share_desc' => $_GPC['share_desc'], 'mp3' => $_GPC['mp3'], 'setting' => array2string($_GPC['setting']), 'regular' => $_GPC['regular'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']));
     if (empty($reid)) {
         pdo_insert('eso_runman_reply', $data);
     } else {
         pdo_update('eso_runman_reply', $data, array('id' => $reid));
     }
 }
示例#22
0
 /**
  * 添加队列信息
  */
 public static function add($operation, $noticedata_send)
 {
     $db = self::get_db();
     $noticedata_send['action'] = $operation;
     $noticedata_send_string = array2string($noticedata_send);
     if ($noticeid = $db->insert(array('operation' => $operation, 'noticedata' => $noticedata_send_string, 'dateline' => SYS_TIME), 1)) {
         self::notice($operation, $noticedata_send, $noticeid);
         return 1;
     } else {
         return 0;
     }
 }
示例#23
0
文件: Wx.php 项目: rainbow88/hummel
 /**
  * 配置
  */
 public function config()
 {
     if (IS_POST) {
         $data = $this->input->post('data');
         $size = file_put_contents($this->file, array2string($data));
         if (!$size) {
             $this->adminMsg('config目录无权限写入');
         }
         $this->adminMsg('保存成功', url('admin/wx/config'), 3, 1, 1);
     }
     $this->template->assign(array('data' => is_file($this->file) ? string2array(file_get_contents($this->file)) : array()));
     $this->template->display('admin/wx_config.html');
 }
示例#24
0
文件: sms.php 项目: baowzh/renfang
 public function sms_setting()
 {
     $siteid = get_siteid();
     if (isset($_POST['dosubmit'])) {
         $this->sms_setting_arr[$siteid] = $_POST['setting'];
         $setting = array2string($this->sms_setting);
         setcache('sms', $this->sms_setting_arr);
         $this->module_db->update(array('setting' => $setting), array('module' => 'sms'));
         showmessage(L('operation_success'), HTTP_REFERER);
     } else {
         $show_pc_hash = '';
         include $this->admin_tpl('sms_setting');
     }
 }
示例#25
0
 public function sp4()
 {
     if (isset($_POST['dosubmit'])) {
         $data = isset($_POST['data']) ? $_POST['data'] : '';
         $data['sp4use'] = isset($_POST['sp4use']) && intval($_POST['sp4use']) ? intval($_POST['sp4use']) : 0;
         $data['sp4_password_key'] = isset($_POST['sp4_password_key']) && $_POST[sp4_password_key] ? $_POST['sp4_password_key'] : '';
         $this->db->insert(array('name' => 'sp4', 'data' => array2string($data)), 1, 1);
         setcache('settings_sp4', $data);
         showmessage(L('operation_success'), HTTP_REFERER);
     }
     $data = array();
     $data = getcache('settings_sp4');
     include $this->admin_tpl('system_sp4');
 }
示例#26
0
文件: Sms.php 项目: rainbow88/hummel
 /**
  * 账号
  */
 public function index()
 {
     if (IS_POST) {
         $data = $this->input->post('data');
         if (strlen($data['note']) > 30) {
             $this->adminMsg('短信签名太长');
         }
         $size = file_put_contents($this->file, array2string($data));
         if (!$size) {
             $this->adminMsg('config目录无权限写入');
         }
         $this->adminMsg('保存成功', url('admin/sms/index'), 3, 1, 1);
     }
     $this->template->assign(array('data' => is_file($this->file) ? string2array(file_get_contents($this->file)) : array()));
     $this->template->display('admin/sms_index.html');
 }
 function posid($field, $value)
 {
     if (!empty($value) && is_array($value)) {
         if ($_GET['a'] == 'add') {
             $position_data_db = pc_base::load_model('position_data_model');
             $textcontent = array();
             foreach ($value as $r) {
                 if ($r != '-1') {
                     if (empty($textcontent)) {
                         foreach ($this->fields as $_key => $_value) {
                             if ($_value['isposition']) {
                                 $textcontent[$_key] = $this->data[$_key];
                             }
                         }
                         $textcontent = array2string($textcontent);
                     }
                     $thumb = $this->data['thumb'] ? 1 : 0;
                     $position_data_db->insert(array('id' => $this->id, 'catid' => $this->data['catid'], 'posid' => $r, 'thumb' => $thumb, 'module' => 'content', 'modelid' => $this->modelid, 'data' => $textcontent, 'listorder' => $this->id, 'siteid' => get_siteid()));
                 }
             }
         } else {
             $posids = array();
             $catid = $this->data['catid'];
             $push_api = pc_base::load_app_class('push_api', 'admin');
             foreach ($value as $r) {
                 if ($r != '-1') {
                     $posids[] = $r;
                 }
             }
             $textcontent = array();
             foreach ($this->fields as $_key => $_value) {
                 if ($_value['isposition']) {
                     $textcontent[$_key] = $this->data[$_key];
                 }
             }
             //颜色选择为隐藏域 在这里进行取值
             $textcontent['style'] = $_POST['style_color'] ? strip_tags($_POST['style_color']) : '';
             $textcontent['inputtime'] = strtotime($textcontent['inputtime']);
             if ($_POST['style_font_weight']) {
                 $textcontent['style'] = $textcontent['style'] . ';' . strip_tags($_POST['style_font_weight']);
             }
             $push_api->position_update($this->id, $this->modelid, $catid, $posids, $textcontent, 0);
         }
     }
 }
示例#28
0
 /**
  * 设置默认风格
  */
 public function set_default()
 {
     $style = isset($_GET['style']) && trim($_GET['style']) ? trim($_GET['style']) : showmessage(L('illegal_operation'), HTTP_REFERER);
     \Leaps\Base\Config::modify('template', array('name' => $style));
     // 模板配置
     $category_model = Loader::model('category_model');
     $result = S('common/category_content');
     // 加载栏目缓存
     if (!empty($result) && is_array($result)) {
         foreach ($result as $r) {
             $setting = string2array($r['setting']);
             $setting['template_list'] = $style;
             $setting = array2string($setting);
             $category_model->where(array('catid' => $r['catid']))->update(array('setting' => $setting));
         }
     }
     showmessage(L('operation_success'), HTTP_REFERER);
 }
示例#29
0
文件: Admin.php 项目: hubs/yuncms
 /**
  * 记录日志
  */
 private final function manage_log()
 {
     // 判断是否记录
     if (C('system', 'admin_log')) {
         $action = ACTION;
         if ($action == '' || strchr($action, 'public') || $action == 'init' || $action == 'public_current_pos' || !isset($_SESSION['userid'])) {
             return false;
         } else {
             $log = Loader::model('admin_log_model');
             $username = cookie('admin_username');
             $userid = isset($_SESSION['userid']) ? $_SESSION['userid'] : '';
             $time = date('Y-m-d H-i-s', TIME);
             $url = '?app=' . APP . '&controller=' . CONTROLLER . '&action=' . ACTION;
             $data = isset($_POST) ? array2string($_POST) : array2string($_GET);
             $log->insert(array('application' => APP, 'controller' => CONTROLLER, 'username' => $username, 'userid' => $userid, 'action' => ACTION, 'querystring' => $url, 'data' => $data, 'time' => $time, 'ip' => IP));
         }
     }
 }
示例#30
0
 public function posid($field, $value)
 {
     if (!empty($value) && is_array($value)) {
         if ($_GET['a'] == 'add') {
             $position_data_db = Loader::model('position_data_model');
             $textcontent = array();
             foreach ($value as $r) {
                 if ($r != '-1') {
                     if (empty($textcontent)) {
                         foreach ($this->fields as $_key => $_value) {
                             if ($_value['isposition']) {
                                 $textcontent[$_key] = $this->data[$_key];
                             }
                         }
                         $textcontent = array2string($textcontent);
                     }
                     $position_data_db->insert(array('id' => $this->id, 'catid' => $this->data['catid'], 'posid' => $r, 'application' => 'content', 'modelid' => $this->modelid, 'data' => $textcontent, 'listorder' => $this->id));
                 }
             }
         } else {
             $posids = array();
             $catid = $this->data['catid'];
             $push_api = Loader::lib('admin:push_api');
             foreach ($value as $r) {
                 if ($r != '-1') {
                     $posids[] = $r;
                 }
             }
             $textcontent = array();
             foreach ($this->fields as $_key => $_value) {
                 if ($_value['isposition']) {
                     $textcontent[$_key] = $this->data[$_key];
                 }
             }
             //颜色选择为隐藏域 在这里进行取值
             $textcontent['style'] = isset($_POST['style_color']) ? strip_tags($_POST['style_color']) : '';
             $textcontent['inputtime'] = strtotime($textcontent['inputtime']);
             if ($_POST['style_font_weight']) {
                 $textcontent['style'] = $textcontent['style'] . ';' . strip_tags($_POST['style_font_weight']);
             }
             $push_api->position_update($this->id, $this->modelid, $catid, $posids, $textcontent);
         }
     }
 }