示例#1
0
 /**
  * 分享点评的上传,上传到comment目录,按日期划分
  * 错误返回 error!=0,message错误消息, error=1000表示未登录
  * 正确时返回 error=0, url: ./public格式的文件相对路径  path:物理路径 name:文件名
  * thumb->preview 100x100的小图 url,path
  */
 public function upload_topic()
 {
     global_run();
     if (empty($GLOBALS['user_info'])) {
         $data['error'] = 1000;
         //未登录
         $data['msg'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST'];
         ajax_return($data);
     }
     //上传处理
     //创建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(50, 50, 1, 0)), 1, 1);
     } else {
         $img_result = save_image_upload($_FILES, "file", "comment/" . $dir, $whs = array('preview' => array(50, 50, 1, 0)), 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']);
             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());
     ajax_return($data_result);
 }
示例#2
0
 public function water($source, $water, $alpha = 80, $position = "0")
 {
     //检查文件是否存在
     if (!file_exists($source) || !file_exists($water)) {
         return false;
     }
     //图片信息
     $sInfo = es_imagecls::getImageInfo($source);
     $wInfo = es_imagecls::getImageInfo($water);
     //如果图片小于水印图片,不生成图片
     if ($sInfo["0"] < $wInfo["0"] || $sInfo['1'] < $wInfo['1']) {
         return false;
     }
     if (is_animated_gif($source)) {
         require_once APP_ROOT_PATH . "system/utils/gif_encoder.php";
         require_once APP_ROOT_PATH . "system/utils/gif_reader.php";
         $gif = new GIFReader();
         $gif->load($source);
         foreach ($gif->IMGS['frames'] as $k => $img) {
             $im = imagecreatefromstring($gif->getgif($k));
             //为im加水印
             $sImage = $im;
             $wCreateFun = "imagecreatefrom" . $wInfo['type'];
             if (!function_exists($wCreateFun)) {
                 $wCreateFun = 'imagecreatefromjpeg';
             }
             $wImage = $wCreateFun($water);
             //设定图像的混色模式
             imagealphablending($wImage, true);
             switch (intval($position)) {
                 case 0:
                     break;
                     //左上
                 //左上
                 case 1:
                     $posY = 0;
                     $posX = 0;
                     //生成混合图像
                     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
                     break;
                     //右上
                 //右上
                 case 2:
                     $posY = 0;
                     $posX = $sInfo[0] - $wInfo[0];
                     //生成混合图像
                     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
                     break;
                     //左下
                 //左下
                 case 3:
                     $posY = $sInfo[1] - $wInfo[1];
                     $posX = 0;
                     //生成混合图像
                     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
                     break;
                     //右下
                 //右下
                 case 4:
                     $posY = $sInfo[1] - $wInfo[1];
                     $posX = $sInfo[0] - $wInfo[0];
                     //生成混合图像
                     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
                     break;
                     //居中
                 //居中
                 case 5:
                     $posY = $sInfo[1] / 2 - $wInfo[1] / 2;
                     $posX = $sInfo[0] / 2 - $wInfo[0] / 2;
                     //生成混合图像
                     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
                     break;
             }
             //end im加水印
             ob_start();
             imagegif($sImage);
             $content = ob_get_contents();
             ob_end_clean();
             $frames[] = $content;
             $framed[] = $img['frameDelay'];
         }
         $gif_maker = new GIFEncoder($frames, $framed, 0, 2, 0, 0, 0, "bin");
         $image_rs = $gif_maker->GetAnimation();
         //如果没有给出保存文件名,默认为原图像名
         @unlink($source);
         //保存图像
         file_put_contents($source, $image_rs);
         return true;
     }
     //建立图像
     $sCreateFun = "imagecreatefrom" . $sInfo['type'];
     if (!function_exists($sCreateFun)) {
         $sCreateFun = 'imagecreatefromjpeg';
     }
     $sImage = $sCreateFun($source);
     $wCreateFun = "imagecreatefrom" . $wInfo['type'];
     if (!function_exists($wCreateFun)) {
         $wCreateFun = 'imagecreatefromjpeg';
     }
     $wImage = $wCreateFun($water);
     //设定图像的混色模式
     imagealphablending($wImage, true);
     switch (intval($position)) {
         case 0:
             break;
             //左上
         //左上
         case 1:
             $posY = 0;
             $posX = 0;
             //生成混合图像
             imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
             break;
             //右上
         //右上
         case 2:
             $posY = 0;
             $posX = $sInfo[0] - $wInfo[0];
             //生成混合图像
             imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
             break;
             //左下
         //左下
         case 3:
             $posY = $sInfo[1] - $wInfo[1];
             $posX = 0;
             //生成混合图像
             imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
             break;
             //右下
         //右下
         case 4:
             $posY = $sInfo[1] - $wInfo[1];
             $posX = $sInfo[0] - $wInfo[0];
             //生成混合图像
             imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
             break;
             //居中
         //居中
         case 5:
             $posY = $sInfo[1] / 2 - $wInfo[1] / 2;
             $posX = $sInfo[0] / 2 - $wInfo[0] / 2;
             //生成混合图像
             imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo[0], $wInfo[1], $alpha);
             break;
     }
     //如果没有给出保存文件名,默认为原图像名
     @unlink($source);
     //保存图像
     imagejpeg($sImage, $source, 100);
     imagedestroy($sImage);
 }
示例#3
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);
 }
示例#4
0
}
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'];
$data['name'] = valid_str($_FILES['topic_image']['name']);
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$image = new es_imagecls();
$info = $image->getImageInfo($img_result['topic_image']['path']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = valid_str($_FILES['topic_image']['name']);
$image_data['filesize'] = filesize($img_result['topic_image']['path']);
$image_data['create_time'] = TIME_UTC;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = addslashes($GLOBALS['user_info']['user_name']);
$image_data['path'] = $img_result['topic_image']['thumb']['thumb']['url'];
$image_data['o_path'] = $img_result['topic_image']['url'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$data['id'] = intval($GLOBALS['db']->insert_id());
ajax_return($data);
示例#5
0
 public function save()
 {
     global_run();
     if (empty($GLOBALS['user_info'])) {
         $data['status'] = -1;
         $data['info'] = "";
         ajax_return($data);
     }
     require_once APP_ROOT_PATH . "system/model/review.php";
     $deal_id = intval($_REQUEST['deal_id']);
     $youhui_id = intval($_REQUEST['youhui_id']);
     $event_id = intval($_REQUEST['event_id']);
     $location_id = intval($_REQUEST['location_id']);
     $order_item_id = intval($_REQUEST['order_item_id']);
     $youhui_log_id = intval($_REQUEST['youhui_log_id']);
     $event_submit_id = intval($_REQUEST['event_submit_id']);
     $param = array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "order_item_id" => $order_item_id, "youhui_log_id" => $youhui_log_id, "event_submit_id" => $event_submit_id);
     $checker = check_dp_status($GLOBALS['user_info']['id'], $param);
     if (!$checker['status']) {
         showErr($checker['info'], 1);
     }
     $content = strim(valid_str($_REQUEST['content']));
     //点评内容
     $dp_point = intval($_REQUEST['dp_point']);
     //总评分
     if ($dp_point <= 0) {
         $data['status'] = 0;
         $data['info'] = "请为总评打分";
         ajax_return($data);
     }
     $dp_image = array();
     //点评图片
     foreach ($_REQUEST['dp_image'] as $k => $v) {
         if (strim($v) != "") {
             $dp_image[] = strim($v);
         }
     }
     $tag_group = array();
     //标签分组
     foreach ($_REQUEST['dp_tags'] as $k => $tags_arr) {
         foreach ($tags_arr as $v) {
             if (strim($v) != "") {
                 $v_array = preg_split("/[ ,]/", $v);
                 foreach ($v_array as $kk => $vv) {
                     if (strim($vv) != "") {
                         $tag_group[$k][] = strim(valid_str($vv));
                     }
                 }
             }
         }
     }
     $point_group = array();
     //评分分组
     foreach ($_REQUEST['dp_point_group'] as $k => $v) {
         if (intval($v) > 0) {
             $point_group[$k] = intval($v);
         } else {
             $name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "point_group where id = " . intval($k));
             $info = "请打分";
             if ($name) {
                 $info = "请为" . $name . "打分";
             }
             $data['status'] = 0;
             $data['info'] = $info;
             ajax_return($data);
         }
     }
     $result = save_review($GLOBALS['user_info']['id'], $param, $content, $dp_point, $dp_image, $tag_group, $point_group);
     if ($result['status']) {
         //分享
         $attach_list = array();
         if ($result['deal_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/deal.php";
             $deal_info = get_deal($result['deal_id']);
             if ($deal_info['uname'] != "") {
                 $url_key = $deal_info['uname'];
             } else {
                 $url_key = $deal_info['id'];
             }
             $type = "dealcomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'deal#' . $url_key, 'rel_param' => '');
             //同步图片
             if ($deal_info['icon']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $deal_info['icon']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $deal_info['sub_name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $deal_info['icon']);
                 $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'] = $deal_info['icon'];
                 $image_data['o_path'] = $deal_info['icon'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         } elseif ($result['youhui_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/youhui.php";
             $youhui_info = get_youhui($result['youhui_id']);
             $type = "youhuicomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'youhui#' . $result['youhui_id'], 'rel_param' => '');
             //同步图片
             if ($youhui_info['icon']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $youhui_info['icon']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $youhui_info['name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $youhui_info['icon']);
                 $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'] = $youhui_info['icon'];
                 $image_data['o_path'] = $youhui_info['icon'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         } elseif ($result['event_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/event.php";
             $event_info = get_event($result['youhui_id']);
             $type = "eventcomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $result['event_id'], 'rel_param' => '');
             //同步图片
             if ($event_info['icon']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $event_info['icon']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $event_info['name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $event_info['icon']);
                 $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'] = $event_info['icon'];
                 $image_data['o_path'] = $event_info['icon'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         } else {
             require_once APP_ROOT_PATH . "system/model/supplier.php";
             $location_info = get_location($result['location_id']);
             $type = "slocationcomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'store#' . $result['location_id'], 'rel_param' => '');
             //同步图片
             if ($location_info['preview']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $location_info['preview']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $location_info['name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $location_info['preview']);
                 $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'] = $location_info['preview'];
                 $image_data['o_path'] = $location_info['preview'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         }
         foreach ($_REQUEST['topic_image_id'] as $att_id) {
             if (intval($att_id) > 0) {
                 $attach_list[] = array("type" => "image", "id" => intval($att_id));
             }
         }
         require_once APP_ROOT_PATH . "system/model/topic.php";
         $tid = insert_topic($content, "", $type, $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list, $url_route);
         if ($tid) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
         }
         $result['jump'] = url($url_route['rel_app_index'], $url_route['rel_route'], $url_route['rel_param']);
         ajax_return($result);
     } else {
         ajax_return($result);
     }
 }