Exemplo n.º 1
0
    empty($forum) and message(1, '板块不存在');
    $upfile = param('upfile', '', FALSE);
    empty($upfile) and message(-1, 'upfile 数据为空');
    $json = xn_json_decode($upfile);
    empty($json) and message(-1, '数据有问题: json 为空');
    $name = $json['name'];
    $width = $json['width'];
    $height = $json['height'];
    $data = base64_decode($json['data']);
    $size = strlen($data);
    $filename = "{$fid}.png";
    $path = $conf['upload_path'] . 'forum/';
    $url = $conf['upload_url'] . 'forum/' . $filename;
    !IN_SAE and !is_dir($path) and (mkdir($path, 0777, TRUE) or message(-2, '目录创建失败'));
    file_put_contents($path . $filename, $data) or message(-1, '写入文件失败');
    forum_update($fid, array('icon' => $time));
    message(0, $url);
} elseif ($action == 'getname') {
    $uids = param(2);
    $arr = explode(',', $uids);
    $names = array();
    $err = '';
    foreach ($arr as $_uid) {
        $_uid = intval($_uid);
        if (empty($_uid)) {
            continue;
        }
        $_user = user_read($_uid);
        if (empty($_user)) {
            $err .= "{$_uid} 不存在; ";
            continue;
Exemplo n.º 2
0
         $t_owner = "";
         $t_owner_uid = 0;
     }
     if (isset($_POST['t_access']) && is_numeric($_POST['t_access'])) {
         $t_access = $_POST['t_access'];
     } else {
         $error_msg_array[] = gettext("You must supply a forum access level");
         $valid = false;
     }
     if (isset($_POST['t_default']) && $_POST['t_default'] == 'Y') {
         $t_default = 1;
     } else {
         $t_default = 0;
     }
     if ($valid) {
         if (forum_update($fid, $t_name, $t_owner_uid, $t_access)) {
             if ($forum_data['DEFAULT_FORUM'] == 1 && $t_default == 0) {
                 forum_update_default(0);
             } else {
                 if ($t_default == 1) {
                     forum_update_default($fid);
                 }
             }
             header_redirect("admin_forums.php?webtag={$webtag}&fid={$fid}&page={$page}&edited=true");
             exit;
         } else {
             $error_msg_array[] = sprintf(gettext("Failed to update forum: '%s'"), $forum_data['WEBTAG']);
             $valid = false;
         }
     }
 } else {