Exemplo n.º 1
0
 public function setting()
 {
     $data = array('id' => intval($this->user['id']), 'password' => trim($this->input['password']), 'password_again' => trim($this->input['password_again']), 'old_password' => trim($this->input['old_password']));
     if ($data['password'] && $data['password'] != $data['password_again']) {
         $this->ReportError('两次输入的密码不一样');
     }
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'update_password');
     foreach ($data as $key => $val) {
         $curl->addRequestData($key, $val);
     }
     if ($_FILES['Filedata']) {
         $curl->addFile($_FILES);
     }
     $return = $curl->request('member.php');
     if ($return && $return[0]) {
         if ($return[0]['error'] == -1) {
             $this->ReportError('原始密码错误');
         }
     }
     $this->redirect('更新成功');
 }
Exemplo n.º 2
0
 }
 public function __destruct()
 {
     parent::__destruct();
 }
 public function convert()
 {
     global $gGlobalConfig;
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     if ($gGlobalConfig['App_officeconvert']) {
         $curl = new curl($gGlobalConfig['App_officeconvert']['host'], $gGlobalConfig['App_officeconvert']['dir']);
     }
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('custom_appid', CUSTOM_APPID);
     $curl->addRequestData('custom_appkey', CUSTOM_APPKEY);
     $curl->addFile($_FILES);
     $result = $curl->request('convert.php');
     //var_dump($result);exit;
     $path = 'cache/word/zip_' . uniqid() . '/';
     $zipDir = ROOT_PATH . $path;
     $return = array();
     if (hg_mkdir($zipDir) && is_writeable($zipDir)) {
         $zipFile = $zipDir . 'word.zip';
         file_put_contents($zipFile, $result);
         $unzipDir = $zipDir . 'unzip/';
         if (hg_mkdir($unzipDir) && is_writeable($unzipDir)) {
             $unzipCmd = ' unzip ' . $zipFile . ' -d ' . realpath($unzipDir);
             exec($unzipCmd);
             $rmZip = ' rm -f ' . $zipFile;
             exec($rmZip);
Exemplo n.º 3
0
    }
    public function __destruct()
    {
        parent::__destruct();
    }
    /**
	 * 转换word文档
	 */
    public function convert()
    {
        $app_id = isset($this->input['custom_appid']) ? trim($this->input['custom_appid']) : '';
        $app_key = isset($this->input['custom_appkey']) ? trim($this->input['custom_appkey']) : '';
        if (empty($app_id) || empty($app_key)) {
            $this->errorOutput(PARAM_WRONG);
        }
        //先验证是否有权限
        $auth = new Auth();
        $auth_info = $auth->getAccessToken($app_id, $app_key);
        if (!$auth_info) {
            $this->errorOutput(NO_AUTH);
        }
        //处理上传的word文档
        $gGlobalConfig['officeconvert'] = array('host' => '10.0.1.59:8080', 'dir' => 'officeConverter/');
        $curl = new curl($gGlobalConfig['officeconvert']['host'], $gGlobalConfig['officeconvert']['dir']);
        $curl->setSubmitType('post');
        $curl->setReturnFormat('str');
        $curl->initPostData();
        $curl->addFile($_FILES);
        $curl->addRequestData('custom_appid', $app_id);
        $curl->addRequestData('custom_appkey', $app_key);
Exemplo n.º 4
0
 public function upload()
 {
     if ($_FILES['videofile']) {
         $this->errorOutput('没有视频文件');
     }
     if (!($server = $this->select_server())) {
         $this->errorOutput('服务器已经满,不能上传视频,请稍等片刻');
     }
     $curl = new curl($server['host'], $server['dir']);
     $curl->setSubmitType('post');
     $curl->initPostData();
     $curl->addFile($_FILES);
     $info = $curl->request('create.php');
 }
Exemplo n.º 5
0
 public function uploadToVideoServer($file, $title, $brief)
 {
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addFile($file);
     $curl->addRequestData('title', $title);
     $curl->addRequestData('comment', $brief);
     $curl->addRequestData('vod_leixing', 2);
     $ret = $curl->request('create.php');
     return $ret[0];
 }
Exemplo n.º 6
0
 /**
  *
  * @Description 视频上传
  */
 public function uploadToVideoServer($file, $title = '', $brief = '', $vod_lexing = 1)
 {
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addFile($file);
     $curl->addRequestData('title', $title);
     $curl->addRequestData('comment', $brief);
     $curl->addRequestData('vod_leixing', $vod_lexing);
     //网页传的视频类型是1,手机传的视频是2
     $curl->addRequestData('app_uniqueid', APP_UNIQUEID);
     $curl->addRequestData('mod_uniqueid', MOD_UNIQUEID);
     $ret = $curl->request('create.php');
     return $ret[0];
 }
Exemplo n.º 7
0
 public function updateAccount($data, $file = '', $id)
 {
     //查询帐户id
     $sql = 'SELECT account_id FROM ' . DB_PREFIX . 'reporter WHERE id=' . $id;
     $ret = $this->db->query_first($sql);
     $account_id = $ret['account_id'];
     if (!$account_id) {
         return false;
     }
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir'] . 'admin/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'update');
     if ($file) {
         $curl->addFile($file);
     }
     $curl->addRequestData('id', $account_id);
     $curl->addRequestData('user_name', $data['account']);
     $curl->addRequestData('password', $data['password']);
     $curl->addRequestData('brief', $data['brief']);
     if (is_array($data['role_id'])) {
         foreach ($data['role_id'] as $key => $val) {
             $curl->addRequestData('admin_role_id[' . $key . ']', $val);
         }
     } else {
         $curl->addRequestData('admin_role_id[]', $data['role_id']);
     }
     $curl->addRequestData('cardid', $data['card_id']);
     $curl->addRequestData('domain', $data['domain']);
     $ret = $curl->request('admin_update.php');
     return $ret[0];
 }
Exemplo n.º 8
0
 /**
  * 增加短信信息
  */
 public function create()
 {
     if (empty($this->input['send_phone']) || empty($this->input['send_time']) || empty($this->input['receive_phone'])) {
         $this->errorOutput(OBJECT_NULL);
     } else {
         $title = $this->input['title'] ? $this->input['title'] : "";
         $content = $this->input['content'] ? $this->input['content'] : "";
         $send_name = $this->input['send_name'] ? $this->input['send_name'] : "";
         $send_phone = $this->input['send_phone'];
         $receive_phone = $this->input['receive_phone'];
         $send_time = $this->input['send_time'] ? $this->input['send_time'] : time();
         $status = 0;
         $active = 1;
         $sort = 9999;
         $update_time = TIMENOW;
         $create_time = TIMENOW;
         $ip = hg_getip();
         $appid = $this->user['appid'];
         $appname = $this->user['display_name'];
         $user_id = $this->user['user_id'];
         $user_name = $this->user['user_name'];
         //数据入组
         $updateData = array();
         $updateData['title'] = $title;
         $updateData['content'] = $content;
         $updateData['send_phone'] = $send_phone;
         $updateData['send_name'] = $send_name;
         $updateData['receive_phone'] = $receive_phone;
         $updateData['send_time'] = (int) $send_time;
         $updateData['status'] = $status;
         $updateData['active'] = $active;
         $updateData['update_time'] = $update_time;
         $updateData['sort'] = $sort;
         $updateData['create_time'] = $create_time;
         $updateData['appid'] = $appid;
         $updateData['appname'] = $appname;
         $updateData['user_id'] = $user_id;
         $updateData['user_name'] = $user_name;
         $updateData['ip'] = $ip;
         $is_picture = $_FILES['picture']['name'] ? 1 : 0;
         $is_video = $_FILES['video']['name'] ? 1 : 0;
         $is_annex = $_FILES['annex']['name'] ? 1 : 0;
         if ($is_picture == 1 || $is_video == 1 || $is_annex == 1) {
             $cateid = 2;
         } else {
             $cateid = 1;
         }
         $updateData['is_picture'] = $is_picture;
         $updateData['is_video'] = $is_video;
         $updateData['is_annex'] = $is_annex;
         $updateData['cateid'] = $cateid;
         //数据存在
         if (!empty($updateData)) {
             $result = $this->messagereceived->create($updateData);
             $id = $result['id'];
             //创建数组 插入附件表
             $update_data = array();
             $update_data['sid'] = $id;
             //图片,附件的格式判断
             $material_type_files = ROOT_PATH . 'api/material/cache/material_type.cache.php';
             if (!file_exists($material_type_files)) {
                 $material_type = array('img' => array("jpg", "gif", "png", "bmp", "jpeg", "tif"), 'real' => array("swf"), 'doc' => array("txt", "zip", "doc", "docx"));
             } else {
                 $material_type = file_get_contents($material_type_files);
                 $material_type = unserialize($material_type);
             }
             //图片的处理
             if (is_array($_FILES['picture']['name'])) {
                 $pic_date = array();
                 foreach ($_FILES['picture'] as $key => $value) {
                     ${$key} = $value;
                     foreach (${$key} as $keyy => $valuee) {
                         $pic_date[$keyy][$key] = $valuee;
                     }
                 }
                 foreach ($pic_date as $key => $value) {
                     $pictypetmp = explode('.', $value['name']);
                     $picfiletype = strtolower($pictypetmp[count($pictypetmp) - 1]);
                     if (in_array($picfiletype, $material_type['img'])) {
                         $file_square['Filedata'] = $value;
                         $material_square = $this->mMaterial->addMaterial($file_square, $id);
                         $picture['host'] = $material_square['host'];
                         $picture['dir'] = $material_square['dir'];
                         $picture['filepath'] = $material_square['filepath'];
                         $picture['filename'] = $material_square['filename'];
                         $picture['typeid'] = 1;
                         $update_data = array_merge($update_data, $picture);
                         $resultfiles = $this->messagereceived->updatefiles($update_data);
                         unset($material_square);
                         unset($picture);
                     } else {
                         $this->errorOutput(IMGUPLOAD_W);
                     }
                 }
             }
             //附件的处理
             if (is_array($_FILES['annex']['name'])) {
                 $annex_date = array();
                 foreach ($_FILES['annex'] as $key => $value) {
                     ${$key} = $value;
                     foreach (${$key} as $keyy => $valuee) {
                         $annex_date[$keyy][$key] = $valuee;
                     }
                 }
                 foreach ($annex_date as $key => $value) {
                     $annextypetmp = explode('.', $value['name']);
                     $annexfiletype = strtolower($annextypetmp[count($annextypetmp) - 1]);
                     if (in_array($annexfiletype, $material_type['doc'])) {
                         $file_square['Filedata'] = $value;
                         $material_square = $this->mMaterial->addMaterial($file_square, $id);
                         $annex['host'] = $material_square['host'];
                         $annex['dir'] = $material_square['dir'];
                         $annex['filepath'] = $material_square['filepath'];
                         $annex['filename'] = $material_square['filename'];
                         $annex['typeid'] = 3;
                         $update_data = array_merge($update_data, $annex);
                         $resultfiles = $this->messagereceived->updatefiles($update_data);
                         unset($material_square);
                         unset($annex);
                     } else {
                         $this->errorOutput(IMGUPLOAD_D);
                     }
                 }
             }
             //视频的处理
             if ($_FILES['video']['name']) {
                 $_FILES['videofile'] = array();
                 $video_date = array();
                 foreach ($_FILES['video'] as $key => $value) {
                     ${$key} = $value;
                     foreach (${$key} as $keyy => $valuee) {
                         $video_date[$keyy][$key] = $valuee;
                     }
                 }
                 $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
                 if (!$curl) {
                     $this->errorOutput(MSERVER_LOST);
                 }
                 $curl->setSubmitType('post');
                 $curl->setReturnFormat('json');
                 $curl->initPostData();
                 $curl->addRequestData('vod_leixing', $this->settings['m_r_leiixng']['vod_leixing']);
                 foreach ($video_date as $key => $value) {
                     $_FILES['videofile'] = $value;
                     $curl->addFile($_FILES);
                     $result = $curl->request('create.php');
                     if (!$result) {
                         $this->errorOutput('上传失败');
                     } else {
                         //基础字段
                         $info = $result[0];
                         $video = array('host' => $info['protocol'], 'dir' => $info['host'], 'filepath' => $info['dir'], 'filename' => $info['file_name'], 'typeid' => 2);
                         //序列化字段
                         $video_back = array('vid' => $info['id'], 'type' => $info['type'], 'pic' => $info['img']['host'] . $info['img']['dir'] . $info['img']['filepath'] . $info['img']['filename']);
                         //返回数据传回数组
                         $update_data['backup'] = $video_back ? @serialize($video_back) : '';
                         $update_data = array_merge($update_data, $video);
                         $resultfiles = $this->messagereceived->updatefiles($update_data);
                         unset($video_back);
                         unset($video);
                     }
                     unset($result);
                 }
             }
         } else {
             $updateData = true;
         }
         $this->addItem($updateData);
         $this->output();
     }
 }
Exemplo n.º 9
0
 public function upload_video(&$files, $title)
 {
     $videos = array();
     if ($files['videofile']) {
         $max_size = ini_get('upload_max_filesize');
         if ($max_size) {
             if ($files['videofile']['size'] > $max_size * 1024 * 1024) {
                 return array('error' => '上传视频不能超过' . $max_size . 'M');
             }
         }
         if (!$this->settings['App_livmedia']) {
             return array('error' => 'NO_APP_LIVMEDIA');
         }
         $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
         $curl->setSubmitType('post');
         $curl->setReturnFormat('json');
         $curl->initPostData();
         $curl->addFile($files);
         $curl->addRequestData('title', $title);
         $curl->addRequestData('comment', '');
         $curl->addRequestData('vod_leixing', 2);
         $ret = $curl->request('create.php');
         isset($ret[0]) && ($ret = $ret[0]);
         if ($ret) {
             $ret['video_mp4'] = $ret['protocol'] . $ret['host'] . '/' . $ret['dir'] . $ret['file_name'] . '.' . $ret['type'];
             $ret['video_m3u8'] = $ret['protocol'] . $ret['host'] . '/' . $ret['dir'] . $ret['file_name'] . '.m3u8';
             $videos[] = $ret;
             $video_type = $_FILES['videofile']['type'];
             if (strstr($video_type, 'audio')) {
                 $videos['is_audio'] = 1;
                 $videos['upload_type'] = '音频';
             }
         } else {
             //return array('error' => 'VIDEO_UPLOAD_ERROR');
         }
         unset($files['videofile']);
     }
     return $videos;
 }
Exemplo n.º 10
0
 /**
  * 
  * @Description  系统用户更新
  * @author Kin
  * @date 2013-7-3 上午09:26:46
  */
 private function auth_update($id, $name, $password, $role, $org, $avatar = '')
 {
     if (!$id || !$name || !$role || !$org) {
         return false;
     }
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir'] . 'admin/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'register');
     $curl->addRequestData('app_uniqueid', APP_UNIQUEID);
     $curl->addRequestData('id', $id);
     $curl->addRequestData('user_name', $name);
     $curl->addRequestData('password', $password);
     $curl->addRequestData('admin_role_id', $role);
     $curl->addRequestData('father_org_id', $org);
     if ($avatar) {
         $curl->addFile($avatar);
     }
     $ret = $curl->request('admin_update.php');
     $ret = $ret[0];
     return $ret;
 }
Exemplo n.º 11
0
<?php

require 'global.php';
require ROOT_PATH . 'lib/class/curl.class.php';
$curl = new curl($gGlobalConfig['officeconvert']['host'], $gGlobalConfig['officeconvert']['dir']);
$curl->setSubmitType('post');
$curl->setReturnFormat('str');
$curl->initPostData();
//$curl->setCurlTimeOut(60 * 2);
$curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
$curl->addFile($_FILES);
$result = $curl->request('convert');
if (!$result) {
    echo json_encode(array('error' => true));
    exit;
}
$path = 'cache/word/zip_' . uniqid() . '/';
$zipDir = ROOT_PATH . $path;
if (hg_mkdir($zipDir) && is_writeable($zipDir)) {
    $zipFile = $zipDir . 'word.zip';
    file_put_contents($zipFile, $result);
    $unzipDir = $zipDir . 'unzip/';
    if (hg_mkdir($unzipDir) && is_writeable($unzipDir)) {
        $unzipCmd = ' unzip ' . $zipFile . ' -d ' . realpath($unzipDir);
        exec($unzipCmd);
        $rmZip = ' rm -f ' . $zipFile;
        exec($rmZip);
        echo json_encode(array('ok' => 1, 'path' => $path . 'unzip/', 'url' => $path . 'unzip/index.html'));
        exit;
    }
}
Exemplo n.º 12
0
 /**
  * 创建视频
  * @param Array $data 相关属性
  * @param Array $file 视频文件
  */
 public function create($data, $file)
 {
     global $gGlobalConfig;
     $curl = new curl($gGlobalConfig['App_mediaserver']['host'], $gGlobalConfig['App_mediaserver']['dir'] . 'admin/');
     if (!$curl) {
         return array();
     }
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     if ($data && is_array($data)) {
         foreach ($data as $k => $v) {
             $curl->addRequestData($k, $v);
         }
     }
     $curl->addFile($file);
     $ret = $curl->request('create.php');
     return $ret[0];
 }
Exemplo n.º 13
0
 /**
  * 上传视频操作
  */
 public function upload_video()
 {
     $config = array('protocol' => 'http://', 'host' => 'vapi1.dev.hogesoft.com:233', 'dir' => '', 'token' => 'aldkj12321aasd', 'port' => '');
     $curl = new curl($config['host'], $config['dir']);
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addFile($_FILES);
     $result = $curl->request('create.php');
     if (!$result) {
         $out = json_encode(array('error' => 1, 'msg' => '上传失败'));
     } else {
         //本地化视频到数据库中
         $info = $result[0];
         $img = $info['img']['host'] . '/' . $info['img']['dir'] . $info['img']['filepath'] . $info['img']['filename'];
         $url = $info['protocol'] . $info['host'] . $info['dir'] . $info['file_name'] . '.' . $info['type'];
         $addInfo = array('vid' => $info['id'], 'img' => $img, 'url' => $url, 'type' => 2, 'a' => 'addVideo');
         $video = $this->status->localData($addInfo);
         if (!$video) {
             $out = json_encode(array('error' => 1, 'msg' => '上传失败'));
         } else {
             $out = json_encode($video);
         }
     }
     echo '<script type="text/javascript">parent.video_callback(' . $out . ');</script>';
 }
Exemplo n.º 14
0
 function update_userinfo()
 {
     $data = array('id' => intval($this->user['user_id']), 'password' => trim($this->input['password']), 'password_again' => trim($this->input['password_again']), 'old_password' => trim($this->input['old_password']));
     if (!$data['old_password']) {
         //$this->errorOutput("请输入原始密码");
         unset($data['old_password']);
     }
     if (!$data['password']) {
         //$this->errorOutput("新密码不可以为空");
         unset($data['password']);
         unset($data['password_again']);
     }
     if ($data['old_password'] && !$data['password']) {
         $this->errorOutput("新密码不可以为空");
     }
     if ($data['password'] && $data['password'] != $data['password_again']) {
         $this->errorOutput('两次输入的密码不一样');
     }
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'update_password');
     foreach ($data as $key => $val) {
         $curl->addRequestData($key, $val);
     }
     if ($_FILES['Filedata']) {
         $curl->addFile($_FILES);
     }
     $return = $curl->request('member.php');
     if ($return && $return[0]) {
         if ($return[0]['error'] == -1) {
             $this->errorOutput('原始密码错误');
         }
     }
     $this->addLogs('更新用户资料', null, null, $this->user['user_name']);
     $this->addItem($return[0]);
     $this->output();
 }
Exemplo n.º 15
0
 function get_video_id($file)
 {
     foreach ($file['Filedata'] as $k => $v) {
         $video['videofile'][$k] = $file['Filedata'][$k];
     }
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addFile($video);
     $curl->addRequestData('vod_leixing', 1);
     $ret = $curl->request('create.php');
     return $ret[0];
 }