示例#1
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $user_data = $GLOBALS['user_info'];
     if (intval($user_data['id']) == 0) {
         $root['return'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     if (isset($_FILES['image_1'])) {
         //开始上传
         //创建avatar临时目录
         if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
             @mkdir(APP_ROOT_PATH . "public/avatar");
             @chmod(APP_ROOT_PATH . "public/avatar", 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
             @mkdir(APP_ROOT_PATH . "public/avatar/temp");
             @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
         }
         $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
         //开始移动图片到相应位置
         $id = intval($user_data['id']);
         $uid = sprintf("%09d", $id);
         $dir1 = substr($uid, 0, 3);
         $dir2 = substr($uid, 3, 2);
         $dir3 = substr($uid, 5, 2);
         $path = $dir1 . '/' . $dir2 . '/' . $dir3;
         //创建相应的目录
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
         }
         $id = str_pad($id, 2, "0", STR_PAD_LEFT);
         $id = substr($id, -2);
         $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
         $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
         $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
         @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
         @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
         @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
         @unlink($img_result['image_1']['thumb']['big']['path']);
         @unlink($img_result['image_1']['thumb']['middle']['path']);
         @unlink($img_result['image_1']['thumb']['small']['path']);
         @unlink($img_result['image_1']['path']);
         //end 上传
     }
     $root['return'] = 1;
     $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     output($root);
 }
 public function index()
 {
     $email = addslashes($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = addslashes($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user_info = user_check($email, $pwd);
     $user_id = intval($user_info['id']);
     if (!$user_info) {
         $root['status'] = 0;
         $root['message'] = "用户已失效,无法上传";
         output($root);
     } else {
         //上传
         $content = addslashes(htmlspecialchars(trim($GLOBALS['request']['content'])));
         if ($content == '') {
             $root['status'] = 0;
             $root['message'] = "发布内容不能为空";
             output($root);
         }
         $dir = "u_" . to_date(get_gmtime(), "Ym");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         $img_result = save_image_upload($_FILES, 'image_1', 'attachment/' . $dir, array('origin' => array(0, 0, 0, 0)), 0, 1);
         if (intval($img_result['error']) != 0) {
             $root['status'] = 0;
             $root['message'] = "图片上传失败:" . $img_result['message'];
             output($root);
         }
         $image_1 = $img_result['image_1']['url'];
         $youhui['user_id'] = $user_id;
         $youhui['icon'] = $image_1;
         $youhui['image'] = $image_1;
         $youhui['is_effect'] = 0;
         $youhui['name'] = $content;
         $youhui['content'] = $content;
         $youhui['create_time'] = get_gmtime();
         $youhui['pub_by'] = 1;
         $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui", $youhui, 'INSERT');
         $id = $GLOBALS['db']->insert_id();
         if ($id) {
             $root['status'] = 1;
             $root['message'] = "发布信息成功";
             output($root);
         } else {
             $root['status'] = 0;
             $root['message'] = "发布信息失败,请稍候再发";
             output($root);
         }
         //上传
     }
 }
示例#3
0
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "d");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "H");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
    $img_result = save_image_upload($_FILES, "identify_business_licence", "attachment/" . $dir, $whs = array('thumb' => array(205, 160, 1, 0)), 1, 1);
} else {
    $img_result = save_image_upload($_FILES, "identify_business_licence", "attachment/" . $dir, $whs = array('thumb' => array(205, 160, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
    $data['status'] = 0;
    //未登录
    $data['msg'] = $img_result['message'];
    ajax_return($data);
} else {
    if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
        $paths = pathinfo($img_result['imgFile']['url']);
        $path = str_replace("./", "", $paths['dirname']);
        $filename = $paths['basename'];
        $pathwithoupublic = str_replace("public/", "", $path);
        $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
        @file_get_contents($syn_url);
    }
示例#4
0
 public function upload()
 {
     if ($GLOBALS['user_info']['id'] == 0) {
         $data['status'] = 0;
         //未登录
         $data['msg'] = "请先登录";
         ajax_return($data);
     }
     //上传处理
     //创建avatar临时目录
     if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
         @mkdir(APP_ROOT_PATH . "public/avatar");
         @chmod(APP_ROOT_PATH . "public/avatar", 0777);
     }
     if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
         @mkdir(APP_ROOT_PATH . "public/avatar/temp");
         @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
     }
     $upd_id = $id = intval($_REQUEST['uid']);
     if (is_animated_gif($_FILES['avatar_file']['tmp_name'])) {
         $rs = save_image_upload($_FILES, "avatar_file", "avatar/temp", $whs = array());
         $im = get_spec_gif_anmation($rs['avatar_file']['path'], 48, 48);
         $file_name = APP_ROOT_PATH . "public/avatar/temp/" . md5(NOW_TIME . $upd_id) . "_small.jpg";
         file_put_contents($file_name, $im);
         $img_result['avatar_file']['thumb']['small']['path'] = $file_name;
         $im = get_spec_gif_anmation($rs['avatar_file']['path'], 120, 120);
         $file_name = APP_ROOT_PATH . "public/avatar/temp/" . md5(NOW_TIME . $upd_id) . "_middle.jpg";
         file_put_contents($file_name, $im);
         $img_result['avatar_file']['thumb']['middle']['path'] = $file_name;
         $im = get_spec_gif_anmation($rs['avatar_file']['path'], 200, 200);
         $file_name = APP_ROOT_PATH . "public/avatar/temp/" . md5(NOW_TIME . $upd_id) . "_big.jpg";
         file_put_contents($file_name, $im);
         $img_result['avatar_file']['thumb']['big']['path'] = $file_name;
     } else {
         $img_result = save_image_upload($_FILES, "avatar_file", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
     }
     //开始移动图片到相应位置
     $uid = sprintf("%09d", $id);
     $dir1 = substr($uid, 0, 3);
     $dir2 = substr($uid, 3, 2);
     $dir3 = substr($uid, 5, 2);
     $path = $dir1 . '/' . $dir2 . '/' . $dir3;
     //创建相应的目录
     if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
         @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
         @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
     }
     if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
         @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
         @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
     }
     if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
         @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
         @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
     }
     $id = str_pad($id, 2, "0", STR_PAD_LEFT);
     $id = substr($id, -2);
     $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
     $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
     $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
     @file_put_contents($avatar_file_big, file_get_contents($img_result['avatar_file']['thumb']['big']['path']));
     @file_put_contents($avatar_file_middle, file_get_contents($img_result['avatar_file']['thumb']['middle']['path']));
     @file_put_contents($avatar_file_small, file_get_contents($img_result['avatar_file']['thumb']['small']['path']));
     @unlink($img_result['avatar_file']['thumb']['big']['path']);
     @unlink($img_result['avatar_file']['thumb']['middle']['path']);
     @unlink($img_result['avatar_file']['thumb']['small']['path']);
     @unlink($img_result['avatar_file']['path']);
     //上传成功更新用户头像的动态缓存
     update_avatar($upd_id);
     $data['status'] = 1;
     $data['small_url'] = get_user_avatar($upd_id, "small");
     $data['middle_url'] = get_user_avatar($upd_id, "middle");
     $data['big_url'] = get_user_avatar($upd_id, "big");
     ajax_return($data);
 }
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         $root['response_code'] = 1;
         if (!check_ipop_limit(get_client_ip(), "setting_save_index", 5)) {
             $root['show_err'] = "提交太频繁";
         }
         require_once APP_ROOT_PATH . "system/libs/user.php";
         $user_data = array();
         $user_data['province'] = strim($_REQUEST['province']);
         $user_data['city'] = strim($_REQUEST['city']);
         $user_data['sex'] = intval($_REQUEST['sex']);
         $user_data['intro'] = strim($_REQUEST['intro']);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $user_data, "UPDATE", "id=" . intval($GLOBALS['user_info']['id']));
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "user_weibo where user_id = " . intval($GLOBALS['user_info']['id']));
         $weibo_data = array();
         $weibo_data['user_id'] = intval($GLOBALS['user_info']['id']);
         $weibo_data['weibo_url'] = strim($_REQUEST['weibo_url']);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_weibo", $weibo_data);
         //$root['image'] =$GLOBALS['m_config']['page_size'];
         //	showSuccess("资料保存成功",$ajax,url('settings#index'));
         //			file_put_contents(APP_ROOT_PATH."public/test.txt", print_r($_FILES, 1));
         if (isset($_FILES['image_1'])) {
             //开始上传
             //创建avatar临时目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar");
                 @chmod(APP_ROOT_PATH . "public/avatar", 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/temp");
                 @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
             }
             $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
             //开始移动图片到相应位置
             $id = intval($user['id']);
             $uid = sprintf("%09d", $id);
             $dir1 = substr($uid, 0, 3);
             $dir2 = substr($uid, 3, 2);
             $dir3 = substr($uid, 5, 2);
             $path = $dir1 . '/' . $dir2 . '/' . $dir3;
             //创建相应的目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
             }
             $id = str_pad($id, 2, "0", STR_PAD_LEFT);
             $id = substr($id, -2);
             $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
             $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
             $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
             //	file_put_contents(APP_ROOT_PATH."public/test1.txt", print_r($avatar_file_small, 1));
             @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
             @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
             @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
             @unlink($img_result['image_1']['thumb']['big']['path']);
             @unlink($img_result['image_1']['thumb']['middle']['path']);
             @unlink($img_result['image_1']['thumb']['small']['path']);
             @unlink($img_result['image_1']['path']);
             //end 上传
         }
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
         $root['info'] = "资料保存成功";
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
示例#6
0
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "d");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "H");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
    $img_result = save_image_upload($_FILES, "image_file", "attachment/" . $dir, $whs = array('thumb' => array(50, 50, 1, 0)), 1, 1);
} else {
    $img_result = save_image_upload($_FILES, "image_file", "attachment/" . $dir, $whs = array('thumb' => array(50, 50, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
    $data['status'] = 0;
    //未登录
    $data['msg'] = $img_result['message'];
    ajax_return($data);
} else {
    if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
        $paths = pathinfo($img_result['imgFile']['url']);
        $path = str_replace("./", "", $paths['dirname']);
        $filename = $paths['basename'];
        $pathwithoupublic = str_replace("public/", "", $path);
        $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
        @file_get_contents($syn_url);
    }
示例#7
0
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "d");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "H");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
    $img_result = save_image_upload($_FILES, "idcard_fang", "attachment/" . $dir, $whs = array('thumb' => array(205, 160, 1, 0)), 1, 1);
} else {
    $img_result = save_image_upload($_FILES, "idcard_fang", "attachment/" . $dir, $whs = array('thumb' => array(205, 160, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
    $data['status'] = 0;
    //未登录
    $data['msg'] = $img_result['message'];
    ajax_return($data);
} else {
    if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
        $paths = pathinfo($img_result['imgFile']['url']);
        $path = str_replace("./", "", $paths['dirname']);
        $filename = $paths['basename'];
        $pathwithoupublic = str_replace("public/", "", $path);
        $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
        @file_get_contents($syn_url);
    }
 public function step4()
 {
     check_issupplier();
     $user_id = intval($GLOBALS['user_info']['id']);
     if ($user_id == 0) {
         app_redirect(url("shop", "user#login"));
     }
     //		print_r( unserialize(base64_decode($_REQUEST['base_data'])));exit;
     //上传处理
     //创建attachment目录
     if ($_POST) {
         if (!is_dir(APP_ROOT_PATH . "public/attachment")) {
             @mkdir(APP_ROOT_PATH . "public/attachment");
             @chmod(APP_ROOT_PATH . "public/attachment", 0777);
         }
         $dir = to_date(get_gmtime(), "Ym");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "d");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "H");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         if ($_FILES['h_license']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_license", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "营业执照图片" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_license']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_license'] = $image_res['h_license']['url'];
             }
         } else {
             $messages[] = "营业执照必需上传";
         }
         if ($_FILES['h_other_license']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_other_license", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "其他资质图片" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_other_license']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_other_license'] = $image_res['h_other_license']['url'];
             }
         }
         if ($_FILES['h_supplier_logo']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_supplier_logo", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "商家logo" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_supplier_logo']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_supplier_logo'] = $image_res['h_supplier_logo']['url'];
             }
         }
         if ($_FILES['h_supplier_image']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_supplier_image", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "门店图片" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_supplier_image']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_supplier_image'] = $image_res['h_supplier_image']['url'];
             }
         }
         if (count($messages) == 0) {
             $base_data = unserialize(base64_decode($_REQUEST['base_data']));
             $save_data['name'] = $base_data['name'];
             $save_data['cate_config'] = serialize(array('deal_cate_id' => $base_data['deal_cate_id'], 'deal_cate_type_id' => $base_data['deal_cate_type_id']));
             $save_data['location_config'] = serialize($base_data['area_id']);
             $save_data['address'] = $base_data['address'];
             $save_data['tel'] = $base_data['tel'];
             $save_data['open_time'] = $base_data['open_time'];
             $save_data['xpoint'] = $base_data['xpoint'];
             $save_data['ypoint'] = $base_data['ypoint'];
             $save_data['location_id'] = $base_data['location_id'];
             $save_data['city_id'] = $base_data['city_id'];
             $save_data['user_id'] = $user_id;
             $save_data['create_time'] = get_gmtime();
             $save_data['h_name'] = addslashes(htmlspecialchars(trim($_REQUEST['h_name'])));
             $save_data['h_faren'] = addslashes(htmlspecialchars(trim($_REQUEST['h_faren'])));
             $save_data['h_user_name'] = addslashes(htmlspecialchars(trim($_REQUEST['h_user_name'])));
             $save_data['h_tel'] = addslashes(htmlspecialchars(trim($_REQUEST['h_tel'])));
             $save_data['h_bank_info'] = addslashes(htmlspecialchars(trim($_REQUEST['h_bank_info'])));
             $save_data['h_bank_name'] = addslashes(htmlspecialchars(trim($_REQUEST['h_bank_name'])));
             $save_data['h_bank_user'] = addslashes(htmlspecialchars(trim($_REQUEST['h_bank_user'])));
             if ($save_data['h_name'] == '') {
                 $messages[] = "请填写企业名称";
             }
             if ($save_data['h_faren'] == '') {
                 $messages[] = "请填写法人姓名";
             }
             if ($save_data['h_bank_info'] == '') {
                 $messages[] = "请填写开户行帐号";
             }
             if ($save_data['h_bank_name'] == '') {
                 $messages[] = "请填写开户行名称";
             }
             if ($save_data['h_bank_user'] == '') {
                 $messages[] = "请填写开户行户名";
             }
             if (count($messages) == 0) {
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_submit", $save_data);
                 app_redirect(url("biz", "join#step4"));
             } else {
                 $GLOBALS['tmpl']->assign("error_messages", $messages);
             }
         } else {
             $GLOBALS['tmpl']->assign("error_messages", $messages);
         }
     }
     $GLOBALS['tmpl']->assign("step", 4);
     $GLOBALS['tmpl']->assign("page_title", "完成");
     $GLOBALS['tmpl']->display("biz/biz_join_step4.html");
     //		print_r($_REQUEST);
     //		print_r( unserialize(base64_decode($_REQUEST['base_data'])));
 }
示例#9
0
    @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(TIME_UTC, "d");
if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(TIME_UTC, "H");
if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
    $img_result = save_image_upload($_FILES, "topic_image", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 1, 1);
} else {
    $img_result = save_image_upload($_FILES, "topic_image", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
    ajax_return($img_result);
} else {
    if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
        $paths = pathinfo($img_result['topic_image']['url']);
        $path = str_replace("./", "", $paths['dirname']);
        $filename = $paths['basename'];
        $pathwithoupublic = str_replace("public/", "", $path);
        $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . SITE_DOMAIN . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
        @file_get_contents($syn_url);
    }
}
$data['error'] = 0;
$data['message'] = $img_result['topic_image']['thumb']['thumb']['url'];
示例#10
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $content = strim($GLOBALS['request']['content']);
     $source = strim($GLOBALS['request']['source']);
     $source = str_replace("来自", "", $source);
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     $user_data['id'] = intval($user_data['id']);
     if (intval($user_data['id']) == 0) {
         $root['return'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     if (isset($_FILES['image_1'])) {
         //开始上传
         //上传处理
         //创建comment目录
         if (!is_dir(APP_ROOT_PATH . "public/comment")) {
             @mkdir(APP_ROOT_PATH . "public/comment");
             @chmod(APP_ROOT_PATH . "public/comment", 0777);
         }
         $dir = to_date(get_gmtime(), "Ym");
         if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "d");
         if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "H");
         if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
         }
         if (app_conf("IS_WATER_MARK") == 1) {
             $img_result = save_image_upload($_FILES, "image_1", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 1, 1);
         } else {
             $img_result = save_image_upload($_FILES, "image_1", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 0, 1);
         }
         if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
             $paths = pathinfo($img_result['topic_image']['url']);
             $path = str_replace("./", "", $paths['dirname']);
             $filename = $paths['basename'];
             $pathwithoupublic = str_replace("public/", "", $path);
             $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
             @file_get_contents($syn_url);
         }
         require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
         $image = new es_imagecls();
         $info = $image->getImageInfo($img_result['image_1']['path']);
         $image_data['width'] = intval($info[0]);
         $image_data['height'] = intval($info[1]);
         $image_data['name'] = valid_str($_FILES['image_1']['name']);
         $image_data['filesize'] = filesize($img_result['image_1']['path']);
         $image_data['create_time'] = get_gmtime();
         $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
         $image_data['user_name'] = addslashes($GLOBALS['user_info']['user_name']);
         $image_data['path'] = $img_result['image_1']['thumb']['thumb']['url'];
         $image_data['o_path'] = $img_result['image_1']['url'];
         $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
         $image_id = intval($GLOBALS['db']->insert_id());
         //end 上传
     }
     if ($image_id > 0) {
         $attach_list = array(array("id" => $image_id, "type" => "image"));
     } else {
         $attach_list = array();
     }
     $id = insert_topic(valid_str($content), $title = "", $type = "", $group = "", $relay_id = 0, $fav_id = 0, $group_data = array(), $attach_list);
     if ($id) {
         increase_user_active($user_data['id'], "发表了一则分享");
         $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($id));
     }
     $syn_data['content'] = $content;
     //$syn_data['img'] = get_abs_img_root($GLOBALS['db']->getOne("select o_path from ".DB_PREFIX."topic_image where id = ".intval($image_id)));
     $syn_data['img'] = $GLOBALS['db']->getOne("select o_path from " . DB_PREFIX . "topic_image where id = " . intval($image_id));
     if ($syn_data['img']) {
         $syn_data['img'] = APP_ROOT_PATH . $syn_data['img'];
     }
     //开始同步
     if (intval($GLOBALS['request']['is_syn_sina'])) {
         //$GLOBALS['db']->query("update ".DB_PREFIX."user set is_syn_sina = 1 where id = ".intval($user_data['id']));
         //$func_name = strim($GLOBALS['request']['type'])."_Sina";
         //$result_sina = $func_name($syn_data);
         $result_sina = Sina($syn_data);
         $ext_info = "";
         if (!$result_sina['status']) {
             if (intval($result_sina['code']) == 21316 || intval($result_sina['code']) == 21317) {
                 $ext_info .= " 请先绑定新浪微博";
             }
             if (intval($result_sina['code']) == 21314 || intval($result_sina['code']) == 21315) {
                 $ext_info .= " 新浪微博授权过期";
             }
         }
     }
     if (intval($GLOBALS['request']['is_syn_tencent'])) {
         //$GLOBALS['db']->query("update ".DB_PREFIX."user set is_syn_tencent = 1 where id = ".intval($user_data['id']));
         //			$func_name = strim($GLOBALS['request']['type'])."_Tencent";
         //			$result_tencent = $func_name($syn_data);
         $result_tencent = Tencent($syn_data);
         if (!$result_tencent['status']) {
             if (intval($result_tencent['code']) == 0) {
                 $ext_info .= " 请先绑定腾讯微博";
             }
             if (intval($result_tencent['code']) == 14) {
                 $ext_info .= " 腾讯微博未实名认证";
             }
             if (intval($result_tencent['code']) == 10017 || intval($result_tencent['code']) == 10018 || intval($result_tencent['code']) == 10019 || intval($result_tencent['code']) == 36 || intval($result_tencent['code']) == 37 || intval($result_tencent['code']) == 38) {
                 $ext_info .= " 腾讯微博授权过期";
             }
         }
     }
     $root['return'] = 1;
     $root['status'] = 1;
     $root['info'] = "发布成功" . $ext_info;
     output($root);
 }
示例#11
0
 /**
  * 用户注册免登录调用上传
  */
 public function user_register_upload()
 {
     //上传处理
     //创建comment目录
     if (!is_dir(APP_ROOT_PATH . "public/attachment")) {
         @mkdir(APP_ROOT_PATH . "public/attachment");
         @chmod(APP_ROOT_PATH . "public/attachment", 0777);
     }
     $dir = to_date(NOW_TIME, "Ym");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     $dir = $dir . "/" . to_date(NOW_TIME, "d");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     $dir = $dir . "/" . to_date(NOW_TIME, "H");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     if (app_conf("IS_WATER_MARK") == 1) {
         $img_result = save_image_upload($_FILES, "file", "attachment/" . $dir, $whs = array(), 1, 1);
     } else {
         $img_result = save_image_upload($_FILES, "file", "attachment/" . $dir, $whs = array(), 0, 1);
     }
     if (intval($img_result['error']) != 0) {
         ajax_return($img_result);
     } else {
         if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
             syn_to_remote_image_server($img_result['file']['url']);
         }
     }
     $data_result['error'] = 0;
     $data_result['url'] = $img_result['file']['url'];
     $data_result['small_url'] = get_spec_image($data_result['url'], 88, 75, 1);
     $data_result['big_url'] = get_spec_image($data_result['url'], 600, 400);
     $data_result['path'] = $img_result['file']['path'];
     $data_result['name'] = $img_result['file']['name'];
     ajax_return($data_result);
 }
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         if (isset($_FILES['image_1'])) {
             //开始上传
             //创建avatar临时目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar");
                 @chmod(APP_ROOT_PATH . "public/avatar", 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/temp");
                 @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
             }
             $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
             //开始移动图片到相应位置
             $id = intval($user_data['id']);
             $uid = sprintf("%09d", $id);
             $dir1 = substr($uid, 0, 3);
             $dir2 = substr($uid, 3, 2);
             $dir3 = substr($uid, 5, 2);
             $path = $dir1 . '/' . $dir2 . '/' . $dir3;
             //创建相应的目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
             }
             $id = str_pad($id, 2, "0", STR_PAD_LEFT);
             $id = substr($id, -2);
             $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
             $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
             $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
             @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
             @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
             @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
             @unlink($img_result['image_1']['thumb']['big']['path']);
             @unlink($img_result['image_1']['thumb']['middle']['path']);
             @unlink($img_result['image_1']['thumb']['small']['path']);
             @unlink($img_result['image_1']['path']);
             //end 上传
         }
         $root['response_code'] = 1;
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
示例#13
0
文件: functions.php 项目: macall/jsd
/**
 * 分享点评的上传,上传到comment目录,按日期划分
 * 错误返回 error!=0,message错误消息
 * 正确时返回 error=0, url: ./public格式的文件相对路径  path:物理路径 name:文件名
 * thumb->preview 60x60的小图 url,path
 */
function upload_topic($_files)
{
    //上传处理
    //创建comment目录
    if (!is_dir(APP_ROOT_PATH . "public/comment")) {
        @mkdir(APP_ROOT_PATH . "public/comment");
        @chmod(APP_ROOT_PATH . "public/comment", 0777);
    }
    $dir = to_date(NOW_TIME, "Ym");
    if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
        @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
        @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
    }
    $dir = $dir . "/" . to_date(NOW_TIME, "d");
    if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
        @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
        @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
    }
    $dir = $dir . "/" . to_date(NOW_TIME, "H");
    if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
        @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
        @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
    }
    if (app_conf("IS_WATER_MARK") == 1) {
        $img_result = save_image_upload($_files, "file", "comment/" . $dir, $whs = array('preview' => array(60, 60, 1, 0)), 1, 1);
    } else {
        $img_result = save_image_upload($_files, "file", "comment/" . $dir, $whs = array('preview' => array(60, 60, 1, 0)), 0, 1);
    }
    if (intval($img_result['error']) != 0) {
        return $img_result;
    } else {
        if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
            syn_to_remote_image_server($img_result['file']['url']);
            syn_to_remote_image_server($img_result['file']['thumb']['preview']['url']);
        }
    }
    $data_result['error'] = 0;
    $data_result['url'] = $img_result['file']['url'];
    $data_result['path'] = $img_result['file']['path'];
    $data_result['name'] = $img_result['file']['name'];
    $data_result['thumb'] = $img_result['file']['thumb'];
    require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
    $image = new es_imagecls();
    $info = $image->getImageInfo($img_result['file']['path']);
    $image_data['width'] = intval($info[0]);
    $image_data['height'] = intval($info[1]);
    $image_data['name'] = valid_str($_FILES['file']['name']);
    $image_data['filesize'] = filesize($img_result['file']['path']);
    $image_data['create_time'] = NOW_TIME;
    $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
    $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
    $image_data['path'] = $img_result['file']['thumb']['preview']['url'];
    $image_data['o_path'] = $img_result['file']['url'];
    $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
    $data_result['id'] = intval($GLOBALS['db']->insert_id());
    return $data_result;
}