Ejemplo n.º 1
0
            if ($userInfo) {
                $wall['wall_creatorname'] = $userInfo['user_name'];
            }
            $wall['wall_type'] = $info['wall_type'];
            $wall['wall_usercount'] = $info['wall_usercount'];
        }
        $wall['relationship'] = 'like';
        array_push($ret, $wall);
    }
}
$walls = WaWall::FindWallIdsByCreator($id);
if ($walls) {
    while (list($key, $value) = each($walls)) {
        $wall = array();
        $wall['wall_id'] = $value['wall_id'];
        if (isset($_GET['fulldata'])) {
            $info = WaWall::GetWallInfo($wall['wall_id']);
            $wall['wall_name'] = $info['wall_name'];
            $wall['wall_desc'] = $info['wall_desc'];
            $userInfo = WaUser::GetUserInfo($info['wall_creator']);
            if ($userInfo) {
                $wall['wall_creatorname'] = $userInfo['user_name'];
            }
            $wall['wall_type'] = $info['wall_type'];
            $wall['wall_usercount'] = $info['wall_usercount'];
        }
        $wall['relationship'] = 'own';
        array_push($ret, $wall);
    }
}
echo json_encode($ret);
Ejemplo n.º 2
0
        if ($creatorInfo) {
            $creatorName = $creatorInfo['user_name'];
            ?>
      <div class="wall-user">
        <h3>用户列表</h3>
        <h5>墙主:<?php 
            echo $creatorName;
            ?>
</h5>
      </div>
      <?php 
        }
        ?>
      </span>
      <?php 
        $users = WaWall::FindUserIdsByWall($wall);
        if ($users) {
            foreach ($users as $user) {
                $userInfo = WaUser::GetUserInfo($user['user_id']);
                if ($userInfo) {
                    ?>
      <span class="wall-user list-group-item">
      <h4 class="list-group-item-text"><?php 
                    echo $userInfo['user_name'];
                    ?>
</h4>
      </span>
      <?php 
                }
            }
        }
Ejemplo n.º 3
0
<?php

require './get.php';
$walltypes = WaWall::GetWalltypes();
$ret = array();
while (list($key, $value) = each($walltypes)) {
    array_push($ret, array('walltype_id' => $key, 'walltype_name' => $value));
}
echo json_encode($ret);
Ejemplo n.º 4
0
$walls = false;
if ($walltype) {
    $walls = WaWall::FindWallIdsByType($walltype, $limit);
} else {
    $walls = WaWall::FindWallIdsByAccess(5, $limit);
}
if (!$walls) {
    returnError("这里暂时没有墙。");
    return;
}
$ret = array();
while (list($key, $value) = each($walls)) {
    if (intval($key) > $limit) {
        break;
    }
    $info = WaWall::GetWallInfo($value['wall_id']);
    if (!$info) {
        continue;
    }
    $wall = array();
    $wall['wall_id'] = $info['wall_id'];
    $wall['wall_name'] = $info['wall_name'];
    $wall['wall_desc'] = $info['wall_desc'];
    $userInfo = WaUser::GetUserInfo($info['wall_creator']);
    if ($userInfo) {
        $wall['wall_creatorname'] = $userInfo['user_name'];
    }
    $wall['wall_type'] = $info['wall_type'];
    $wall['wall_usercount'] = $info['wall_usercount'];
    array_push($ret, $wall);
}
Ejemplo n.º 5
0
function like($wall, $user)
{
    $found = false;
    try {
        $wallUsers = WaWall::FindUserIdsByWall($wall);
    } catch (Exception $e) {
    }
    if ($wallUsers) {
        foreach ($wallUsers as $wallUser) {
            if ($wallUser['user_id'] == $user) {
                $found = true;
                break;
            }
        }
    }
    $info = WaWall::GetWallInfo($wall);
    if (!$info) {
        returnError('获取墙信息失败');
    }
    if (!$found) {
        try {
            $result = WaWall::AddUserToWall($user, $wall);
        } catch (Exception $e) {
            returnError($e->getMessage());
            return;
        }
        if (!$result) {
            returnError('添加失败');
        }
        $info['wall_usercount']++;
        $result = WaWall::SetWallInfo($wall, $info);
        if (!$result) {
            returnError('加人失败');
        }
    }
    $ret = array('wall_usercount' => $info['wall_usercount']);
    echo json_encode($ret);
}