本文整理汇总了PHP中dr_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP dr_lang函数的具体用法?PHP dr_lang怎么用?PHP dr_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dr_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* 添加扩展模型
*
* @param array $data
* @return string|TRUE
*/
public function add($data)
{
if (!$data['name'] || !$data['table']) {
return lang('238');
}
if (!preg_match('/^[a-z]+[a-z0-9_\\-]+$/i', $data['table']) || $this->link->where('table', $data['table'])->count_all_results($this->prefix)) {
return lang('239');
}
$data['setting'] = dr_array2string($data['setting']);
if ($this->link->insert($this->prefix, $data)) {
$id = $this->link->insert_id();
$name = 'Form_' . SITE_ID . '_' . $id;
$file = FCPATH . 'omooo/controllers/admin/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'omooo/core/D_Form.php\';' . PHP_EOL . PHP_EOL . 'class ' . $name . ' extends D_Form {' . PHP_EOL . PHP_EOL . ' public function __construct() {' . PHP_EOL . ' parent::__construct();' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . ' public function add() {' . PHP_EOL . ' $this->_addc();' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . ' public function edit() {' . PHP_EOL . ' $this->_editc();' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . ' public function index() {' . PHP_EOL . ' $this->_listc();' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . '}')) {
$this->db->where('id', $id)->delete($this->prefix);
return dr_lang('243', '/omooo/controllers/admin/');
}
$file = FCPATH . 'omooo/controllers/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'omooo/core/D_Form.php\';' . PHP_EOL . PHP_EOL . 'class ' . $name . ' extends D_Form {' . PHP_EOL . PHP_EOL . ' public function __construct() {' . PHP_EOL . ' parent::__construct();' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . ' public function index() {' . PHP_EOL . ' $this->_post();' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . '}')) {
$this->db->where('id', $id)->delete($this->prefix);
return dr_lang('243', '/omooo/controllers/');
}
$sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `" . $this->prefix . '_' . $data['table'] . "` (\n\t\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t `title` varchar(255) DEFAULT 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 `displayorder` tinyint(3) NOT NULL DEFAULT '0',\n\t\t\t PRIMARY KEY `id` (`id`),\n\t\t\t KEY `inputtime` (`inputtime`),\n\t\t\t KEY `displayorder` (`displayorder`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='" . $data['name'] . "表单表';";
$this->link->query($sql);
$this->db->insert('field', array('name' => '主题', 'fieldname' => 'title', 'fieldtype' => 'Text', 'relatedid' => $id, 'relatedname' => 'form-' . SITE_ID, '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;
}
示例2: 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;
}
示例3: add
/**
* 充值
*/
public function add()
{
if (IS_POST) {
$data = $this->input->post('data');
$value = intval($data['value']);
if (!$value) {
exit(dr_json(0, lang('131'), 'value'));
}
$this->member_model->update_score(0, $this->userinfo['uid'], $value, '', $data['note']);
$this->member_model->add_notice($this->userinfo['uid'], 1, dr_lang('m-080', SITE_EXPERIENCE, $value, $this->member['username']));
exit(dr_json(1, lang('000')));
}
$this->template->display('score_add.html');
}
示例4: __construct
/**
* 构造函数
*/
public function __construct()
{
parent::__construct();
$this->load->model('mform_model');
$this->load->model('module_model');
$this->dir = $this->input->get('dir');
$module = $this->get_cache('module-' . SITE_ID . '-' . $this->dir);
if (!$module) {
$this->admin_msg(lang('100'));
}
$this->mid = $module['id'];
$this->template->assign('menu', $this->get_menu(array(lang('073') => 'admin/module/index', dr_lang('330', $module['name']) => 'admin/mform/index/dir/' . $this->dir, lang('add') => 'admin/mform/add/dir/' . $this->dir)));
$this->template->assign(array('dir' => $this->dir, 'mid' => $this->mid, 'tpl' => $module['template'] ? $module['template'] : SITE_TEMPLATE));
}
示例5: 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;
}
示例6: add
/**
* 充值
*/
public function add()
{
$uid = (int) $this->input->get('uid');
$userinfo = $this->member_model->get_member($uid);
if (!$userinfo) {
exit(dr_json(1, lang('130')));
}
if (IS_POST) {
$data = $this->input->post('data');
$value = intval($data['value']);
if (!$value) {
exit(dr_json(0, lang('131'), 'value'));
}
$this->pay_model->add($uid, $data['value'], $data['note']);
$this->member_model->add_notice($this->userinfo['uid'], 1, dr_lang('m-080', SITE_MONEY, $value, $this->member['username']));
exit(dr_json(1, lang('000')));
}
$this->template->assign('userinfo', $userinfo);
$this->template->display('score_add.html');
}
示例7: _tag
/**
* tag
*/
protected function _tag()
{
$code = $this->input->get('name', TRUE);
$this->load->model('tag_model');
$data = $this->tag_model->tag($code);
if (!$data) {
$this->msg(dr_lang('mod-33', $code));
}
$urlrule = $this->module['setting']['tag']['url_page'] ? $this->module['setting']['tag']['url_page'] : 'index.php?c=tag&name={tag}&page={page}';
$urlrule = $this->module['url'] . str_replace('{tag}', $code, $urlrule);
$sql = 'SELECT * FROM ' . $this->content_model->prefix . ' WHERE ';
$tag = $where = array();
foreach ($data as $t) {
$tag[] = $t['name'];
$where[] = '`title` LIKE "%' . $t['name'] . '%" OR `keywords` LIKE "%' . $t['name'] . '%"';
}
$tag = implode(',', $tag);
$sql .= implode(' OR ', $where) . ' ORDER BY `updatetime` DESC';
$this->template->assign(array('tag' => $tag, 'list' => $data, 'tagsql' => $sql, 'urlrule' => $urlrule, 'pagesize' => $this->module['setting']['tag']['pagesize'] ? $this->module['setting']['tag']['pagesize'] : 20, 'meta_title' => $tag . (SITE_SEOJOIN ? SITE_SEOJOIN : '_') . $this->module['name'], 'meta_keywords' => $this->module['setting']['seo']['meta_keywords'], 'meta_description' => $this->module['setting']['seo']['meta_description']));
$this->template->display('tag.html');
}
示例8: index
/**
* 数据维护
*/
public function index()
{
$list = $this->siteid ? $this->system_model->get_site_table($this->siteid) : $this->system_model->get_system_table();
if (IS_POST) {
$tables = $this->input->post('select');
if (!$tables) {
$this->admin_msg(lang('196'));
}
switch ((int) $this->input->post('action')) {
case 1:
// 优化表
foreach ($tables as $table) {
$this->link->query("OPTIMIZE TABLE `{$table}`");
}
$result = lang('000');
$this->system_log('优化数据表');
// 记录日志
break;
case 2:
// 修复表
foreach ($tables as $table) {
$this->link->query("REPAIR TABLE `{$table}`");
}
$result = lang('000');
$this->system_log('修复数据表');
// 记录日志
break;
}
}
$menu = array();
$menu[lang('194')] = 'admin/db/index';
foreach ($this->SITE as $id => $s) {
$menu[dr_lang('384', $id)] = 'admin/db/index/siteid/' . $id;
}
$this->template->assign(array('menu' => $this->get_menu($menu), 'list' => $list, 'result' => $result));
$this->template->display('db_index.html');
}
示例9: add
/**
* 添加表单
*
* @param array $data
* @return string|TRUE
*/
public function add($data)
{
$this->link->insert($this->table, array('name' => $data['name'] ? $data['name'] : 'form', 'setting' => dr_array2string($data['setting']), 'disabled' => 0, 'permission' => dr_array2string($data['permission'])));
if ($id = $this->link->insert_id()) {
$name = 'Form_' . SITE_ID . '_' . $id;
// 管理控制器
$file = FCPATH . $this->dir . '/controllers/admin/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'omooo/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->link->where('id', $id)->delete($this->table);
return dr_lang('243', FCPATH . $this->dir . '/controllers/admin/');
}
// 会员控制器
$file = FCPATH . $this->dir . '/controllers/member/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'omooo/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->link->where('id', $id)->delete($this->table);
return dr_lang('243', FCPATH . $this->dir . '/controllers/member/');
}
// 前端发布控制器
$file = FCPATH . $this->dir . '/controllers/' . $name . '.php';
if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'omooo/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->link->where('id', $id)->delete($this->table);
return dr_lang('243', APPPATH . 'controllers/');
}
// 主表sql
$this->link->query("DROP TABLE IF EXISTS `" . $this->table . '_' . $id . "`");
$sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `" . $this->table . '_' . $id . "` (\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'] . "表单数据表';";
$this->link->query($sql);
$this->db->insert('field', array('name' => '主题', 'fieldname' => 'subject', 'fieldtype' => 'Text', 'relatedid' => $id, 'relatedname' => 'mform-' . $this->dir . '-' . SITE_ID, '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-' . $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/' . strtolower($name) . '/index', 'url' => '', 'pid' => $menu['id'], 'name' => $data['name'] . '管理', 'mark' => 'module-' . $this->dir . '-' . SITE_ID . '-' . $id, 'displayorder' => 0));
}
}
return FALSE;
}
示例10: resend
/**
* 重发邮件审核
*/
public function resend()
{
if ($this->member['groupid'] != 1) {
$this->member_msg(lang('m-233'));
}
if ($this->get_cache('MEMBER', 'setting', 'regverify') != 1) {
$this->member_msg(lang('m-230'));
}
if (get_cookie('resend') && $this->member['randcode']) {
$this->member_msg(lang('m-232'));
}
$url = MEMBER_URL . 'index.php?c=login&m=verify&code=' . $this->member_model->get_encode($this->uid);
$this->sendmail($this->member['email'], lang('m-191'), dr_lang('m-192', $this->member['username'], $url, $url, $this->input->ip_address()));
$this->input->set_cookie('resend', $this->uid, 3600);
$this->member_msg(dr_lang('m-231', $this->member['email']), dr_url('home/index'), 1);
}
示例11: add_sns
//.........这里部分代码省略.........
} else {
$m = dr_member_info($uid);
$username = $m['username'];
unset($m);
}
// 来源
if (!$source) {
if ($this->agent->is_mobile()) {
$source = lang('m-247');
} else {
$source = lang('m-246');
}
}
// 过滤非法内容
$content = dr_preg_html($content) . ' ';
// 提取URL链接
$content = preg_replace_callback('/((?:https?|mailto|ftp):\\/\\/([^\\x{2e80}-\\x{9fff}\\s<\'\\"“”‘’,。}]*)?)/u', '_format_feed_content_url_length', $content);
// 提取@
$user = array();
if (preg_match_all('/@(.+) /U', $content, $match)) {
$data = array_unique($match[1]);
foreach ($data as $t) {
$m = $this->db->select('uid')->where('username', $t)->get('member')->row_array();
if ($m) {
$user[$t] = $m['uid'];
$content = str_replace('@' . $t . ' ', ' <a href="javascript:;" uid="' . $m['uid'] . '" event-node="face_card" target="_blank">@' . $t . '</a> ', $content);
}
}
unset($data, $m);
}
// 提取话题
$topic = array();
if (preg_match_all('/#(.+)#/U', $content, $match)) {
$data = array_unique($match[1]);
foreach ($data as $t) {
// 查询话题是否存在,不存在就创建
$row = $this->db->where('name', $t)->get('sns_topic')->row_array();
if ($row) {
$tid = $row['id'];
} else {
$this->db->insert('sns_topic', array('name' => $t, 'uid' => $uid, 'username' => $username, 'count' => 0, 'inputtime' => SYS_TIME));
$tid = $this->db->insert_id();
}
$topic[] = $tid;
$content = str_replace('#' . $t . '#', '<a href="[TOPIC-URL-' . $tid . ']" target="_blank">#' . $t . '#</a> ', $content);
}
unset($data);
}
$content = trim($content);
if (!$content) {
return FALSE;
}
// 是转发文章
if ($repost) {
$row = $this->db->where('id', $repost)->get('sns_feed')->row_array();
if ($row) {
$repost = $row['repost_id'] ? $row['repost_id'] : $row['id'];
// 统计原文转发数量
$this->db->where('id', $repost)->set('repost', 'repost+1', FALSE)->update('sns_feed');
// 清除缓存数据
$this->ci->set_cache_data('sns-feed-' . $repost, '', 1);
} else {
$repost = 0;
}
}
$images = $attach ? trim($attach, '|') : '';
// 插入的数据
$this->db->insert('sns_feed', array('uid' => $uid, 'username' => $username, 'comment' => 0, 'repost' => 0, 'digg' => 0, 'content' => $content, 'repost_id' => $repost, 'source' => $source, 'images' => $images, 'inputip' => $this->input->ip_address(), 'inputtime' => SYS_TIME));
$id = $this->db->insert_id();
// 保存附件
if ($images) {
$this->load->model('attachment_model');
$this->attachment_model->replace_attach($uid, $this->db->dbprefix('sns_feed') . '-' . $id, explode('|', $images));
}
// 更新话题关系表
if ($topic) {
foreach ($topic as $tid) {
$this->db->insert('sns_topic_index', array('fid' => $id, 'tid' => $tid));
$this->db->where('id', $tid)->set('count', 'count+1', FALSE)->update('sns_topic');
}
}
// 给@的人发送提醒
if ($user) {
$this->add_notice($user, 2, dr_lang('m-248', $username, dr_sns_feed_url($id)));
}
// 给作者发送转发的提醒
if ($repost) {
$this->add_notice($row['uid'], 2, dr_lang('m-252', $username, dr_sns_feed_url($id)));
}
// 分数奖励
if ($uid == $this->uid) {
if ($this->member_rule['feed_experience']) {
$this->update_score(0, $uid, (int) $this->member_rule['feed_experience'], '', "lang,m-212");
}
if ($this->member_rule['feed_score']) {
$this->update_score(1, $uid, (int) $this->member_rule['feed_score'], '', "lang,m-212");
}
}
return TRUE;
}
示例12: member
/**
* 发送给会员
*/
public function member()
{
$data = $this->cache->file->get($this->cache_file);
if (!$data) {
$this->admin_msg(lang('134'));
}
$page = max((int) $this->input->get('page'), 1);
$psize = 5;
$tpage = ceil($data['total'] / $psize);
if ($data['groupid']) {
$this->db->where('groupid', $data['groupid']);
}
$member = $this->db->select('email')->order_by('uid desc')->limit($psize, $psize * ($page - 1))->get('member')->result_array();
if ($member) {
foreach ($member as $t) {
$this->member_model->sendmail($t['email'], $data['title'], $data['message']);
}
$this->admin_msg(dr_lang('348', $data['total'], $tpage . '/' . $page), dr_url('mail/member', array('page' => $page + 1)), 2, 1);
} else {
$this->cache->file->delete($this->cache_file);
$this->admin_msg(lang('000'), dr_url('mail/send'), 1);
}
}
示例13: _post
/**
* 提交内容
*/
protected function _post()
{
if (!$this->form['setting']['post']) {
if (IS_POST) {
exit($this->call_msg(lang('m-114')));
} else {
$this->msg(lang('m-114'));
}
}
if (IS_POST) {
if ($this->form['setting']['code'] && !$this->check_captcha('code')) {
exit($this->call_msg(lang('m-000')));
}
$data = $this->validate_filter($this->form['field']);
// 验证出错信息
if (isset($data['error'])) {
exit($this->call_msg($data['msg']));
}
$data['inputip'] = $this->input->ip_address();
$data['inputtime'] = SYS_TIME;
$data['displayorder'] = 0;
$this->load->model('form_model');
$this->form_model->new_addc($this->form['table'], $data);
if ($this->form['setting']['send'] && $this->form['setting']['template']) {
// 兼容php5.5
if (version_compare(PHP_VERSION, '5.5.0') >= 0) {
$rep = new php5replace($data[1]);
$content = preg_replace_callback('#{(.*)}#U', array($rep, 'php55_replace_data'), $this->form['setting']['template']);
$content = preg_replace_callback('#{([a-z_0-9]+)\\((.*)\\)}#Ui', array($rep, 'php55_replace_function'), $content);
unset($rep);
} else {
@extract($data[1]);
unset($data[1]);
$content = preg_replace("/{(.*)}/Ue", "\$\\1", $this->form['setting']['template']);
$content = preg_replace('#{([a-z_0-9]+)\\((.*)\\)}#Uie', "\\1(dr_safe_replace('\\2'))", $content);
}
$this->sendmail_queue($this->form['setting']['send'], dr_lang('m-306', $this->form['name']), nl2br($content));
}
$this->call_msg(lang('m-305'), 1);
} else {
$tpl = FCPATH . 'dayrui/templates/' . SITE_TEMPLATE . '/form_' . $this->form['table'] . '.html';
$this->template->assign(array('form' => $this->form, 'code' => $this->form['setting']['code'], 'myfield' => $this->field_input($this->form['field']), 'meta_title' => $this->form['name'] . SITE_SEOJOIN . SITE_NAME));
$this->template->display(is_file($tpl) ? basename($tpl) : 'form.html');
}
}
示例14: field_format_value
/**
* 字段输出格式化
*
* @param array $fields 可用字段集
* @param array $data 数据
* @param intval $curpage 分页id
* @param string $dirname 模块目录
* @return string
*/
public function field_format_value($fields, $data, $curpage = 1, $dirname = NULL)
{
if (!$fields || !$data || !is_array($data)) {
return $data;
}
foreach ($data as $n => $value) {
if (isset($fields[$n])) {
$format = dr_get_value($fields[$n]['fieldtype'], $value, $fields[$n]['setting']['option'], $dirname);
if ($format !== $value) {
$data['_' . $n] = $value;
$data[$n] = $format;
} elseif (SITE_MOBILE !== TRUE && $n == 'content' && $fields[$n]['fieldtype'] == 'Ueditor' && strpos($value, '<div name="dr_page_break" class="pagebreak">') !== FALSE && preg_match_all('/<div name="dr_page_break" class="pagebreak">(.*)<\\/div>/Us', $value, $match) && preg_match('/(.*)<div name="dr_page_break"/Us', $value, $frist)) {
// 编辑器分页 老版本
$page = 1;
$content = $title = array();
$data['_' . $n] = $value;
$content[$page]['title'] = dr_lang('m-131', $page);
$content[$page]['body'] = $frist[1];
foreach ($match[0] as $i => $t) {
$page++;
$value = str_replace($content[$page - 1]['body'] . $t, '', $value);
if (preg_match('/(.*)<div name="dr_page_break"/Us', $value, $match_body)) {
$body = $match_body[1];
} else {
$body = $value;
}
$title[$page] = trim($match[1][$i]);
$content[$page]['title'] = trim($match[1][$i]) ? trim($match[1][$i]) : dr_lang('m-131', $page);
$content[$page]['body'] = $body;
}
$page = max(1, min($page, $curpage));
$data[$n] = $content[$page]['body'];
$data[$n . '_page'] = $content;
$data[$n . '_title'] = $title[$page];
} elseif (SITE_MOBILE !== TRUE && $n == 'content' && $fields[$n]['fieldtype'] == 'Ueditor' && strpos($value, '<p class="pagebreak">') !== FALSE && preg_match_all('/<p class="pagebreak">(.*)<\\/p>/Us', $value, $match) && preg_match('/(.*)<p class="pagebreak">/Us', $value, $frist)) {
// 编辑器分页 新版
$page = 1;
$content = $title = array();
$data['_' . $n] = $value;
$content[$page]['title'] = dr_lang('m-131', $page);
$content[$page]['body'] = $frist[1];
foreach ($match[0] as $i => $t) {
$page++;
$value = str_replace($content[$page - 1]['body'] . $t, '', $value);
if (preg_match('/(.*)<p class="pagebreak"/Us', $value, $match_body)) {
$body = $match_body[1];
} else {
$body = $value;
}
$title[$page] = trim($match[1][$i]);
$content[$page]['title'] = trim($match[1][$i]) ? trim($match[1][$i]) : dr_lang('m-131', $page);
$content[$page]['body'] = $body;
}
$page = max(1, min($page, $curpage));
$data[$n] = $content[$page]['body'];
$data[$n . '_page'] = $content;
$data[$n . '_title'] = $title[$page];
}
} elseif (strpos($n, '_lng') !== FALSE) {
// 百度地图
$name = str_replace('_lng', '', $n);
if (isset($data[$name . '_lat'])) {
$data[$name] = '';
if ($data[$name . '_lng'] > 0 || $data[$name . '_lat'] > 0) {
$data[$name] = $data[$name . '_lng'] . ',' . $data[$name . '_lat'];
}
}
}
}
return $data;
}
示例15: _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;
}