Ejemplo n.º 1
0
            $result = file_remote_upload($upload['path']);
            if (!is_error($result) && $result !== false) {
                file_delete($upload['path']);
            }
        }
    }
    if (!empty($_FILES['headimg']['tmp_name'])) {
        $_W['uploadsetting'] = array();
        $_W['uploadsetting']['image']['folder'] = '';
        $_W['uploadsetting']['image']['extentions'] = array('jpg');
        $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit'];
        $upload = file_upload($_FILES['headimg'], 'image', "headimg_{$acid}");
        if (is_error($upload)) {
            message('头像保存失败,' . $upload['message'], referer(), 'info');
        } else {
            $result = file_remote_upload($upload['path']);
            if (!is_error($result) && $result !== false) {
                file_delete($upload['path']);
            }
        }
    }
    cache_delete("uniaccount:{$uniacid}");
    cache_delete("unisetting:{$uniacid}");
    cache_delete("accesstoken:{$acid}");
    cache_delete("jsticket:{$acid}");
    cache_delete("cardticket:{$acid}");
    module_build_privileges();
    message('更新公众号成功!', referer(), 'success');
}
$settings = uni_setting($uniacid, array('notify'));
$notify = $settings['notify'] ? $settings['notify'] : array();
Ejemplo n.º 2
0
        if (!empty($_FILES['headimg']['tmp_name'])) {
            $_W['uploadsetting'] = array();
            $_W['uploadsetting']['image']['folder'] = '';
            $_W['uploadsetting']['image']['extentions'] = array('jpg');
            $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit'];
            $upload = file_upload($_FILES['headimg'], 'image', "headimg_{$acid}");
            if (is_array($upload)) {
                $result = file_remote_upload($upload['path']);
                if (!is_error($result) && $result !== false) {
                    file_delete($upload['path']);
                }
            }
        } else {
            if (file_exists(IA_ROOT . '/attachment/headimg_' . $update['account'] . '.jpg')) {
                file_move(IA_ROOT . '/attachment/headimg_' . $update['account'] . '.jpg', IA_ROOT . '/attachment/headimg_' . $acid . '.jpg');
                $result = file_remote_upload('headimg_' . $acid . '.jpg');
                if (!is_error($result) && $result !== false) {
                    file_delete('headimg_' . $acid . '.jpg');
                }
            }
        }
        cache_delete("unisetting:{$uniacid}");
        if (!empty($_GPC['uniacid']) || empty($_W['isfounder'])) {
            header("Location: " . url('account/post-step/', array('uniacid' => $uniacid, 'acid' => $acid, 'step' => 4)));
        } else {
            header("Location: " . url('account/post-step/', array('uniacid' => $uniacid, 'acid' => $acid, 'step' => 3)));
        }
        exit;
    }
} elseif ($step == 3) {
    if (empty($_W['isfounder'])) {
Ejemplo n.º 3
0
         if (is_error($thumbnail)) {
             $result['message'] = $thumbnail['message'];
             die(json_encode($result));
         } else {
             $filename = pathinfo($thumbnail, PATHINFO_BASENAME);
             $pathname = $thumbnail;
             $fullname = ATTACHMENT_ROOT . '/' . $pathname;
         }
     }
     $info = array('name' => $_FILES['file']['name'], 'ext' => $ext, 'filename' => $pathname, 'attachment' => $pathname, 'url' => tomedia($pathname), 'is_image' => 1, 'filesize' => filesize($fullname));
     $size = getimagesize($fullname);
     $info['width'] = $size[0];
     $info['height'] = $size[1];
     setting_load('remote');
     if (!empty($_W['setting']['remote']['type'])) {
         $remotestatus = file_remote_upload($pathname);
         if (is_error($remotestatus)) {
             $result['message'] = '远程附件上传失败,请检查配置并重新上传';
             file_delete($pathname);
             die(json_encode($result));
         } else {
             file_delete($pathname);
             $info['url'] = tomedia($pathname);
         }
     }
     pdo_insert('core_attachment', array('uniacid' => $uniacid, 'uid' => $_W['uid'], 'filename' => $_FILES['file']['name'], 'attachment' => $pathname, 'type' => $type == 'image' ? 1 : 2, 'createtime' => TIMESTAMP));
     die(json_encode($info));
 } else {
     $result['error']['message'] = '请选择要上传的图片!';
     die(json_encode($result));
 }