/** * run - display template and edit data * * @access public * */ public function run() { $tpl = new template(); $msgKey = ''; $values = array('name' => '', 'details' => '', 'clientId' => '', 'hourBudget' => '', 'assignedUsers' => array(), 'dollarBudget' => ''); if (isset($_POST['save']) === true) { if (!isset($_POST['hourBudget']) || $_POST['hourBudget'] == '' || $_POST['hourBudget'] == NULL) { $hourBudget = '0'; } else { $hourBudget = $_POST['hourBudget']; } if (isset($_POST['editorId']) && count($_POST['editorId'])) { $assignedUsers = $_POST['editorId']; } else { $assignedUsers = array(); } $values = array('name' => $_POST['name'], 'details' => $_POST['details'], 'clientId' => $_POST['clientId'], 'hourBudget' => $hourBudget, 'assignedUsers' => $assignedUsers, 'dollarBudget' => $_POST['dollarBudget']); if ($values['name'] === '') { $msgKey = 'NO_PROJECTNAME'; } elseif ($values['clientId'] === '') { $msgKey = 'ERROR_NO_CLIENT'; } else { $this->addProject($values); //Take the old value to avoid nl character $values['details'] = $_POST['details']; $msgKey = 'PROJECT_ADDED'; } $tpl->assign('values', $values); } $tpl->assign('values', $values); $user = new users(); $tpl->assign('availableUsers', $user->getAll()); $clients = new clients(); $tpl->assign('info', $msgKey); $tpl->assign('clients', $clients->getAll()); $tpl->display('projects.newProject'); }
<?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['withdraws']); $cms = new deposit(); $data = $cms->getWithdraws(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=withdraws&p=", "", PAGE, LIMIT, $cms->foundRows); abr('paging', $p); require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
$_GET['sort_by'] = ''; } switch ($_GET['sort_by']) { case 'name': $order = '`name`'; break; case 'average_rating': $order = '`rating`'; break; default: $order = '`datetime`'; break; } if (!isset($_GET['order']) || $_GET['order'] == '' || $_GET['order'] == 'desc') { $_GET['order'] = 'desc'; $order .= ' DESC'; } else { $_GET['order'] = 'asc'; $order .= ' ASC'; } $collections = $collectionsClass->getAll(START, LIMIT, " `public` = 'true' ", false, $order); if (is_array($collections)) { require_once ROOT_PATH . '/apps/users/models/users.class.php'; $usersClass = new users(); $users = $usersClass->getAll(0, 0, $collectionsClass->usersWhere); abr('users', $users); } abr('collections', $collections); abr('paging', paging('/' . $languageURL . 'collections/?p=', '&sort_by=' . $_GET['sort_by'] . '&order=' . $_GET['order'], PAGE, $limit, $collectionsClass->foundRows)); #面包屑 abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'collections/" title="">' . $langArray['public_collections'] . '</a>');
// | 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__); $text = ''; require_once ROOT_PATH . '/apps/users/models/users.class.php'; $usersClass = new users(); $limit = 9; $start = (PAGE - 1) * $limit; //$text .= '<ul class="thumb_list w276 left">'; $topAuthors = $usersClass->getAll($start, $limit, " `status` = 'activate' ", "`sales` DESC"); if (is_array($topAuthors)) { foreach ($topAuthors as $a) { $text .= '<a href="/' . $languageURL . 'users/' . $a['username'] . '" class="user" title="' . htmlspecialchars($a['username']) . '">'; if ($a['avatar'] != '') { $text .= '<img src="' . DATA_SERVER . '/uploads/users/' . $a['user_id'] . '/A_' . $a['avatar'] . '" width="80" height="80" border="0" alt="" title="" />'; } else { $text .= '<img src="' . DATA_SERVER . '/images/common/default-user.jpg" width="80" height="80" border="0" alt="" title="" />'; } $text .= '</a>'; } $emptyThumb = 9 - $usersClass->foundRows; for ($i = 0; $i < $emptyThumb; $i++) { // $text .= '<li></li>'; } //$text .= '</ul>';
<?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__); require_once ROOT_PATH . '/apps/users/models/users.class.php'; $usersClass = new users(); $users = $usersClass->getAll(0, 0, $itemsClass->usersWhere); abr('users', $users); $itemsClass = new items(); $limit = 4; $start = (PAGE - 1) * $limit; $text = ''; $items = $itemsClass->getAll($start, $limit, " `status` = 'active' AND `weekly_to` >= '" . date('Y-m-d') . "' ", "`datetime` DESC"); $categories = $categoriesClass->getAll(); if (PAGE > 1) { $text .= '<a href="javascript: void(0);" onclick="$.ajax({complete: function(request) { screenshotPreview(); hideLoading(); }, beforeSend: function() { showLoading(); }, dataType: "script", type: "post", url: "/' . $languageURL . 'items/weekly/?p=' . (PAGE - 1) . '"}); return false;" title="" class="slider-control slider-prev"></a>'; } else { $text .= '<span class="slider-control slider-prev-disabled"></span>'; } $backslash = chr(); if (is_array($items)) { $text .= '<ul id="weekly-featured-items">'; foreach ($items as $i) {
/** * run - display template and edit data * * @access public * */ public function run() { $tpl = new template(); //Only admins if ($_SESSION['userdata']['role'] == 'admin') { if (isset($_GET['id']) === true) { $id = (int) $_GET['id']; $row = $this->getProject($id); $msgKey = ''; $values = array('name' => $row['name'], 'details' => $row['details'], 'clientId' => $row['clientId'], 'state' => $row['state'], 'hourBudget' => $row['hourBudget'], 'assignedUsers' => $this->getProjectUserRelation($id), 'dollarBudget' => $row['dollarBudget']); //Edit project if (isset($_POST['save']) === true) { if (isset($_POST['editorId']) && count($_POST['editorId'])) { $assignedUsers = $_POST['editorId']; } else { $assignedUsers = array(); } $values = array('name' => $_POST['name'], 'details' => $_POST['details'], 'clientId' => $_POST['clientId'], 'state' => $_POST['projectState'], 'hourBudget' => $_POST['hourBudget'], 'assignedUsers' => $assignedUsers, 'dollarBudget' => $_POST['dollarBudget']); if ($values['name'] !== '') { if ($this->hasTickets($id) && $values['state'] == 1) { $tpl->setNotification('PROJECT_HAS_TICKETS', 'error'); } else { $this->editProject($values, $id); //Take the old value to avoid nl character $values['details'] = $_POST['details']; $tpl->setNotification('PROJECT_EDITED', 'success'); } } else { $tpl->setNotification('NO_PROJECTTNAME', 'error'); } } //Add Account if (isset($_POST['accountSubmit']) === true) { $accountValues = array('name' => $_POST['accountName'], 'kind' => $_POST['kind'], 'username' => $_POST['username'], 'password' => $_POST['password'], 'host' => $_POST['host'], 'projectId' => $id); if ($accountValues['name'] !== '') { $this->addProjectAccount($accountValues); $tpl->setNotification('ACCOUNT_ADDED', 'sucess'); } else { $tpl->setNotification('NO_ACCOUNT_NAME', 'error'); } $tpl->assign('accountValues', $accountValues); } //Upload file if (isset($_POST['upload']) === true) { if ($_FILES['file']['name'] !== '') { $upload = new fileupload(); $upload->initFile($_FILES['file']); if ($upload->error == '') { //Name on Server is encoded $newname = md5($id . time()); $upload->renameFile($newname); if ($upload->upload() === true) { $fileValues = array('encName' => $upload->file_name, 'realName' => $upload->real_name, 'date' => date("Y-m-d H:i:s"), 'ticketId' => $id, 'userId' => $_SESSION['userdata']['id']); $this->addFile($fileValues); $tpl->setNotification('FILE_UPLOADED', 'success'); } else { $tpl->setNotification('ERROR_FILEUPLOAD', 'error'); } } else { $tpl->setNotification('ERROR_FILEUPLOAD', 'error'); } } else { $tpl->setNotification('NO_FILE', 'error'); } } $helper = new helper(); $clients = new clients(); $user = new users(); $tpl->assign('availableUsers', $user->getAll()); //Assign vars $tpl->assign('info', $msgKey); $tpl->assign('clients', $clients->getAll()); $tpl->assign('values', $values); $tpl->assign('files', $this->getFiles($id)); $tpl->assign('helper', $helper); $tpl->assign('accounts', $this->getProjectAccounts($id)); $tpl->display('projects.editProject'); } else { $tpl->display('general.error'); } } else { $tpl->display('general.error'); } }
default: $orderQuery = "`datetime`"; } switch ($_GET['dir']) { case 'desc': $orderQuery .= " DESC"; abr('orderDir', 'asc'); break; default: $orderQuery .= " ASC"; abr('orderDir', 'desc'); } if (isset($_POST['user'])) { $_GET['user'] = $_POST['user']; } if (!isset($_GET['user'])) { $_GET['user'] = ''; } if (is_numeric($_GET['user'])) { $whereQuery .= " AND `user_id` = '" . intval($_GET['user']) . "' "; } $data = $cms->getAll(START, LIMIT, " `status` = 'active' " . $whereQuery, $orderQuery); abr('data', $data); $p = paging("?m=" . $_GET['m'] . "&c=list&p=", "&q=" . $_GET['q'] . "&order=" . $_GET['order'] . "&dir=" . $_GET['dir'] . "&user=" . $_GET['user'], PAGE, LIMIT, $cms->foundRows); abr('paging', $p); #加载用户 require_once ROOT_PATH . '/apps/users/models/users.class.php'; $usersClass = new users(); $users = $usersClass->getAll(0, 0, '', '`username` ASC'); abr('users', $users); require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
// +---------------------------------------------------------------------- // | 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['featured_files']); abr('checkItemsType', 'yes'); require_once ROOT_PATH . '/apps/users/models/users.class.php'; $usersClass = new users(); #推荐作品 $sixMonthsAgo = date('Y-m-d', mktime(0, 0, 0, date('m') - 6, date('d'), date('Y'))); $items = $itemsClass->getAll(0, 0, " `status` = 'active' AND `weekly_to` >= '" . date('Y-m-d') . "' AND `weekly_to` >= '" . $sixMonthsAgo . "' ", "`datetime` DESC"); if (is_array($items)) { abr('topItem', array_shift($items)); $users = $usersClass->getAll(0, 0, $itemsClass->usersWhere); abr('users', $users); } abr('items', $items); #加载分类 require_once ROOT_PATH . '/apps/categories/models/categories.class.php'; $categoriesClass = new categories(); $categories = $categoriesClass->getAll(); abr('categories', $categories); #推荐作者 $featuredAuthors = $usersClass->getAll(0, 0, " `status` = 'activate' AND `featured_author` = 'true' "); abr('featuredAuthors', $featuredAuthors); #面包屑 abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'items/feature/" title="">' . $langArray['featured_files'] . '</a>');
case 'referal_money': $orderQuery = "`referal_money`"; break; default: $orderQuery = "`username`"; } switch ($_GET['dir']) { case 'desc': $orderQuery .= " DESC"; abr('orderDir', 'asc'); break; default: $orderQuery .= " ASC"; abr('orderDir', 'desc'); } $data = $cms->getAll(START, LIMIT, $whereQuery, $orderQuery); if (is_array($data)) { #加载佣金分成 require_once ROOT_PATH . '/apps/percents/models/percents.class.php'; $percentsClass = new percents(); #加载余额 require_once ROOT_PATH . '/apps/users/models/balance.class.php'; $balanceClass = new balance(); $percents = $percentsClass->getAll(); foreach ($data as $k => $d) { $comision = $percentsClass->getPercentRow($d); $data[$k]['commission'] = $comision['percent']; // if($data[$k]['commission_percent'] < 1) { // foreach($percents as $p) { // if($d['sold'] >= $p['from'] && ($d['sold'] < $p['to'] || $p['to'] == '0')) { // $data[$k]['commission'] = $p['percent'];
$contactsCount = 0; if ($contacts) { $contactsCount = count($contacts); } abr('contactsCount', $contactsCount); //举报评论处理 require_once ROOT_PATH . '/apps/items/models/comments.class.php'; $commentsClass = new comments(); $comments = $commentsClass->getAll(0, 0, " `report_by` <> '0' "); $commentCount = 0; if ($comments) { $commentCount = count($comments); } abr('commentCount', $commentCount); //举报评论处理 //已审核作品 $itemCheck = $items->getAll(0, 0, " `status` = 'active' "); $itemCount = 0; if ($itemCheck) { $itemCount = count($itemCheck); } abr('itemCount', $itemCount); //签约作者数量 require_once ROOT_PATH . '/apps/users/models/users.class.php'; $users = new users(); $usersCount = $users->getAll(0, 0, " `exclusive_author` = 'true' "); $qyuserCount = 0; if ($usersCount) { $qyuserCount = count($usersCount); } abr('qyuserCount', $qyuserCount);
refresh('/' . $languageURL . 'sign_in/'); } if ($_SESSION['user']['quiz'] != 'true') { refresh('/' . $languageURL . 'make_money/become_an_author/'); } require_once ROOT_PATH . '/apps/items/models/orders.class.php'; $ordersClass = new orders(); $weekStats = $ordersClass->getWeekStats(); abr('weekStats', $weekStats); #最新评论 require_once ROOT_PATH . '/apps/items/models/comments.class.php'; $commentsClass = new comments(); $comments = $commentsClass->getAll(0, 100, " `owner_id` = '" . intval($_SESSION['user']['user_id']) . "' AND `reply_to` = '0' ", true, '`datetime` DESC'); if (is_array($comments)) { $usersClass = new users(); $users = $usersClass->getAll(0, 0, $commentsClass->usersWhere); abr('users', $users); } abr('comments', $comments); require_once ROOT_PATH . '/apps/items/models/orders.class.php'; $ordersClass = new orders(); if (isset($_POST['ajax'])) { $month = get_id(2); $year = get_id(3); $text = ''; $sales = $ordersClass->getAll(" `paid_datetime` > '" . date('Y-m-d 23:59:59', mktime(0, 0, 0, $month - 1, date('t', mktime(0, 0, 0, $month - 1, 1, $year)), $year)) . "' AND `paid_datetime` < '" . date('Y-m-d 00:00:00', mktime(0, 0, 0, $month + 1, 1, $year)) . "' AND `paid` = 'true' AND `type` = 'buy' AND `owner_id` = '" . intval($_SESSION['user']['user_id']) . "' ", "`paid_datetime` ASC"); if (is_array($sales)) { $buff = array(); foreach ($sales as $s) { $day = explode(' ', $s['paid_datetime']); $day = explode('-', $day[0]);
} switch ($_GET['sort_by']) { case 'name': $order = '`username`'; break; case 'average_rating': $order = '`rating`'; break; case 'sales_count': $order = '`sales`'; break; default: $order = '`register_datetime`'; break; } $users = $usersClass->getAll($start, $limit, " `status` = 'activate' AND (`username` = '" . sql_quote($s) . "' OR `profile_desc` LIKE '%" . sql_quote($s) . "%') ", "{$order} ASC"); abr('results', $users); abr('paging', paging('/' . $languageURL . 'search/?type=users&term=' . $s . '&p=', '&sort_by=' . $_GET['sort_by'], PAGE, $limit, $usersClass->foundRows)); break; #在用户中结束搜索 #在用户中结束搜索 case 'collections': abr('type', 'collections'); require_once ROOT_PATH . '/apps/collections/models/collections.class.php'; $collectionsClass = new collections(); if (!isset($_GET['sort_by'])) { $_GET['sort_by'] = ''; } else { $_GET['sort_by'] = htmlspecialchars($_GET['sort_by']); } switch ($_GET['sort_by']) {
require_once ROOT_PATH . '/apps/categories/models/categories.class.php'; $categoriesClass = new categories(); $categories = $categoriesClass->getAll(); abr('categories', $categories); #近期作品 $recentItems = $itemsClass->getAll(0, 40, " `status` = 'active' ", '`datetime` DESC'); kshuffle($recentItems); abr('recentItems', $recentItems); //免费作品 $freeItem = $itemsClass->getAll(0, 0, " `status` = 'active' AND `free_file` = 'true' "); abr('freeItem', $freeItem); #推荐作者 require_once ROOT_PATH . '/apps/users/models/users.class.php'; $usersClass = new users(); //获取用户信息及粉丝 $featuredAuthor = $usersClass->getAll(0, 0, " `status` = 'activate' AND `featured_author` = 'true' ", 'RAND()'); // if(is_array($featuredAuthor)) { // //作者的一些作品 // $featuredItems = array(); // foreach($featuredAuthor as $itear){ // $featuredItems[$itear['user_id']] = $itemsClass->getAll(0, 2, " `status` = 'active' AND `user_id` = '".intval($itear['user_id'])."' "); // } // abr('featuredItems', $featuredItems); // abr('featuredAuthorInfo', langMessageReplace($langArray['featured_author_info'], array( // 'USERNAME' => $featuredAuthor['username'], // 'MONTH' => $langArray['monthArr'][date('n', strtotime($featuredAuthor['register_datetime']))], // 'YEAR' => date('Y', strtotime($featuredAuthor['register_datetime'])), // 'ITEMS' => $featuredAuthor['items'], // 'SALES' => $featuredAuthor['sales'] // ))); // }
abr('total', $total); $ref = $ordersClass->getSalesStatus(" AND `datetime` > '" . date('Y-m') . "-01 00:00:00' ", 'referal'); $sales = $ordersClass->getSalesStatus(" AND `datetime` > '" . date('Y-m') . "-01 00:00:00' "); if (is_array($sales)) { $sales['referal'] = $ref['receive']; $sales['win'] = floatval($sales['total']) - floatval($sales['receive']) - floatval($sales['referal']); abr('sales', $sales); } unset($ref); #LOAD USERS COUNT require_once ROOT_PATH . '/apps/users/models/users.class.php'; $usersClass = new users(); // $users['month'] = $usersClass->getUsersCount(" `register_datetime` > '".date('Y-m')."-01 00:00:00' AND `status` = 'activate' "); // $users['total'] = $usersClass->getUsersCount(" `status` = 'activate' "); abr('users', $users); $topAuthors = $usersClass->getAll(0, 5, " `status` = 'activate' ", "`sales` DESC"); abr('topAuthors', $topAuthors); #LOAD WITHDRAW require_once ROOT_PATH . '/apps/users/models/deposit.class.php'; $depositClass = new deposit(); $withdraw['no'] = $depositClass->getWithdrawCount(" `paid` = 'false' AND `datetime` > '" . date('Y-m') . "-01 00:00:00' "); $withdraw['paid'] = $depositClass->getWithdrawCount(" `paid` = 'true' AND `paid_datetime` > '" . date('Y-m') . "-01 00:00:00' "); abr('withdraw', $withdraw); #LOAD THEMES require_once ROOT_PATH . '/apps/items/models/items.class.php'; $itemsClass = new items(); $items = $itemsClass->getAll(0, 10, " `status` = 'queue' "); abr('items', $items); $updated_items = $itemsClass->getAllForUpdate(0, 10); abr('updated_items', $updated_items); #LOAD LAST REQUEST
addErrorMessage($langArray['error_item_comment'], '', 'error'); } } elseif (isset($_POST['add_reply'])) { if (!isset($_POST['comment_id'])) { $_POST['comment_id'] = 0; } $s = $commentsClass->add($_POST['comment_id']); if ($s === true) { refresh('/' . $languageURL . 'items/comments/' . $itemID, $langArray['complete_add_reply'], 'complete'); } else { addErrorMessage($langArray['error_item_comment'], '', 'error'); } } $comments = $commentsClass->getAll(START, LIMIT, " `item_id` = '" . intval($itemID) . "' AND `reply_to` = '0' ", true, '`datetime` ASC'); if (is_array($comments)) { $users = $usersClass->getAll(0, 0, $commentsClass->usersQuery); abr('users', $users); $ordersClass = new orders(); $buyFromUsers = $ordersClass->isItemBuyed($itemID, $commentsClass->usersQuery); abr('buyFromUsers', $buyFromUsers); } abr('comments', $comments); abr('paging', paging('/' . $languageURL . 'items/comments/' . $itemID . '/?p=', '', PAGE, LIMIT, $commentsClass->foundRows)); #标签标记作品 require_once ROOT_PATH . '/apps/items/controllers/bookmark.php'; #是否免费文件 if ($item['free_file'] == 'true') { abr('freeFileMessage', langMessageReplace($langArray['free_file_info'], array('URL' => '/' . $languageURL . 'users/downloads/' . $item['id']))); } #加载其它作品 $otherItems = $itemsClass->getAll(0, 7, " `status` = 'active' AND `id` <> '" . intval($itemID) . "' ", "RAND()");
<?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['top_authors']); $usersClass = new users(); $limit = 60; $start = (PAGE - 1) * $limit; abr('number', $start + 1); $users = $usersClass->getAll($start, $limit, " `items` > 0 AND `status` = 'activate' ", "`sales` DESC"); abr('users', $users); abr('paging', paging('/' . $languageURL . 'top_authors/?p=', '', PAGE, $limit, $usersClass->foundRows)); #面包屑 abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'users/top/" title="">' . $langArray['top_authors'] . '</a>');