コード例 #1
0
ファイル: feed.php プロジェクト: yukisky/clipbucket
         }
     }
     $post = mysql_clean(post('post'));
     if (!$content && !$post) {
         cb_error(lang('Please enter something for message'));
     }
     $action = mysql_clean(post('action'));
     if (!$action) {
         $action = 'added_status';
     }
     //Lets add the feed....
     $feed_array = array('userid' => userid(), 'user' => $userquery->udetails, 'content_id' => $content_id, 'content' => $cbfeeds->get_content($content_type, $content_id, $content), 'content_type' => $content_type, 'object_id' => $object_id, 'object' => $object, 'object_type' => $object_type, 'action' => $action, 'message' => $post);
     $fid = $cbfeeds->add_feed($feed_array);
     if (error()) {
         $error = error('single');
         cb_error($error);
     }
     //return feed result.
     $feed = $cbfeeds->get_feed($fid);
     assign('feed', $feed);
     if ($object_type) {
         $template = get_template('single_feed_' . $object_type);
     }
     if (!$template) {
         $template = get_template('single_feed');
     }
     $array = array('success' => 'ok', 'template' => $template, 'fid' => $fid);
     echo json_encode($array);
 } catch (Exception $e) {
     exit(json_encode(array('err' => array($e->getMessage()))));
 }
コード例 #2
0
ファイル: groups.php プロジェクト: yukisky/clipbucket
        $get_limit = create_query_limit($page, $group_videos_limit);
        $videos = $cbgroup->get_group_videos($gid, "yes", $get_limit);
        if ($videos) {
            foreach ($videos as $video) {
                assign('video', $video);
                $template .= get_template('group_video');
            }
        }
        echo json_encode(array('success' => 'ok', 'videos' => $template));
        break;
    case "delete_groups":
        try {
            $gids = post('gids');
            if (!$gids || !is_array($gids)) {
                cb_error(lang("No group was selected"));
            }
            foreach ($gids as $gid) {
                if ($gid) {
                    $cbgroup->delete_group($gid);
                }
            }
            if (error()) {
                cb_error(error('single'));
            }
            exit(json_encode(array('success' => 'yes')));
        } catch (Exception $e) {
            exit(json_encode(array('err' => array($e->getMessage()))));
        }
    default:
        exit(json_encode(array('err' => array(lang('Invalid request')))));
}