本文整理汇总了PHP中dr_catcher_data函数的典型用法代码示例。如果您正苦于以下问题:PHP dr_catcher_data函数的具体用法?PHP dr_catcher_data怎么用?PHP dr_catcher_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dr_catcher_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* 检查下载程序
*/
public function update()
{
if (DR_VERSION_ID != $this->input->get('id') - 1) {
$this->admin_msg('对不起,您的系统版本不满足升级条件');
}
$data = dr_catcher_data(urldecode($this->input->get('fid')));
if (!$data) {
$this->admin_msg('对不起,您的服务器不支持远程下载');
}
$save = FCPATH . 'cache/down/update.zip';
$check = FCPATH . 'cache/down/update/';
if (!@file_put_contents($save, $data)) {
$this->admin_msg('目录/cache/down/没有写入权限');
}
// 解压缩文件
$this->load->helper('file');
$this->load->library('Pclzip');
$this->pclzip->PclFile($save);
if ($this->pclzip->extract(PCLZIP_OPT_PATH, $check, PCLZIP_OPT_REPLACE_NEWER) == 0) {
@unlink($save);
delete_files(FCPATH . 'cache/down/', TRUE);
$this->admin_msg("Error : " . $this->pclzip->errorInfo(true));
}
// 检查版本文件
if (!is_file($check . 'config/version.php') || !filesize($check . 'config/version.php')) {
delete_files(FCPATH . 'cache/down/', TRUE);
$this->admin_msg('升级文件不完整,没有找到版本文件');
}
$config = (require $check . 'config/version.php');
// 覆盖至网站根目录
$this->pclzip->extract(PCLZIP_OPT_PATH, FCPATH, PCLZIP_OPT_REPLACE_NEWER);
$this->dcache->set('install', TRUE);
delete_files(FCPATH . 'cache/down/', TRUE);
// 运行SQL语句
if (is_file(FCPATH . 'update.sql')) {
$sql = file_get_contents(FCPATH . 'update.sql');
$sql = str_replace('{dbprefix}', $this->db->dbprefix, $sql);
$sql_data = explode(';SQL_OmWeb_EOL', trim(str_replace(array(PHP_EOL, chr(13), chr(10)), 'SQL_OmWeb_EOL', $sql)));
foreach ($sql_data as $query) {
if (!$query) {
continue;
}
$queries = explode('SQL_OmWeb_EOL', trim($query));
$ret = '';
foreach ($queries as $query) {
$ret .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
}
if (!$ret) {
continue;
}
$this->db->query($ret);
}
@unlink(FCPATH . 'update.sql');
}
//检查update控制器
if (is_file(FCPATH . 'omooo/controllers/admin/Update.php')) {
$this->admin_msg('正在升级数据,请稍候...', dr_url('update/index'), 2);
}
$this->admin_msg('升级完成,请按F5刷新整个页面<script src="http://www.omooo.com/index.php?c=sys&m=updated&site=' . SITE_URL . '&vid=' . $config['DR_VERSION_ID'] . '"></script>', dr_url('home/main'), 1);
}
示例2: get_user_info
public function get_user_info(OAuth2_Token_Access $token)
{
$url = 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&' . http_build_query(array('access_token' => $token->access_token));
$user = json_decode(dr_catcher_data($url), true);
// ����ͳһ����ݸ�ʽ
return array('oid' => $user['id'], 'oauth' => 'google', 'avatar' => isset($user['picture']) ? $user['picture'] : null, 'nickname' => url_title($user['name'], '_', true), 'expire_at' => $token->expires, 'access_token' => $token->access_token, 'refresh_token' => $token->refresh_token);
}
示例3: _version
/**
* 版本检测
*/
private function _version()
{
$id = (int) dr_catcher_data('http://www.omooo.com/index.php?c=sys&m=now');
if ($id && DR_VERSION_ID < $id) {
return $this->halt("您的当前版本过低,为了您网站的安全性,请立即升级到官方最新版本,<a style='color:red' href='" . dr_url('upgrade/index') . "'><b>这里升级</b></a>", 0);
}
}
示例4: index
/**
* 内容
*/
public function index()
{
$id = (int) $this->input->get('id');
$page = max(1, (int) $this->input->get('page'));
$body = dr_catcher_data(SITE_URL . DR_ROUTER_PATH . '/index.php?c=extend&id=' . $id . '&page=' . $page);
echo $body;
exit;
}
示例5: get_user_info
/**
* 获取用户信息
*/
public function get_user_info(OAuth2_Token_Access $token)
{
$url = 'https://api.t.163.com/users/show.json?' . http_build_query(array('access_token' => $token->access_token, 'user_id' => $token->uid));
$return = dr_catcher_data($url);
$user = json_decode($return);
if (array_key_exists('error', $user)) {
throw new OAuth2_Exception($return);
}
// 返回统一的数据格式
return array('oid' => $user->id, 'oauth' => $this->name, 'avatar' => $user->profile_image_url, 'nickname' => $user->screen_name, 'expire_at' => $token->expires, 'access_token' => $token->access_token, 'refresh_token' => $token->refresh_token);
}
示例6: get_user_info
/**
* 获取用户信息
*/
public function get_user_info(OAuth2_Token_Access $token)
{
$url = 'https://openapi.baidu.com/rest/2.0/passport/users/getLoggedInUser?' . http_build_query(array('access_token' => $token->access_token, 'uid' => $token->uid));
$return = dr_catcher_data($url);
$user = json_decode($return);
if (array_key_exists('error', $user)) {
throw new OAuth2_Exception($return);
}
// 返回统一的数据格式
return array('oid' => $user->uid, 'oauth' => $this->name, 'avatar' => 'http://tb.himg.baidu.com/sys/portraitn/item/' . $user->portrait, 'nickname' => $user->uname, 'expire_at' => $token->expires, 'access_token' => $token->access_token, 'refresh_token' => $token->refresh_token);
}
示例7: get_user_info
/**
* ��ȡ�û���Ϣ
*/
public function get_user_info(OAuth2_Token_Access $token)
{
// ʹ��Access Token����ȡ�û���OpenID
$url = 'https://graph.qq.com/oauth2.0/me?' . http_build_query(array('access_token' => $token->access_token));
$response = dr_catcher_data($url);
if (strpos($response, 'callback') !== false) {
$lpos = strpos($response, '(');
$rpos = strrpos($response, ')');
$response = substr($response, $lpos + 1, $rpos - $lpos - 1);
}
$me = json_decode($response);
if (isset($me->error)) {
throw new OAuth2_Exception($response);
}
// ʹ��Access Token��OpenID��ȡ�û���Ϣ
$url = 'https://graph.qq.com/user/get_user_info?' . http_build_query(array('access_token' => $token->access_token, 'openid' => $me->openid, 'oauth_consumer_key' => $this->client_id));
$response = dr_catcher_data($url);
$user = json_decode($response);
if (isset($user->ret) && $user->ret != 0) {
throw new OAuth2_Exception($response);
}
// ����ͳһ����ݸ�ʽ
return array('oid' => $me->openid, 'oauth' => $this->name, 'avatar' => $user->figureurl_1, 'nickname' => $user->nickname, 'expire_at' => $token->expires, 'access_token' => $token->access_token, 'refresh_token' => $token->refresh_token);
}
示例8: kd_status
public function kd_status($id, $sn)
{
$config = $this->link->where('name', 'expresses')->limit(1)->get(SITE_ID . '_' . APP_DIR . '_config')->row_array();
$config = dr_string2array($config['value']);
return str_replace(array('ickd_return', '<tr><th>时间</th><th>记录</th></tr>', '</table>'), array('table_form', '', '<tr><td colspan="2" style="border:none;text-align:center;color:red;">以上部分信息来自于第三方</td></tr></table>'), dr_catcher_data('http://api.ickd.cn/?id=' . $config['id'] . '&secret=' . $config['secret'] . '&com=' . $id . '&nu=' . $sn . '&type=html&encode=utf8&ord=asc'));
}
示例9: baidutest
public function baidutest()
{
$ak = $this->input->get('ak');
$sk = $this->input->get('sk');
$host = $this->input->get('host');
$rurl = $this->input->get('rurl');
$bucket = $this->input->get('bucket');
if (!$ak || !$host || !$sk || !$bucket) {
exit(lang('035'));
}
if (!$rurl) {
exit(lang('199'));
}
require_once FCPATH . 'omooo/libraries/BaiduBCS/bcs.class.php';
$bcs = new BaiduBCS($ak, $sk, $host);
$opt = array();
$opt['acl'] = BaiduBCS::BCS_SDK_ACL_TYPE_PUBLIC_WRITE;
$opt['curlopts'] = array(CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 1800);
$response = $bcs->create_object($bucket, '/test.txt', FCPATH . 'index.php', $opt);
if ($response->status == 200) {
if (strpos(dr_catcher_data($rurl . '/test.txt'), 'omooo.com') === FALSE) {
exit(lang('200'));
}
$bcs->delete_object($bucket, '/test.txt');
exit('ok');
} else {
exit('error');
}
}
示例10: _execute_down_file
/**
* 远程图片下载
*
* @param array $data
* @return Bool|String
*/
public function _execute_down_file($data)
{
$data = dr_string2array($data);
if (!$data) {
return '执行值不存在';
}
$path = SYS_UPLOAD_PATH . '/' . date('Ym', SYS_TIME) . '/';
if (!is_dir($path)) {
dr_mkdirs($path);
}
$file = dr_catcher_data($data['url']);
if (!$file) {
return '获取远程数据失败';
}
$fileext = strtolower(trim(substr(strrchr($data['url'], '.'), 1, 10)));
//扩展名
$filename = substr(md5(time()), 0, 7) . rand(100, 999);
if (@file_put_contents($path . $filename . '.' . $fileext, $file)) {
$info = array('file_ext' => '.' . $fileext, 'full_path' => $path . $filename . '.' . $fileext, 'file_size' => filesize($path . $filename . '.' . $fileext) / 1024, 'client_name' => $data['url']);
$this->load->model('attachment_model');
$result = $this->attachment_model->upload($data['uid'], $info, $data['id']);
if (is_array($result)) {
list($table, $tid, $eid) = explode('-', $result['related']);
$this->ci->load->model('system_model');
$tableinfo = $this->ci->system_model->cache();
// 表结构缓存
$this->ci->clear_cache('attachment-' . $data['id']);
// 数据源判断
if (strpos($table, $this->db->dbprefix($result['siteid'])) === 0) {
$db = isset($this->site[$result['siteid']]) ? $this->site[$result['siteid']] : $this->db;
} else {
$db = $this->db;
}
$url = dr_get_file($data['id']);
// 完整地址忽略水印
$field = $data['field']['fieldname'];
// 字段名称
if ($data['field']['relatedname'] == 'module') {
// 模块表部分
if (strpos($table, '_draft') || strpos($table, '_verify')) {
// 草稿和审核表
$row = $db->where('id', $tid)->get($table)->row_array();
$content = dr_string2array($row['content']);
if (isset($content[$field]) && $content[$field]) {
$content[$field] = str_replace($data['url'] . '?s=finecms', $url, $content[$field]);
$db->where('id', $tid)->update($table, array('content' => dr_array2string($content)));
}
return TRUE;
} else {
// 模块表
if (!$data['field']['ismain']) {
// 附表
$index = $db->where('id', $tid)->get($table . '_index')->row_array();
$table = $table . '_data_' . intval($index['tableid']);
}
}
} elseif ($data['field']['relatedname'] == 'extend') {
// 模块扩展表部分
if (strpos($table, '_draft') || strpos($table, '_verify')) {
// 草稿和审核表
$row = $db->where('id', $tid)->get($table)->row_array();
$content = dr_string2array($row['content']);
if (isset($content[$field]) && $content[$field]) {
$content[$field] = str_replace($data['url'] . '?s=finecms', $url, $content[$field]);
$db->where('id', $tid)->update($table, array('content' => dr_array2string($content)));
}
return TRUE;
} else {
// 内容表
if (!$data['field']['ismain']) {
// 附表
$index = $db->where('id', $tid)->get($table . '_extend_index')->row_array();
$table = $table . '_extend_data_' . intval($index['tableid']);
}
}
} else {
list($dir, $catid) = explode('-', $data['field']['relatedname']);
if (is_dir(FCPATH . $dir)) {
// 栏目附加字段
if (!$data['field']['ismain']) {
// 附表
$index = $db->where('id', $tid)->get($table . '_index')->row_array();
$table = $table . '_category_data_' . intval($index['tableid']);
} else {
// 主表
$table = $table . '_category_data';
}
}
}
// 表结构不存在
if (!isset($tableinfo[$table]['field'])) {
@unlink($info['full_path']);
return '表结构不存在:' . $table;
}
//.........这里部分代码省略.........
示例11: catcher
/**
* 下载远程文件
*
* @param intval $uid uid 用户id
* @param string $url 文件url
* @return array
*/
public function catcher($uid, $url)
{
if (!$uid || !$url) {
return NULL;
}
// 站点信息
$siteinfo = $this->ci->get_cache('siteinfo', SITE_ID);
// 域名验证
$domain = (require FCPATH . 'config/domain.php');
foreach ($siteinfo['remote'] as $t) {
$domain[$t['SITE_ATTACH_URL']] = TRUE;
}
$domain['baidu.com'] = TRUE;
$domain['google.com'] = TRUE;
foreach ($domain as $uri => $t) {
if (stripos($url, $uri) !== FALSE) {
return NULL;
}
}
$path = FCPATH . 'member/uploadfile/' . date('Ym', SYS_TIME) . '/';
if (!is_dir($path)) {
dr_mkdirs($path);
}
$filename = substr(md5(time()), 0, 7) . rand(100, 999);
$data = dr_catcher_data($url);
if (!$data) {
return NULL;
}
$fileext = strtolower(trim(substr(strrchr($url, '.'), 1, 10)));
//扩展名
if (file_put_contents($path . $filename . '.' . $fileext, $data)) {
$info = array('file_ext' => '.' . $fileext, 'full_path' => $path . $filename . '.' . $fileext, 'file_size' => filesize($path . $filename . '.' . $fileext) / 1024, 'client_name' => $url);
return $this->upload($uid, $info, NULL);
}
return NULL;
}
示例12: upgrade
/**
* 升级程序
*/
public function upgrade()
{
$key = (int) $this->input->get('key');
$dir = $this->input->get('dir');
if (is_file(FCPATH . 'app/' . $dir . '/config/app.php')) {
$config = (require FCPATH . 'app/' . $dir . '/config/app.php');
if ((int) $config['key'] != $key) {
$this->admin_msg('此应用无法在线升级,key不匹配');
}
} else {
$this->admin_msg('此应用无法在线升级,目录(/app/' . $dir . '/)不存在');
}
$data = dr_catcher_data(urldecode($this->input->get('id')));
if (!$data) {
$this->admin_msg('对不起,您的服务器不支持远程下载');
}
$save = FCPATH . 'cache/down/app.zip';
$check = FCPATH . 'cache/down/app/';
if (!@file_put_contents($save, $data)) {
$this->admin_msg('目录/cache/down/没有写入权限');
}
// 解压缩文件
$this->load->helper('file');
$this->load->library('Pclzip');
// 文件安全性检测
$this->pclzip->PclFile($save);
$content = $this->pclzip->listContent();
if (!$content) {
$this->admin_msg('文件下载不完整或者已经损坏!<br>请检查网站目录权限或者联系应用开发者。');
}
foreach ($content as $t) {
if (strpos($t['stored_filename'], '..') !== FALSE || strpos($t['stored_filename'], '/') === 0) {
$this->admin_msg('含有非法名称的文件:' . basename($t['stored_filename']));
}
}
unset($content);
// 开始解压文件
if ($this->pclzip->extract(PCLZIP_OPT_PATH, $check, PCLZIP_OPT_REPLACE_NEWER) == 0) {
@unlink($save);
delete_files(FCPATH . 'cache/down/', TRUE);
$this->admin_msg("Error : " . $this->pclzip->errorInfo(true));
}
// 检查版本文件
if (!is_file($check . 'config/app.php') || !filesize($check . 'config/app.php')) {
delete_files(FCPATH . 'cache/down/', TRUE);
$this->admin_msg('升级文件不完整,请重试');
}
// 覆盖至网站目录
$this->pclzip->extract(PCLZIP_OPT_PATH, FCPATH . 'app/' . $dir, PCLZIP_OPT_REPLACE_NEWER);
delete_files(FCPATH . 'cache/down/', TRUE);
// 运行SQL语句
if (is_file(FCPATH . 'app/' . $dir . '/update.sql')) {
$sql = file_get_contents(FCPATH . 'app/' . $dir . '/update.sql');
$sql = str_replace('{dbprefix}', $this->db->dbprefix, $sql);
$this->sql_query($sql);
@unlink(FCPATH . 'app/' . $dir . '/update.sql');
}
//检查update控制器
if (is_file(FCPATH . 'app/' . $dir . '/controllers/admin/Update.php')) {
$this->admin_msg('正在升级数据,请稍候...', dr_url($dir . '/update/index'), 2);
}
$this->admin_msg('升级完成,请重新检测一次版本', dr_url('application/index'), 1);
}
示例13: sendsms
/**
* 短信发送
*
* @param string $mobile
* @param string $content
* @return bool
*/
public function sendsms($mobile, $content, $tid)
{
if (!$mobile || !$content) {
return FALSE;
}
$file = FCPATH . 'config/sms.php';
if (!is_file($file)) {
return FALSE;
}
if (!$tid) {
$tid = "1";
}
$config = (require_once $file);
if ($config['third']) {
$this->load->helper('sms');
if (function_exists('my_sms_send')) {
$result = my_sms_send($mobile, $content . '【' . $config['note'] . '】');
} else {
return FALSE;
}
} else {
$result = dr_catcher_data('http://www.omooo.com/sms.php?c=send&tid=' . $tid . '&uid=' . $config['uid'] . '&key=' . $config['key'] . '&mobile=' . $mobile . '&content=' . $content . '&domain=' . trim(str_replace('http://', '', SITE_URL), '/') . '&sitename=' . SITE_NAME);
if (!$result) {
return FALSE;
}
$result = dr_object2array(json_decode($result));
//对象转换数组
}
@file_put_contents(FCPATH . 'cache/sms_error.log', date('Y-m-d H:i:s') . ' [' . $mobile . '] [' . $result['msg'] . '] (' . str_replace(array(chr(13), chr(10)), '', $content) . ')' . PHP_EOL, FILE_APPEND);
return $result;
}
示例14: fn_sendsms
function fn_sendsms($mobile, $content)
{
if (!$mobile || !$content) {
return FALSE;
}
$file = FCPATH . 'config/sms.php';
$config = is_file($file) ? string2array(file_get_contents($file)) : array();
$result = dr_catcher_data('http://sms.dayrui.com/index.php?uid=' . $config['uid'] . '&key=' . $config['key'] . '&mobile=' . $mobile . '&content=' . $content . '【' . $config['note'] . '】&domain=' . trim(str_replace('http://', '', SITE_URL), '/') . '&sitename=' . CMS_NAME);
if (!$result) {
return FALSE;
}
$result = dr_object2array(json_decode($result));
@file_put_contents(FCPATH . 'cache/sms.log', date('Y-m-d H:i:s') . ' [' . $mobile . '] [' . $result['msg'] . '] (' . str_replace(array(chr(13), chr(10)), '', $content) . ')' . PHP_EOL, FILE_APPEND);
return $result;
}
示例15: thumb
/**
* 图片处理
*/
public function thumb()
{
$id = (int) $this->input->get('id');
$info = get_attachment($id);
// 图片信息
$file = $info && in_array($info['fileext'], array('jpg', 'gif', 'png')) ? $info['attachment'] : 'omooo/statics/images/nopic.gif';
// 图片判断
// 参数设置
$water = (int) $this->input->get('water');
$width = (int) $this->input->get('width');
$height = (int) $this->input->get('height');
$thumb_file = FCPATH . 'member/uploadfile/thumb/' . md5("index.php?c=api&m=thumb&id={$id}&width={$width}&height={$height}&water={$water}") . '.jpg';
if (!is_dir(FCPATH . 'member/uploadfile/thumb/')) {
@mkdir(FCPATH . 'member/uploadfile/thumb/');
}
// 远程图片下载到本地缓存目录
if (isset($info['remote']) && $info['remote']) {
$file = FCPATH . 'cache/attach/' . time() . '_' . basename($info['attachment']);
file_put_contents($file, dr_catcher_data($info['attachment']));
} else {
$file = FCPATH . $file;
}
// 处理宽高
list($_width, $_height) = getimagesize($file);
$width = $width ? $width : $_width;
$height = $height ? $height : $_height;
// 站点配置信息
$site = $this->get_cache('siteinfo', SITE_ID);
$iswater = (bool) $site['SITE_IMAGE_WATERMARK'];
$config['width'] = $width;
$config['height'] = $height;
$config['create_thumb'] = TRUE;
$config['source_image'] = $file;
$config['is_watermark'] = $iswater && $water ? TRUE : FALSE;
// 开启水印
$config['is_watermark'] = isset($info['remote']) && $info['remote'] && !$site['SITE_IMAGE_REMOTE'] ? FALSE : $config['is_watermark'];
// 远程附件图片水印关闭
$config['image_library'] = 'gd2';
$config['dynamic_output'] = TRUE;
// 输出到浏览器
$config['maintain_ratio'] = (bool) SITE_IMAGE_RATIO;
// 使图像保持原始的纵横比例
// 水印参数
$config['wm_type'] = $site['SITE_IMAGE_TYPE'] ? 'overlay' : 'text';
$config['wm_vrt_offset'] = $site['SITE_IMAGE_VRTOFFSET'];
$config['wm_hor_offset'] = $site['SITE_IMAGE_HOROFFSET'];
$config['wm_vrt_alignment'] = $site['SITE_IMAGE_VRTALIGN'];
$config['wm_hor_alignment'] = $site['SITE_IMAGE_HORALIGN'];
// 文字模式
$config['wm_text'] = $site['SITE_IMAGE_TEXT'];
$config['wm_font_size'] = $site['SITE_IMAGE_SIZE'];
$config['wm_font_path'] = FCPATH . 'omooo/statics/watermark/' . ($site['SITE_IMAGE_FONT'] ? $site['SITE_IMAGE_FONT'] : 'default.ttf');
$config['wm_font_color'] = $site['SITE_IMAGE_COLOR'] ? str_replace('#', '', $site['SITE_IMAGE_COLOR']) : '#000000';
// 图片模式
$config['wm_opacity'] = $site['SITE_IMAGE_OPACITY'] ? $site['SITE_IMAGE_OPACITY'] : 80;
$config['wm_overlay_path'] = FCPATH . 'omooo/statics/watermark/' . ($site['SITE_IMAGE_OVERLAY'] ? $site['SITE_IMAGE_OVERLAY'] : 'default.png');
$this->load->library('image_lib2', $config);
$this->image_lib2->resize($thumb_file);
if (isset($info['remote']) && $info['remote']) {
@unlink($file);
}
}