Ejemplo n.º 1
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
$collectionID = get_id(2);
$collectionsClass = new collections();
$collection = $collectionsClass->get($collectionID);
if (!is_array($collection) || $collection['public'] == 'false' && check_login_bool() && $collection['user_id'] != $_SESSION['user']['user_id']) {
    refresh('/' . $languageURL . 'collections/', $langArray['wrong_collection'], 'error');
}
if (isset($_POST['rating'])) {
    $_GET['rating'] = $_POST['rating'];
}
if (!isset($_GET['rating']) || !is_numeric($_GET['rating']) || $_GET['rating'] > 5) {
    $_GET['rating'] = 5;
} elseif ($_GET['rating'] < 1) {
    $_GET['rating'] = 1;
}
$collection = $collectionsClass->rate($collectionID, $_GET['rating']);
$stars = '';
for ($i = 1; $i < 6; $i++) {
    if ($collection['rating'] >= $i) {
        $stars .= '<img src="{$template_data}img/star-on.png" alt="" class="left" />';
Ejemplo n.º 2
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['collections']);
$collectionsClass = new collections();
$limit = 20;
$start = (PAGE - 1) * $limit;
$order = '';
if (!isset($_GET['sort_by'])) {
    $_GET['sort_by'] = '';
}
switch ($_GET['sort_by']) {
    case 'name':
        $order = '`name`';
        break;
    case 'average_rating':
        $order = '`rating`';
        break;
    default:
        $order = '`datetime`';
        break;
}
Ejemplo n.º 3
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
require_once ROOT_PATH . '/apps/collections/models/collections.class.php';
$collectionsClass = new collections();
if (check_login_bool() && isset($_POST['add_collection'])) {
    $s = $collectionsClass->bookmark($itemID);
    if ($s === true) {
        refresh('/' . $languageURL . 'items/' . $itemID, $langArray['complete_bookmark_item'], 'complete');
    } else {
        addErrorMessage($s, '还没有创建书签集', 'error');
    }
}
if (check_login_bool()) {
    $collections = $collectionsClass->getAll(0, 0, " `user_id` = '" . intval($_SESSION['user']['user_id']) . "' ");
    abr('bookCollections', $collections);
}
Ejemplo n.º 4
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['list']);
$cms = new collections();
$data = $cms->getAll(START, LIMIT);
if (is_array($data)) {
    require_once ROOT_PATH . '/apps/users/models/users.class.php';
    $usersClass = new users();
    $users = $usersClass->getAll(0, 0, $cms->usersWhere);
    abr('users', $users);
}
abr('data', $data);
$p = paging("?m=" . $_GET['m'] . "&c=list&p=", "", PAGE, LIMIT, $cms->foundRows);
abr('paging', $p);
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
Ejemplo n.º 5
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
$collectionID = get_id(2);
$collectionsClass = new collections();
$collection = $collectionsClass->get($collectionID);
if (!is_array($collection) || $collection['public'] == 'false' && check_login_bool() && $collection['user_id'] != $_SESSION['user']['user_id']) {
    refresh('/' . $languageURL . 'collections/', $langArray['wrong_collection'], 'error');
}
_setTitle($collection['name']);
abr('checkItemsType', 'yes');
require_once ROOT_PATH . '/apps/users/models/users.class.php';
$usersClass = new users();
$collection['user'] = $usersClass->get($collection['user_id']);
if (check_login_bool()) {
    $collection['rate'] = $collectionsClass->isRate($collectionID);
}
abr('collection', $collection);
#删除作品
if (isset($_GET['delete']) && check_login_bool() && $collection['user_id'] == $_SESSION['user']['user_id']) {
    $collectionsClass->deleteBookmark($collectionID, $_GET['delete']);
    refresh('/' . $languageURL . 'collections/view/' . $collectionID, $langArray['complete_delete_bookmark'], 'complete');
Ejemplo n.º 6
0
         $whereQuery .= " `categories` LIKE '%," . intval($c) . ",%' ";
         $pagingUrl .= '&categories[' . $c . ']=1';
     }
     $whereQuery = " AND (" . $whereQuery . ") ";
 }
 if (isset($_GET['collection_id'])) {
     $_GET['collection_id'] = get_new_str($_GET['collection_id']);
     $_GET['collection_id'] = htmlspecialchars($_GET['collection_id']);
     if (!is_numeric($_GET['collection_id'])) {
         unset($_GET['collection_id']);
     }
 }
 #加载书签集作品
 if (isset($_GET['collection_id']) && is_numeric($_GET['collection_id'])) {
     require_once ROOT_PATH . '/apps/collections/models/collections.class.php';
     $collectionsClass = new collections();
     $items = $collectionsClass->getItems($_GET['collection_id'], $start, $limit, " AND `status` = 'active' AND (`name` = '" . sql_quote($s) . "' OR `description` LIKE '%" . sql_quote($s) . "%') " . $whereQuery, "{$order}", true);
     if (is_array($items)) {
         $users = $usersClass->getAll(0, 0, $collectionsClass->usersWhere);
         abr('users', $users);
     }
     abr('results', $items);
     abr('paging', paging('/' . $languageURL . 'search/?type=files&term=' . $s . '&p=', $pagingUrl . '&sort_by=' . $_GET['sort_by'], PAGE, $limit, $collectionsClass->foundRows));
 } else {
     $items = $itemsClass->getAll($start, $limit, " `status` = 'active' AND (`name` = '" . sql_quote($s) . "' OR `description` LIKE '%" . sql_quote($s) . "%') " . $whereQuery, "{$order}");
     if (is_array($items)) {
         $users = $usersClass->getAll(0, 0, $itemsClass->usersWhere);
         abr('users', $users);
     }
     abr('results', $items);
     abr('paging', paging('/' . $languageURL . 'search/?type=files&term=' . $s . '&p=', $pagingUrl . '&sort_by=' . $_GET['sort_by'], PAGE, $limit, $itemsClass->foundRows));
Ejemplo n.º 7
0
    $usersClass->followUser($users['user_id']);
    if (isset($_POST)) {
        if ($users['is_follow']) {
            $text = $langArray['follow'];
        } else {
            $text = $langArray['unfollow'];
        }
        die('
				jQuery("#follow").html("' . $text . '");
			');
    }
    refresh('/' . $languageURL . 'user/' . $users['username']);
}
#加载公开书签集
require_once ROOT_PATH . '/apps/collections/models/collections.class.php';
$collectionsClass = new collections();
$collections = $collectionsClass->getAll(0, 2, " `public` = 'true' AND `user_id` = '" . intval($users['user_id']) . "' ");
abr('collections', $collections);
#获取推荐文件
if ($users['featured_item_id'] != '0') {
    require_once ROOT_PATH . '/apps/items/models/items.class.php';
    $itemsClass = new items();
    $featureItem = $itemsClass->get($users['featured_item_id'], true);
    abr('featureItem', $featureItem);
}
#获取粉丝
$follow['to'] = $usersClass->getFollowers($users['user_id'], 0, 9, 'RAND()', true);
$follow['to_count'] = $usersClass->foundRows;
$follow['from'] = $usersClass->getFollowers($users['user_id'], 0, 9, 'RAND()');
$follow['from_count'] = $usersClass->foundRows;
abr('follow', $follow);
Ejemplo n.º 8
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
define('USING_LANGUAGE', false);
require_once '../../../config.php';
require_once $config['root_path'] . '/core/functions.php';
include_once $config['system_core'] . "/initEngine.php";
admin_login();
if (isset($_POST['delete']) && isset($_POST['id']) && isset($_SESSION['user']['access']['collections'])) {
    require_once ROOT_PATH . "/apps/collections/models/collections.class.php";
    $cms = new collections();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
echo json_encode(array_merge($_POST, array('status' => 'unknown error')));
die;
Ejemplo n.º 9
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['book_marks']);
if (!check_login_bool()) {
    $_SESSION['temp']['golink'] = '/' . $languageURL . 'user/bookmarks/';
    refresh('/' . $languageURL . 'sign_in/');
}
require_once ROOT_PATH . '/apps/collections/models/collections.class.php';
$collectionsClass = new collections();
if (isset($_POST['add'])) {
    $collectionsClass->add();
    refresh('/' . $languageURL . 'user/bookmarks/', $langArray['complete_add_collection'], 'complete');
}
$collections = $collectionsClass->getAll(0, 0, " `user_id` = '" . intval($_SESSION['user']['user_id']) . "' ", true);
abr('collections', $collections);
$usersClass = new users();
$users = $usersClass->getAll(0, 0, $collectionsClass->usersWhere);
abr('users', $users);
#面包屑
abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'users/bookmarks/" title="">' . $langArray['collections'] . '</a>');