Beispiel #1
0
<?php

session_start();
require_once '../lib/class.dbConnect.php';
require_once '../lib/class.contents.php';
require_once '../lib/class.favorites.php';
$DB = new dbConn();
$Content = new clsContents($DB->getConnection());
$Favorite = new clsFavorites($DB->getConnection());
$result = array();
if ($_SESSION['USER_IDX'] == "") {
    $result = array("r" => "error", "msg" => "Available after sign in.");
    echo json_encode($result);
    return;
}
if (trim($_POST['cidx']) == "") {
    $arr = array("c_id" => trim($_POST['id']), "c_type" => trim($_POST['c_type']), "s_name" => trim($_POST['s_name']), "c_info" => trim($_POST['info']));
    $result = $Content->save($arr);
    if ($result['r'] == "success" || $result['r'] == "exist") {
        $c_idx = $result['idx'];
    }
} else {
    $c_idx = trim($_POST['cidx']);
}
$arr = array("m_idx" => $_SESSION['USER_IDX'], "c_idx" => $c_idx, "search_word" => trim($_POST['keyword']), "tags" => trim($_POST['tags']));
$result = $Favorite->save($arr);
if ($result['r'] == "success") {
    $result['f_cnt'] = $Content->incrementFavorite($result['c_idx']);
}
echo json_encode($result);
Beispiel #2
0
<?php

require_once 'comm/inc.session.php';
require_once 'lib/class.contents.php';
require_once 'lib/class.favorites.php';
$contentIdx = $_GET['idx'];
$searchWord = $_GET['k'];
$Content = new clsContents($DB->getConnection());
$Favorite = new clsFavorites($DB->getConnection());
$contentData = $Content->getData($contentIdx);
$contentInfo = json_decode($contentData['c_info']);
if ($contentData['c_type'] == "image") {
    $dataUrl = $contentInfo->href;
    $imageUrl = $contentInfo->imgURL;
} else {
    if ($contentData['c_type'] == "music") {
        $dataUrl = $contentInfo->url;
    } else {
        if ($contentData['c_type'] == "video") {
            $dataUrl = $contentInfo->href;
            //$videoUrl = $contentInfo->url;
            $videoUrl = "http://www.youtube.com/embed/" . $contentInfo->id . "?wmode=opaque";
        } else {
            if ($contentData['c_type'] == "doc") {
                $dataUrl = $contentInfo->href;
            }
        }
    }
}
$isFavorite = false;
if (isset($_SESSION['USER_IDX']) && $_SESSION['USER_IDX'] != "") {
Beispiel #3
0
<?php

require_once '../lib/class.dbConnect.php';
require_once '../lib/class.contents.php';
require_once '../lib/class.favorites.php';
$DB = new dbConn();
$conn = $DB->getConnection();
$Content = new clsContents($conn);
$Favorite = new clsFavorites($conn);
$curPage = trim($_POST['cur_page']);
$pageLen = trim($_POST['page_cnt']) ? trim($_POST['page_cnt']) : 0;
$c_type = trim($_POST['type']);
if ($c_type == "") {
    exit;
}
$totalcount = $Content->getFavoriteContentsCount($c_type, 'y');
$result = array("total" => $totalcount);
$start = $curPage * $pageLen;
$data = $Content->getFavoriteContents($c_type, $start, $pageLen, 'y');
for ($i = 0; $i < count($data); $i++) {
    $info = json_decode($data[$i]['c_info']);
    $info->idx = $data[$i]['idx'];
    $info->s_name = $data[$i]['s_name'];
    $info->f_count = $data[$i]['f_count'];
    $result['data'][] = $info;
}
echo json_encode($result);
Beispiel #4
0
</style>

<?php 
if ($TopMenu == "member") {
    ?>
<ul>
	<li><a href="list.php?pgkey=list">List</a></li>
</ul>
<?php 
} else {
    if ($TopMenu == "favorite") {
        require_once '../../lib/class.dbConnect.php';
        require_once '../../lib/class.contents.php';
        $DB = new dbConn();
        $Content = new clsContents($DB->getConnection());
        $arrServerList = $Content->getServerList();
        ?>
<ul>
	<?php 
        $type_temp = "";
        for ($i = 0; $i < count($arrServerList); $i++) {
            if ($type_temp == $arrServerList[$i]['c_type']) {
                continue;
            }
            $type_temp = $arrServerList[$i]['c_type'];
            ?>
	<li><a href="list.php?c_type=<?php 
            echo $arrServerList[$i]['c_type'];
            ?>
" ><?php 
Beispiel #5
0
<?php

require_once '../lib/class.dbConnect.php';
require_once '../lib/class.contents.php';
require_once '../lib/class.favorites.php';
$DB = new dbConn();
$conn = $DB->getConnection();
$Content = new clsContents($conn);
$Favorite = new clsFavorites($conn);
$keyword = trim($_POST['keyword']) ? trim($_POST['keyword']) : '';
$curPage = trim($_POST['cur_page']) ? trim($_POST['page_cnt']) : 0;
$pageLen = trim($_POST['page_cnt']) ? trim($_POST['page_cnt']) : 0;
$c_type = trim($_POST['type']);
$c = trim($_POST['c']);
$d = trim($_POST['d']);
if ($c_type == "") {
    exit;
}
$totalcount = $Content->getSearchContentsCount($c_type, $keyword, $c, $d, 'y');
$result = array("total" => $totalcount);
$start = $curPage * $pageLen;
$data = $Content->getSearchContents($c_type, $start, $pageLen, $keyword, $c, $d, 'y');
for ($i = 0; $i < count($data); $i++) {
    $info = json_decode($data[$i]['c_info']);
    $info->idx = $data[$i]['idx'];
    $info->s_name = $data[$i]['s_name'];
    $info->f_count = $data[$i]['f_count'];
    $result['data'][] = $info;
}
echo json_encode($result);
Beispiel #6
0
<?php

require_once '../lib/class.dbConnect.php';
require_once '../lib/class.contents.php';
$DB = new dbConn();
$Content = new clsContents($DB->getConnection());
$arr = array("c_id" => trim($_POST['id']), "c_type" => trim($_POST['c_type']), "s_name" => trim($_POST['s_name']), "c_info" => trim($_POST['info']), "k" => trim($_POST['keyword']), "c" => $_POST['c'] ? 'y' : 'n', "d" => $_POST['d'] ? 'y' : 'n');
$result = $Content->save($arr);
echo json_encode($result);
Beispiel #7
0
<?php

session_start();
require_once '../lib/class.dbConnect.php';
require_once '../lib/class.contents.php';
require_once '../lib/class.favorites.php';
$DB = new dbConn();
$Content = new clsContents($DB->getConnection());
$Favorite = new clsFavorites($DB->getConnection());
$idx = trim($_POST['idx']);
$m_idx = $_SESSION['USER_IDX'];
$result = $Favorite->delData($idx, $m_idx);
if ($result['r'] == "success") {
    $result['f_cnt'] = $Content->decrementFavorite($result['c_idx']);
}
echo json_encode($result);
Beispiel #8
0
<?php

session_start();
require_once '../lib/class.dbConnect.php';
require_once '../lib/class.contents.php';
require_once '../lib/class.favorites.php';
$DB = new dbConn();
$conn = $DB->getConnection();
$Content = new clsContents($conn);
$Favorite = new clsFavorites($conn);
$memberIdx = $_SESSION['USER_IDX'];
$keyword = trim($_POST['keyword']) ? trim($_POST['keyword']) : '';
$curPage = trim($_POST['cur_page']);
$pageLen = trim($_POST['page_cnt']) ? trim($_POST['page_cnt']) : 0;
$c_type = trim($_POST['type']);
if ($c_type == "") {
    exit;
}
$totalcount = $Content->getMyFavoriteContentsCount($c_type, $memberIdx, $keyword);
$result = array("total" => $totalcount);
$start = $curPage * $pageLen;
$data = $Content->getMyFavoriteContents($c_type, $memberIdx, $keyword, $start, $pageLen);
for ($i = 0; $i < count($data); $i++) {
    $info = json_decode($data[$i]['c_info']);
    $info->idx = $data[$i]['f_idx'];
    $info->tags = $data[$i]['tags'];
    $info->s_name = $data[$i]['s_name'];
    $info->search_word = $data[$i]['search_word'];
    $result['data'][] = $info;
}
echo json_encode($result);
Beispiel #9
0
<?php

session_start();
require_once '../../lib/class.dbConnect.php';
require_once '../../lib/class.members.php';
require_once '../../lib/class.favorites.php';
require_once '../../lib/class.contents.php';
$DB = new dbConn();
$Member = new clsMembers($DB->getConnection());
$Favorite = new clsFavorites($DB->getConnection());
$Content = new clsContents($DB->getConnection());
$type = trim($_POST['type']);
$member_idx = trim($_POST['idx']);
$result = array();
if ($type == "del") {
    $f_result = $Favorite->getDatasFromMemberIdx($member_idx);
    for ($i = 0; $i < count($f_result); $i++) {
        $c_idx = $f_result[$i]['c_idx'];
        $Content->decrementFavorite($c_idx);
    }
    $Favorite->delDatasFromMemberIdx($member_idx);
    if ($Member->delMember($member_idx)) {
        $result['r'] = "success";
        $result['msg'] = "Your member information no longer exists.";
    } else {
        $result['r'] = "error";
        $result['msg'] = "Sorry, we failed to delete your member information.";
    }
}
echo json_encode($result);