本文整理汇总了PHP中dr_array2string函数的典型用法代码示例。如果您正苦于以下问题:PHP dr_array2string函数的具体用法?PHP dr_array2string怎么用?PHP dr_array2string使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dr_array2string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* 修改
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->db->where('id', $id)->get('module_form')->row_array();
if (!$data) {
$this->admin_msg(lang('019'));
}
if (IS_POST) {
$this->system_log('修改模块【' . $this->dir . '】表单【' . $data['table'] . '】');
// 记录日志
$post = $this->input->post('data');
$this->db->where('id', $id)->update('module_form', array('name' => $post['name'], 'setting' => dr_array2string($post['setting']), 'permission' => dr_array2string($post['permission'])));
if ($m = $this->db->where('mark', 'module-' . $this->dir . '-' . $id)->get('admin_menu')->row_array()) {
$this->db->where('id', $m['id'])->update('admin_menu', array('uri' => $this->dir . '/admin/form_' . $data['table'] . '/index', 'name' => $post['name'] . '管理'));
} else {
$menu = $this->db->where('pid<>0')->where('uri', '')->where('mark', 'module-' . $this->dir)->order_by('displayorder ASC,id ASC')->get('admin_menu')->row_array();
if ($menu) {
// 将此表单放在模块菜单中
$this->db->insert('admin_menu', array('uri' => $this->dir . '/admin/form_' . $data['table'] . '/index', 'url' => '', 'pid' => $menu['id'], 'name' => $post['name'] . '管理', 'mark' => 'module-' . $this->dir . '-' . $id, 'hidden' => 0, 'displayorder' => 0));
}
}
$this->clear_cache('module');
$this->admin_msg(lang('000'), dr_url('mform/index', array('dir' => $this->dir)), 1);
}
$data['setting'] = dr_string2array($data['setting']);
$data['permission'] = dr_string2array($data['permission']);
$this->template->assign(array('data' => $data));
$this->template->display('mform_add.html');
}
示例2: edit_site
/**
* 修改站点
*
* @return void
*/
public function edit_site($id, $data)
{
if (!$data || !$id) {
return NULL;
}
$this->db->where('id', $id)->update('site', array('name' => $data['name'], 'domain' => $data['domain'], 'setting' => dr_array2string($data['setting'])));
}
示例3: insert_value
/**
* 字段入库值
*/
public function insert_value($field)
{
$data = $this->ci->post[$field['fieldname']];
if (!$data['use']) {
$data = array();
}
$this->ci->data[$field['ismain']][$field['fieldname']] = dr_array2string($data);
}
示例4: add
/**
* 添加表单
*
* @param array $data
* @return string|TRUE
*/
public function add($dir, $data)
{
if (!$data['name'] || !$data['table']) {
return lang('332');
}
// 判断表名称是否存在
if ($this->db->where('module', $dir)->where('table', $data['table'])->count_all_results('module_form')) {
return lang('333');
}
// 插入表单数据
$this->db->insert('module_form', array('name' => $data['name'], 'table' => $data['table'], 'module' => $dir, 'setting' => dr_array2string($data['setting']), 'disabled' => 0, 'permission' => dr_array2string($data['permission'])));
// 执行成功的操作
if ($id = $this->db->insert_id()) {
// 表单控制器名称
$name = 'Form_' . $data['table'];
// 管理控制器
$file = FCPATH . $dir . '/controllers/admin/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'dayrui/core/D_Admin_Form.php\';' . PHP_EOL . PHP_EOL . 'class ' . $name . ' extends D_Admin_Form {' . PHP_EOL . PHP_EOL . ' public function __construct() {' . PHP_EOL . ' parent::__construct();' . PHP_EOL . ' }' . PHP_EOL . '}')) {
$this->db->where('id', $id)->delete('module_form');
return dr_lang('243', FCPATH . $dir . '/controllers/admin/');
}
// 会员控制器
$file = FCPATH . $dir . '/controllers/member/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'dayrui/core/D_Member_Form.php\';' . PHP_EOL . PHP_EOL . 'class ' . $name . ' extends D_Member_Form {' . PHP_EOL . PHP_EOL . ' public function __construct() {' . PHP_EOL . ' parent::__construct();' . PHP_EOL . ' }' . PHP_EOL . '}')) {
$this->db->where('id', $id)->delete('module_form');
return dr_lang('243', FCPATH . $dir . '/controllers/member/');
}
// 前端发布控制器
$file = FCPATH . $dir . '/controllers/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'dayrui/core/D_Home_Form.php\';' . PHP_EOL . PHP_EOL . 'class ' . $name . ' extends D_Home_Form {' . PHP_EOL . PHP_EOL . ' public function __construct() {' . PHP_EOL . ' parent::__construct();' . PHP_EOL . ' }' . PHP_EOL . '}')) {
$this->db->where('id', $id)->delete('module_form');
return dr_lang('243', APPPATH . 'controllers/');
}
// 按站点更新模块表数据
$sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `{tablename}` (\n\t\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t `cid` int(10) unsigned NOT NULL COMMENT '内容id',\n\t\t\t `uid` mediumint(8) unsigned NOT NULL COMMENT '作者id',\n\t\t\t `author` varchar(50) NOT NULL COMMENT '作者名称',\n\t\t\t `inputip` varchar(30) DEFAULT NULL COMMENT '录入者ip',\n\t\t\t `inputtime` int(10) unsigned NOT NULL COMMENT '录入时间',\n\t\t\t `title` varchar(255) DEFAULT NULL COMMENT '内容主题',\n\t\t\t `url` varchar(255) DEFAULT NULL COMMENT '内容地址',\n\t\t\t `subject` varchar(255) DEFAULT NULL COMMENT '表单主题',\n\t\t\t PRIMARY KEY `id` (`id`),\n\t\t\t KEY `cid` (`cid`),\n\t\t\t KEY `uid` (`uid`),\n\t\t\t KEY `author` (`author`),\n\t\t\t KEY `inputtime` (`inputtime`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='" . $data['name'] . "表单数据表';";
// 获取所有站点的模块
$module = $this->ci->get_cache('module');
foreach ($module as $sid => $mod) {
// 更新站点模块
if (!in_array($dir, $mod)) {
continue;
}
// 主表名称
$table = $this->db->dbprefix($sid . '_' . $dir . '_form_' . $data['table']);
$this->site[$sid]->query("DROP TABLE IF EXISTS `" . $table . "`");
$this->site[$sid]->query(str_replace('{tablename}', $table, $sql));
}
// 字段入库
$this->db->insert('field', array('name' => '主题', 'fieldname' => 'subject', 'fieldtype' => 'Text', 'relatedid' => $id, 'relatedname' => 'mform-' . $this->dir, 'isedit' => 1, 'ismain' => 1, 'ismember' => 1, 'issystem' => 1, 'issearch' => 1, 'disabled' => 0, 'setting' => dr_array2string(array('option' => array('width' => 300, 'fieldtype' => 'VARCHAR', 'fieldlength' => '255'), 'validate' => array('xss' => 1, 'required' => 1))), 'displayorder' => 0));
// 查询后台模块的菜单
$menu = $this->db->where('pid<>0')->where('uri', '')->where('mark', 'module-' . $dir)->order_by('displayorder ASC,id ASC')->get('admin_menu')->row_array();
if ($menu) {
// 将此表单放在模块菜单中
$this->db->insert('admin_menu', array('uri' => $this->dir . '/admin/' . strtolower($name) . '/index', 'url' => '', 'pid' => $menu['id'], 'name' => $data['name'] . '管理', 'mark' => 'module-' . $dir . '-' . $id, 'hidden' => 0, 'displayorder' => 0));
}
}
return FALSE;
}
示例5: insert_value
/**
* 字段入库值
*/
public function insert_value($field)
{
$value = $this->ci->post[$field['fieldname']];
if ((double) $value['price'] > 0) {
$this->ci->data[$field['ismain']][$field['fieldname']] = dr_array2string($value);
} else {
$this->ci->data[$field['ismain']][$field['fieldname']] = 0;
}
}
示例6: insert_value
/**
* 字段入库值
*/
public function insert_value($field)
{
$data = $this->ci->post[$field['fieldname']];
$value = array();
if ($data) {
foreach ($data as $t) {
$value[$t['id']] = array('name' => $t['name'], 'content' => $t['content']);
}
}
$this->ci->data[$field['ismain']][$field['fieldname']] = dr_array2string($value);
}
示例7: config
/**
* 配置存/取
*
* @param intval $name name值
* @param array $data 修改数据
* @return array
*/
private function config($name, $data = NULL)
{
$table = SITE_ID . '_' . APP_DIR . '_config';
$config = $this->link->where('name', $name)->limit(1)->get($table)->row_array();
$config = dr_string2array($config['value']);
if ($data) {
// 修改数据
$config = $data;
$this->link->replace($table, array('name' => $name, 'value' => dr_array2string($data)));
}
return $config;
}
示例8: insert_value
/**
* 字段入库值
*/
public function insert_value($field)
{
$data = $this->ci->post[$field['fieldname']];
if ($data['use']) {
foreach ($data as $i => $t) {
$data[$i] = abs(intval($t));
}
} else {
$data = '';
}
$this->ci->data[$field['ismain']][$field['fieldname']] = dr_array2string($data);
}
示例9: permission
/**
* 会员权限划分
*/
public function permission()
{
$dir = trim(str_replace('.', '', $this->input->get('dir')), '/');
$file = $this->path . $dir . '/rule.php';
if (IS_POST) {
file_put_contents($file, dr_array2string($this->input->post('data')));
echo dr_json(1, lang('000'));
exit;
}
$this->template->assign('data', is_file($file) ? dr_string2array(file_get_contents($file)) : array());
$this->template->assign('space', $dir);
$this->template->display('space_permission.html');
}
示例10: edit
/**
* 修改
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->db->where('id', $id)->limit(1)->get('urlrule')->row_array();
if (!$data) {
$this->admin_msg(lang('019'));
}
if (IS_POST) {
$this->db->where('id', $id)->update('urlrule', array('name' => $this->input->post('name'), 'value' => dr_array2string($this->input->post('data'))));
$this->cache(1);
$this->admin_msg(lang('000'), dr_url('urlrule/index'), 1);
}
$data['value'] = dr_string2array($data['value']);
$this->template->assign(array('data' => $data));
$this->template->display('urlrule_add.html');
}
示例11: edit
/**
* 修改
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->link->where('id', $id)->limit(1)->get($this->table)->row_array();
if (!$data) {
$this->admin_msg(lang('019'));
}
if (IS_POST) {
$data = $this->input->post('data', TRUE);
$this->link->where('id', $id)->update($this->table, array('name' => $data['name'], 'setting' => dr_array2string($data['setting']), 'permission' => dr_array2string($data['permission'])));
$this->admin_msg(lang('000'), dr_url('mform/index', array('dir' => $this->dir)), 1);
}
$data['setting'] = dr_string2array($data['setting']);
$data['permission'] = dr_string2array($data['permission']);
$this->template->assign(array('data' => $data));
$this->template->display('mform_add.html');
}
示例12: move
/**
* 网站搬家
*/
public function move()
{
if (IS_POST) {
$p = (int) $this->input->post('todo');
if ($p) {
$this->load->database();
$this->load->model('site_model');
$this->load->library('dconfig');
$data = $this->input->post('site');
$site = $this->db->get('site')->result_array();
foreach ($site as $t) {
$domain = $data[$t['id']];
$setting = dr_string2array($t['setting']);
$setting['SITE_DOMAIN'] = $domain;
$this->db->where('id', $t['id'])->update('site', array('domain' => $domain, 'setting' => dr_array2string($setting)));
$this->dconfig->file(FCPATH . 'config/site/' . $t['id'] . '.php')->note('站点配置文件')->space(32)->to_require_one($this->site_model->config, $setting);
// 更新导航数据
$this->db->query('update ' . $this->db->dbprefix($t['id'] . '_navigator') . ' set url=REPLACE(url, "http://' . $t['domain'] . '", "http://' . $domain . '")');
}
$this->admin_msg('配置成功,请登录后台再更新全站缓存。<br>还需要把各个模块的内容地址更新一下!', '', 1);
} else {
$ok = 0;
$site = array();
require FCPATH . 'config/database.php';
if (!@mysql_connect($db['default']['hostname'] . ':' . $db['default']['port'], $db['default']['username'], $db['default']['password'])) {
$ok = '无法连接到数据库服务器,请检查用户名和密码是否正确';
}
if (!@mysql_select_db($db['default']['database'])) {
$ok = '指定的数据库(' . $db['default']['database'] . ')不存在,系统尝试创建失败,请通过其他方式建立数据库';
}
if ($ok == 0) {
$this->load->database();
$data = $this->db->get('site')->result_array();
foreach ($data as $t) {
$site[$t['id']] = array('id' => $t['id'], 'name' => $t['name'], 'domain' => $t['domain'], 'setting' => dr_string2array($t['setting']));
}
}
$this->template->assign(array('ok' => $ok, 'site' => $site, 'back' => $_SERVER['HTTP_REFERER']));
$this->template->display('move_2.html');
}
} else {
$this->template->display('move_1.html');
}
}
示例13: insert_value
/**
* 字段入库值
*/
public function insert_value($field)
{
$data = $this->ci->post[$field['fieldname']];
if ($data['use']) {
$zk = 0;
foreach ($data as $i => $t) {
if (strpos($i, '_') !== FALSE && $t) {
$zk = 1;
break;
}
}
if (!$zk || !$data['star'] || !$data['end']) {
$data = NULL;
}
} else {
$data = NULL;
}
$this->ci->data[$field['ismain']][$field['fieldname']] = dr_array2string($data);
}
示例14: add
/**
* 添加模型
*
* @param array $data
* @return string|TRUE
*/
public function add($data)
{
if (!$data['name'] || !$data['table']) {
return lang('238');
}
if (in_array($data['table'], array('category', 'model')) || !preg_match('/^[a-z]+[a-z0-9_\\-]+$/i', $data['table']) || $this->db->where('table', $data['table'])->count_all_results('space_model')) {
return lang('239');
}
$data['setting'] = dr_array2string($data['setting']);
if ($this->db->insert('space_model', $data)) {
$id = $this->db->insert_id();
$file = FCPATH . 'member/controllers/Space' . $id . '.php';
if (!file_put_contents($file, '<?php
class Space' . $id . ' extends M_Controller {
public function __construct() {
parent::__construct();
}
public function add() {
$this->space_content_add();
}
public function edit() {
$this->space_content_edit();
}
public function index() {
$this->space_content_index();
}
}')) {
$this->db->where('id', $id)->delete($this->db->dbprefix('space_model'));
return dr_lang('243', '/member/controllers/');
}
$sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `{tablename}` (\n\t\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t `catid` mediumint(8) unsigned NOT NULL COMMENT '栏目id',\n\t\t\t `title` varchar(255) NOT NULL COMMENT '标题',\n\t\t\t `uid` mediumint(8) unsigned NOT NULL COMMENT '作者uid',\n\t\t\t `author` varchar(50) NOT NULL COMMENT '作者',\n\t\t\t `hits` int(10) unsigned NOT NULL COMMENT '点击量',\n\t\t\t `status` tinyint(1) unsigned NOT NULL COMMENT '审核状态',\n\t\t\t `inputtime` int(10) unsigned NOT NULL COMMENT '录入时间',\n\t\t\t `updatetime` int(10) unsigned NOT NULL COMMENT '更新时间',\n\t\t\t `displayorder` tinyint(3) NOT NULL DEFAULT '0',\n\t\t\t PRIMARY KEY `id` (`id`),\n\t\t\t KEY `uid` (`uid`),\n\t\t\t KEY `hits` (`hits`),\n\t\t\t KEY `catid` (`catid`),\n\t\t\t KEY `status` (`status`),\n\t\t\t KEY `inputtime` (`inputtime`),\n\t\t\t KEY `updatetime` (`updatetime`),\n\t\t\t KEY `displayorder` (`displayorder`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='会员空间" . $data['name'] . "模型表';";
$this->db->query(str_replace('{tablename}', $this->db->dbprefix('space_' . $data['table']), $sql));
$this->db->insert('admin_menu', array('pid' => 80, 'uri' => 'member/admin/content/index/mid/' . $id, 'url' => '', 'mark' => 'space-' . $id, 'name' => $data['name'] . '管理', 'hidden' => 0, 'displayorder' => $id + 5));
$this->db->insert('member_menu', array('pid' => 26, 'uri' => 'space' . $id . '/index', 'url' => '', 'mark' => 'space-' . $id, 'name' => $data['name'] . '管理', 'hidden' => 0, 'displayorder' => $id + 5));
$this->db->insert('field', array('name' => '主题', 'fieldname' => 'title', 'fieldtype' => 'Text', 'relatedid' => $id, 'relatedname' => 'space', 'isedit' => 1, 'ismain' => 1, 'ismember' => 1, 'issystem' => 1, 'issearch' => 1, 'disabled' => 0, 'setting' => dr_array2string(array('option' => array('width' => 400, 'fieldtype' => 'VARCHAR', 'fieldlength' => '255'), 'validate' => array('xss' => 1, 'required' => 1))), 'displayorder' => 0));
}
return TRUE;
}
示例15: index
/**
* 配置
*/
public function index()
{
$page = (int) $this->input->get('page');
$data = $this->member_model->setting();
$result = 0;
if (IS_POST) {
$post = $this->input->post('data');
$page = (int) $this->input->post('page');
foreach ($post as $name => $value) {
$this->db->replace('member_setting', array('name' => $name, 'value' => is_array($value) ? dr_array2string($value) : $value));
}
$data = $post;
$cache = $this->member_model->cache();
$result = 1;
} else {
$cache = $this->member_model->cache();
}
$this->template->assign(array('menu' => $this->get_menu(array(lang('m-035') => 'member/admin/setting/index')), 'data' => $data, 'page' => $page, 'result' => $result, 'synurl' => $cache['synurl'], 'mobile' => is_file(FCPATH . 'config/sms.php') ? TRUE : FALSE));
$this->template->display('setting_index.html');
}