本文整理汇总了PHP中dr_member_url函数的典型用法代码示例。如果您正苦于以下问题:PHP dr_member_url函数的具体用法?PHP dr_member_url怎么用?PHP dr_member_url使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dr_member_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template
/**
* 空间模板
*/
public function template()
{
$style = $this->input->get('style');
if ($style && $this->space['style'] != $style) {
$rule = dr_string2array(@file_get_contents(FCPATH . 'member/templates/' . $style . '/rule.php'));
if ($style == 'default' || isset($rule[$this->markrule])) {
$this->db->where('uid', (int) $this->uid)->update($this->db->dbprefix('space'), array('style' => $style));
$this->member_msg(lang('m-319'), dr_member_url('space/template'), 1);
} else {
$this->member_msg(lang('m-320'));
}
}
$list = array();
$data = array_diff(dr_dir_map(FCPATH . 'member/templates/', 1), array('admin', 'member'));
if ($data) {
foreach ($data as $dir) {
$tpl = array('name' => $dir, 'preview' => MEMBER_URL . 'templates/' . $dir . '/preview.jpg');
$rule = dr_string2array(@file_get_contents(FCPATH . 'member/templates/' . $dir . '/rule.php'));
if ($dir == 'default') {
$list[] = $tpl;
} elseif ($rule && isset($rule[$this->markrule])) {
$list[] = $tpl;
}
}
}
$this->template->assign(array('list' => $list, 'style' => $this->space['style'] ? $this->space['style'] : 'default'));
$this->template->display('space_template.html');
}
示例2: index
/**
* 首页
*/
public function index()
{
$uid = (int) $this->input->get('uid');
if ($uid) {
$this->_space($uid);
// 带会员uid参数时进入会员空间界面
} else {
// 登录验证
$url = MEMBER_URL . SELF . '?c=login&m=index&backurl=' . urlencode(dr_now_url());
if (!$this->uid) {
$this->member_msg(lang('m-039') . $this->member_model->logout(), $url);
}
/*
$total = array();
// 会员模块统计
$module = $this->get_module(SITE_ID);
if ($module) {
$db = $this->site[SITE_ID];
foreach ($module as $dir => $m) {
if (!$this->_module_post_catid($m)) {
continue;
}
$total['name'][] = '"'.$m['name'].'"';
$total['total'][] = $db->where('uid', $this->uid)->count_all_results(SITE_ID.'_'.$dir.'_index');
}
$total['name'] = @implode(',', $total['name']);
$total['total'] = @implode(',', $total['total']);
}
*/
// 消息提醒
$notice = array();
$new_notice = $this->db->where('uid', $this->uid)->count_all_results('member_new_notice');
if ($new_notice) {
// 统计未读短消息
if ($total = $this->db->where('uid', $this->uid)->where('isnew', 1)->count_all_results('pm_members')) {
$notice[] = array('name' => '短消息', 'url' => dr_member_url('pm/index'), 'total' => $total);
}
// 统计未读系统提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 1)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '系统提醒', 'url' => dr_member_url('notice/index'), 'total' => $total);
}
// 统计未读会员提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 2)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '会员互动', 'url' => dr_member_url('notice/member'), 'total' => $total);
}
// 统计未读模块提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 3)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '模块提醒', 'url' => dr_member_url('notice/module'), 'total' => $total);
}
// 统计未读应用提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 4)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '应用提醒', 'url' => dr_member_url('notice/app'), 'total' => $total);
}
}
$this->template->assign(array('notice' => $notice, 'loginlog' => array_reverse(dr_string2array($this->member['loginlog'])), 'meta_name' => lang('m-012'), 'invite_url' => MEMBER_URL . 'index.php?c=register&uid=' . $this->uid . '&invite=' . $this->member['username'], 'new_notice' => $new_notice));
$this->template->display(IS_AJAX ? 'main.html' : 'index.html');
}
}
示例3: go
/**
* 提醒跳转
*/
public function go()
{
$data = $this->db->select('type')->where('uid', (int) $this->uid)->where('isnew', 1)->get('member_notice_' . $this->member['tableid'])->row_array();
if (!$data) {
redirect(dr_member_url('notice/index'), 'refresh');
} elseif ($data['type'] == 1) {
redirect(dr_member_url('notice/index'), 'refresh');
} elseif ($data['type'] == 2) {
redirect(dr_member_url('notice/member'), 'refresh');
} elseif ($data['type'] == 3) {
redirect(dr_member_url('notice/module'), 'refresh');
} elseif ($data['type'] == 4) {
redirect(dr_member_url('notice/app'), 'refresh');
} else {
redirect(dr_member_url('notice/index'), 'refresh');
}
}
示例4: verify
/**
* 审核会员
*/
public function verify()
{
if (!isset($_SERVER['HTTP_USER_AGENT']) || strlen($_SERVER['HTTP_USER_AGENT']) < 20) {
$this->member_msg('认证失败');
}
$data = $this->member_model->get_decode($this->input->get('code'));
if (!$data) {
$this->member_msg(lang('m-190'));
}
list($time, $uid, $code) = explode(',', $data);
if (!$this->db->where('uid', $uid)->where('randcode', $code)->count_all_results('member')) {
$this->member_msg(lang('m-193'));
}
$this->db->where('uid', $uid)->where('groupid<>', 3)->update('member', array('randcode' => 0, 'groupid' => 3));
$this->member_msg(lang('m-194'), dr_member_url('login/index'), 1);
}
示例5: dr_sns_feed_url
/**
* 会员动态内容URL地址
*
* @param intval $id
* @return string
*/
function dr_sns_feed_url($id)
{
return dr_member_url('sns/feed', array('id' => $id));
}
示例6: edit
/**
* 修改
*/
public function edit()
{
// 初始化参数
$id = (int) $this->input->get('id');
$did = (int) $this->input->get('did');
$cid = (int) $this->input->get('catid');
$data = $this->content_model->get($id);
$error = array();
$catid = $cid ? $cid : $data['catid'];
// 数据是否存在
if (!$data) {
$this->member_msg(lang('019'));
}
// 禁止修改他人文档
if ($data['author'] != $this->member['username'] && $data['uid'] != $this->member['uid']) {
$this->member_msg(lang('mod-05'));
}
// 修改权限判断
if (!$this->module_rule[$catid]['edit']) {
$this->member_msg(lang('mod-20'));
}
// 可用字段
$field = $this->_get_member_field($catid);
$isedit = (int) $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid, 'setting', 'edit');
// 保存修数据
if (IS_POST) {
$_data = $data;
// 字段验证与过滤
$catid = $isedit ? $catid : (int) $this->input->post('catid');
// 修改权限判断
if (!$this->module_rule[$catid]['edit']) {
$this->member_msg(lang('mod-20'));
}
$cat = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid);
$field = $cat['field'] ? array_merge($field, $cat['field']) : $field;
// 设置uid便于校验处理
$_POST['data']['id'] = $id;
$_POST['data']['uid'] = $this->uid;
$_POST['data']['author'] = $this->member['username'];
$_POST['data']['inputtime'] = $data['inputtime'];
$_POST['data']['updatetime'] = SYS_TIME;
$data = $this->validate_filter($field, $_data);
if (isset($data['error'])) {
$error = $data;
$data = $this->input->post('data', TRUE);
} elseif (!$isedit && !$catid) {
$data = $this->input->post('data', TRUE);
$error = array('error' => 'catid', 'msg' => lang('cat-22'));
} else {
// 初始化数据
$status = isset($data['status']) && $data['status'] ? 9 : ($this->module_rule[$catid]['verify'] ? 1 : 9);
$status = isset($this->module_rule[$catid]['edit_verify']) && $this->module_rule[$catid]['edit_verify'] ? 9 : $status;
$data[1]['uid'] = $this->uid;
$data[1]['author'] = $this->member['username'];
$data[1]['catid'] = $catid;
$data[1]['status'] = $status;
$data[1]['updatetime'] = SYS_TIME;
// 保存为草稿
if ($this->input->post('action') == 'draft') {
$data[1]['id'] = $data[0]['id'] = $id;
$id = $this->content_model->save_draft($did, $data, 0);
$this->attachment_handle($this->uid, $this->content_model->prefix . '_draft-' . $id, $field);
if (IS_AJAX) {
exit(dr_json(0, lang('m-229'), dr_url(APP_DIR . '/home/draft/')));
}
$this->admin_msg(lang('m-229'), dr_url(APP_DIR . '/home/draft/'), 1);
exit;
}
// 修改数据
if ($this->content_model->edit($_data, $data)) {
// 发布草稿时删除草稿数据
if ($did && $this->content_model->delete_draft($did, 'cid=' . $id . ' and eid=0')) {
$this->attachment_replace_draft($did, $id, 0, $this->content_model->prefix, $data[1]['status']);
}
$this->attachment_handle($this->uid, $this->content_model->prefix . '-' . $id, $field, $_data, $data[1]['status'] == 9 ? TRUE : FALSE);
if ($data[1]['status'] == 9) {
// 审核通过
if (IS_AJAX) {
exit(dr_json(1, lang('m-340'), dr_member_url(APP_DIR . '/home/index')));
}
$this->template->assign(array('url' => SITE_URL . APP_DIR . '/index.php?c=show&id=' . $id, 'add' => dr_member_url(APP_DIR . '/home/add', array('catid' => $catid)), 'edit' => 1, 'list' => dr_member_url(APP_DIR . '/home/index'), 'html' => MODULE_HTML ? dr_module_create_show_file($id) . dr_module_create_list_file($catid) : '', 'catid' => $catid, 'meta_name' => lang('mod-03')));
$this->template->display('success.html');
} else {
if (IS_AJAX) {
exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/verify/index')));
}
$this->template->assign(array('url' => dr_member_url(APP_DIR . '/verify/index'), 'add' => dr_member_url(APP_DIR . '/home/add', array('catid' => $catid)), 'edit' => 1, 'list' => dr_member_url(APP_DIR . '/home/index'), 'catid' => $catid, 'meta_name' => lang('mod-03')));
$this->template->display('verify.html');
}
} else {
$this->member_msg(lang('mod-06'));
}
exit;
}
if (IS_AJAX) {
exit(dr_json(0, $error['msg'], $error['error']));
}
//.........这里部分代码省略.........
示例7: _add
protected function _add($data)
{
// 入库
$table = $this->db->dbprefix($this->table);
$data[1]['tableid'] = 0;
$this->link->insert($table, $data[1]);
//
if (($id = $this->link->insert_id()) && ($user = dr_member_info($this->cdata['uid']))) {
// 无限分表
$tableid = floor($id / 50000);
$this->link->where('id', $id)->update($table, array('tableid' => $tableid));
if (!$this->link->query("SHOW TABLES LIKE '" . $table . '_data_' . $tableid . "'")->row_array()) {
// 附表不存在时创建附表
$sql = $this->link->query("SHOW CREATE TABLE `" . $table . "_data_0`")->row_array();
$this->link->query(str_replace(array($sql['Table'], 'CREATE TABLE '), array($table . '_data_' . $tableid, 'CREATE TABLE IF NOT EXISTS '), $sql['Create Table']));
}
$data[0]['id'] = $id;
$data[0]['cid'] = $data[1]['cid'];
$data[0]['uid'] = $data[1]['uid'];
$this->db->replace($table . '_data_' . $tableid, $data[0]);
// 通知功能
$murl = dr_member_url(APP_DIR . '/' . $this->router->class . '/listc', array('cid' => $this->cdata['id']));
$title = dr_lang('mod-106', $this->cdata['title'], $this->form['name']);
// 邮件提醒
if ($this->form['setting']['email']) {
$this->sendmail_queue($user['email'], $title, dr_lang('mod-107', $this->cdata['title'], $this->form['name'], $murl, $murl));
}
// 短信提醒
if ($this->form['setting']['sms'] && $user['phone']) {
$this->member_model->sendsms($user['phone'], $title);
}
// 添加提醒
$this->member_model->add_notice($this->cdata['uid'], 3, '<a href="' . $murl . '">' . $title . '</a>');
// 更新模块表的统计值
$this->link->where('id', $this->cid)->set($this->fid . '_total', $this->fid . '_total + 1', FALSE)->update(SITE_ID . '_' . APP_DIR);
}
return $id;
}
示例8: space_content_edit
/**
* 修改空间模型内容
*/
protected function space_content_edit()
{
$this->_is_space();
$id = (int) $this->input->get('id');
$mid = (int) str_replace('space', '', $this->router->class);
$model = $this->get_cache('space-model', $mid);
if (!$model) {
$this->member_msg(lang('m-290'));
}
if (!$model['setting'][$this->markrule]['use']) {
$this->member_msg(lang('m-307'));
}
$this->load->model('space_category_model');
$this->load->model('space_content_model');
$category = $this->space_category_model->get_data($mid);
$this->space_content_model->tablename = $this->db->dbprefix('space_' . $model['table']);
$data = $this->space_content_model->get($this->uid, $id);
if (!$data) {
$this->member_msg(lang('m-303'));
}
if (IS_POST) {
// 栏目参数
$catid = (int) $this->input->post('catid');
// 设置uid便于校验处理
$_POST['data']['updatetime'] = SYS_TIME;
$post = $this->validate_filter($model['field']);
// 验证出错信息
if (isset($post['error'])) {
$error = $post;
$data = $this->input->post('data', TRUE);
} elseif (!$catid) {
$data = $this->input->post('data', TRUE);
$error = array('error' => 'catid', 'msg' => lang('m-300'));
} elseif ($category[$catid]['child'] || $category[$catid]['modelid'] != $mid) {
$data = $this->input->post('data', TRUE);
$error = array('error' => 'catid', 'msg' => lang('m-301'));
} else {
// 设定文档默认值
$post[1]['catid'] = $catid;
$post[1]['status'] = (int) $model['setting'][$this->markrule]['verify'] ? 0 : 1;
$post[1]['updatetime'] = SYS_TIME;
// 修改文档
if (($id = $this->space_content_model->edit($id, $data['uid'], $post[1])) != FALSE) {
$this->attachment_handle($this->uid, $this->space_content_model->tablename . '-' . $id, $model['field'], $data, $post[1]['status'] ? TRUE : FALSE);
$this->member_msg(lang('000'), dr_member_url($this->router->class . '/index'), 1);
}
}
if (IS_AJAX) {
exit(dr_json(0, $error['msg'], $error['error']));
}
$data = $data[1];
unset($data['id']);
}
$this->template->assign(array('purl' => dr_url($this->router->class . '/edit', array('id' => $id)), 'error' => $error, 'verify' => 0, 'select' => $this->select_space_category($category, (int) $data['catid'], 'name=\'catid\'', NULL, 1), 'listurl' => dr_url($this->router->class . '/index'), 'myfield' => $this->field_input($model['field'], $data, TRUE), 'meta_name' => lang('m-299'), 'model_name' => $model['name'], 'result_error' => $error));
$this->template->display(is_file(FCPATH . 'member/templates/' . MEMBER_TEMPLATE . '/space_' . $model['table'] . '_add.html') ? 'space_' . $model['table'] . '_add.html' : 'space_content_add.html');
}
示例9: file
/**
* 下载文件
*/
public function file()
{
$id = (int) $this->input->get('id');
$info = get_attachment($id);
$this->template->admin();
if (!$info) {
$this->admin_msg(lang('m-326'));
}
// 是否允许下载附件
if (!$this->uid && !$this->member_rule['is_download']) {
$this->msg(lang('m-217'), dr_member_url('login/index'), 0, 3);
} elseif (!$this->member['adminid'] && !$this->member_rule['is_download']) {
$this->msg(lang('m-322', $this->member['groupname']), dr_member_url('login/index'), 0, 3);
}
// 虚拟币与经验值检查
$mark = 'attachment-' . $id;
$table = $this->db->dbprefix('member_scorelog_' . (int) substr((string) $this->uid, -1, 1));
if ($this->member_rule['download_score'] && !$this->db->where('type', 1)->where('mark', $mark)->count_all_results($table)) {
// 虚拟币不足时,提示错误
if ($this->member_rule['download_score'] + $this->member['score'] < 0) {
$this->admin_msg(dr_lang('m-324', SITE_SCORE, abs($this->member_rule['download_score'])));
}
// 虚拟币扣减
$this->member_model->update_score(1, $this->uid, (int) $this->member_rule['download_score'], $mark, "lang,m-325");
}
if ($this->member_rule['download_experience'] && !$this->db->where('type', 0)->where('mark', $mark)->count_all_results($table)) {
// 经验值扣减
$this->member_model->update_score(0, $this->uid, (int) $this->member_rule['download_experience'], $mark, "lang,m-325");
}
$file = $info['attachment'];
$this->db->where('id', $id)->set('download', 'download+1', FALSE)->update('attachment');
if (strpos($file, ':/')) {
//远程文件
header("Location: {$file}");
} else {
//本地文件
$file = SYS_UPLOAD_PATH . '/' . str_replace('..', '', $file);
$file = str_replace('member/uploadfile/member/uploadfile', 'member/uploadfile', $file);
$name = urlencode($info['filename'] . '.' . $info['fileext']);
$this->load->helper('download');
force_download($name, file_get_contents($file));
}
}
示例10: card
/**
* 卡密充值
*/
public function card()
{
if (IS_POST) {
$card = $this->input->post('card', TRUE);
$password = (int) $this->input->post('password');
if ($card && $password) {
$data = $this->db->where('card', $card)->where('password', $password)->limit(1)->get('member_paycard')->row_array();
if (!$data) {
$error = lang('m-171');
} elseif ($data['endtime'] < SYS_TIME) {
$error = lang('m-169');
} elseif ($data['uid']) {
$error = lang('m-170');
} else {
if ($money = $this->pay_model->add_for_card($data['id'], $data['money'], $card)) {
$this->member_msg(dr_lang('m-172', $data['money']), dr_member_url('pay/index'), 1);
}
$error = lang('m-172');
}
} else {
$error = lang('m-168');
}
}
$this->template->assign(array('card' => $card, 'result_error' => $error));
$this->template->display('pay_card.html');
}
示例11: edit
/**
* 修改审核
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->content_model->get_extend_verify($id);
$error = array();
if (!$data) {
$this->member_msg(lang('019'));
}
// 禁止修改他人文档
if ($data['author'] != $this->member['username'] && $data['uid'] != $this->member['uid']) {
$this->member_msg(lang('mod-05'));
}
$field = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'extend');
if (IS_POST) {
$_data = $data;
// 设置uid便于校验处理
$_POST['data']['id'] = $id;
$_POST['data']['uid'] = $this->uid;
$_POST['data']['author'] = $this->member['username'];
$data = $this->validate_filter($field, $_data);
if (isset($data['error'])) {
$error = $data;
$data = $this->input->post('data', TRUE);
} else {
$this->content = $this->content_model->get($_data['cid']);
$data[1]['cid'] = (int) $this->content['id'];
$data[1]['uid'] = $this->member['uid'];
$data[1]['catid'] = (int) $this->content['catid'];
$data[1]['status'] = 1;
$data[1]['author'] = $this->member['username'];
if (isset($data[1]['mytype'])) {
$data[1]['mytype'] = $_data['mytype'];
}
// 修改数据
if ($this->content_model->edit_extend($_data, $data)) {
$this->attachment_handle($this->uid, $this->content_model->prefix . '_verify-' . $_data['cid'] . '-' . $id, $field);
if (IS_AJAX) {
exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/everify/index')));
}
$this->template->assign(array('url' => dr_member_url(APP_DIR . '/everify/index'), 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $_data['cid'])), 'edit' => 1, 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $_data['cid'])), 'meta_name' => lang('mod-03')));
$this->template->display('verify.html');
} else {
$this->member_msg(lang('mod-06'));
}
exit;
}
}
$backurl = str_replace(MEMBER_URL, '', $_SERVER['HTTP_REFERER']);
$this->template->assign(array('purl' => dr_url(APP_DIR . '/everify/edit', array('id' => $id)), 'data' => $data, 'myfield' => $this->field_input($field, $data, TRUE), 'backurl' => $backurl ? $backurl : dr_url(APP_DIR . '/everify/index'), 'listurl' => $backurl ? $backurl : dr_url(APP_DIR . '/everify/index'), 'meta_name' => lang('mod-41'), 'result_error' => $error));
$this->template->display('everify_edit.html');
}
示例12: _add
protected function _add($data)
{
// 入库
$this->link->insert($this->table, $data);
if (($id = $this->link->insert_id()) && ($user = dr_member_info($this->cdata['uid']))) {
$murl = dr_member_url(APP_DIR . '/' . $this->router->class . '/listc', array('cid' => $this->cdata['id']));
$title = dr_lang('mod-106', $this->cdata['title'], $this->form['name']);
// 邮件提醒
if ($this->form['setting']['email']) {
$this->sendmail_queue($user['email'], $title, dr_lang('mod-107', $this->cdata['title'], $this->form['name'], $murl, $murl));
}
// 短信提醒
if ($this->form['setting']['sms'] && $user['phone']) {
$this->member_model->sendsms($user['phone'], $title);
}
// 添加提醒
$this->member_model->add_notice($this->cdata['uid'], 3, '<a href="' . $murl . '">' . $title . '</a>');
}
return $id;
}
示例13: _space
/**
* 会员空间页
*/
private function _space($uid, $is_domain = 0)
{
if (!MEMBER_OPEN_SPACE) {
$this->member_msg(lang('m-111'));
}
define('IS_SPACE', $uid);
$this->load->model('space_model');
$this->load->model('space_category_model');
$space = $this->space_model->get($uid);
if (!$space) {
$this->template->assign('theme', MEMBER_PATH . 'templates/space/default/');
$this->member_msg(lang('m-234'));
}
if (!$space['status']) {
$this->member_msg(lang('m-235'));
}
// 判断是否是自定义域名
if (!$is_domain && $this->_space_show($uid)) {
redirect(dr_member_url('api/access', array('uid' => $uid)), 'refresh');
exit;
}
// 格式化空间信息
$space = $this->field_format_value($this->get_cache('member', 'spacefield'), $space, 1);
$style = $space['style'] ? $space['style'] : 'default';
$theme = MEMBER_URL . 'templates/space/' . $style . '/';
$member = $this->member_model->get_member($uid);
// 会员组使用权限判断
if (!$member['allowspace']) {
$this->member_msg(lang('m-364'));
}
$action = str_replace(array('\\', '/', '..', '<', '>'), '', $this->input->get('action', TRUE));
$selected = 0;
// 默认选中首页菜单
$category = $this->space_category_model->get_data(0, $uid, 1);
switch ($action) {
case 'category':
// 栏目处理
$id = (int) $this->input->get('id');
$cat = $category[$id];
if (!$cat) {
$this->msg(lang('m-315'));
}
switch ($cat['type']) {
case 0:
// 外链
if (!$cat['link']) {
$this->msg(lang('m-316'));
}
redirect($cat['link'], 'location', 301);
return NULL;
break;
case 1:
// 模型
$model = $this->get_cache('space-model', $cat['modelid']);
if (!$model) {
$this->msg(lang('m-317'));
}
$template = 'list_' . $model['table'] . '.html';
// 选中顶级栏目
$temp = explode(',', $cat['pids']);
$selected = $temp[1] ? $temp[1] : $id;
break;
case 2:
// 单页
$template = 'page.html';
// 选中顶级栏目
$temp = explode(',', $cat['pids']);
$selected = $temp[1] ? $temp[1] : $id;
// 单页验证是否存在子栏目
if ($cat['child']) {
$temp = explode(',', $cat['childids']);
if (isset($temp[1]) && $category[$temp[1]]) {
$id = $temp[1];
$cat = $category[$id];
}
}
break;
}
// 栏目下级或者同级栏目
$related = $parent = array();
if ($cat['pid']) {
foreach ($category as $t) {
if ($t['pid'] == $cat['pid']) {
$related[] = $t;
if ($cat['child']) {
$parent = $cat;
} else {
$parent = $category[$t['pid']];
}
}
}
} elseif ($cat['child']) {
$parent = $cat;
foreach ($category as $t) {
if ($t['pid'] == $cat['id']) {
$related[] = $t;
}
//.........这里部分代码省略.........
示例14: edit
/**
* 修改
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->space_category_model->get($id);
if (!$data) {
$this->member_msg(lang('019'));
}
$is_edit = $this->get_cache('member', 'setting', 'space', 'category') ? 0 : 1;
if (IS_POST) {
$post = $this->input->post('data', TRUE);
$post['pid'] = $is_edit ? $post['pid'] : $data['pid'];
$post['type'] = $data['type'];
$post['modelid'] = $data['modelid'];
$result = $this->space_category_model->edit($id, $post);
if ($result === TRUE) {
$this->member_msg(lang('000'), dr_member_url('category/index'), 1);
}
$post['id'] = $id;
$data = $post;
} else {
$result = '';
}
$this->template->assign(array('data' => $data, 'result' => $result, 'method' => $this->router->method, 'is_edit' => $is_edit));
$this->template->display('category_add.html');
}
示例15: edit
/**
* 修改
*/
public function edit()
{
if (!$this->catrule['edit']) {
$this->member_msg(lang('160'));
}
$id = (int) $this->input->get('id');
$data = $this->content_model->get_extend($id);
if (!$data) {
$this->member_msg(lang('019'));
}
$error = array();
$result = '';
if (IS_POST) {
$_data = $data;
$type = (int) $this->input->post('type');
$_POST['data']['cid'] = $this->content['id'];
$_POST['data']['uid'] = $this->content['uid'];
$data = $this->validate_filter($this->field, $_data);
if (isset($data['error'])) {
$error = $data;
$data = $this->input->post('data', TRUE);
} else {
$status = isset($data['status']) && $data['status'] ? 9 : ($this->module_rule[$this->content['catid']]['verify'] ? 1 : 9);
$status = isset($this->module_rule[$this->content['catid']]['edit_verify']) && $this->module_rule[$this->content['catid']]['edit_verify'] ? 9 : $status;
$data[1]['cid'] = $this->content['id'];
$data[1]['uid'] = $this->content['uid'];
$data[1]['catid'] = $this->content['catid'];
$data[1]['status'] = $status;
$data[1]['author'] = $this->content['author'];
if ($id = $this->content_model->edit_extend($_data, $data)) {
if ($data[1]['status'] == 9) {
$mark = $this->content_model->prefix . '-' . $this->content['id'] . '-' . $id;
// 操作成功处理附件
$this->attachment_handle($this->content['uid'], $mark, $this->field, $_data);
if (IS_AJAX) {
exit(dr_json(1, lang('m-340'), dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id']))));
}
$this->template->assign(array('url' => SITE_URL . APP_DIR . '/index.php?c=extend&id=' . $id, 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 1, 'html' => MODULE_HTML ? dr_module_create_show_file($this->content['id']) . dr_module_create_list_file($this->content['catid']) : '', 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
$this->template->display('success.html');
} else {
$this->attachment_handle($this->uid, $this->content_model->prefix . '_verify-' . $this->content['id'] . '-' . $id, $field);
if (IS_AJAX) {
exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/everify/index')));
}
$this->template->assign(array('url' => dr_member_url(APP_DIR . '/everify/index'), 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 0, 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
$this->template->display('verify.html');
}
exit;
} else {
$error = array('error' => $id);
}
}
}
$this->template->assign(array('data' => $data, 'error' => $error, 'result' => $result, 'myfield' => $this->field_input($this->field, $data, TRUE), 'result_error' => $error));
$this->template->display('content_extend_add.html');
}