Inheritance: extends dbconnection
Example #1
1
<?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__);
$itemID = get_id(2);
$itemsClass = new items();
$item = $itemsClass->get($itemID);
if (!is_array($item) || check_login_bool() && $item['status'] == 'unapproved' && $item['user_id'] != $_SESSION['user']['user_id'] || $item['status'] == 'queue' || $item['status'] == 'extended_buy') {
    header("HTTP/1.0 404 Not Found");
    header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
}
abr('item', $item);
Example #2
0
 public static function getItemsForGame($pack)
 {
     $sql_items = dbconnection::queryArray("SELECT * FROM items WHERE game_id = '{$pack->game_id}'");
     $items = array();
     for ($i = 0; $i < count($sql_items); $i++) {
         if ($ob = items::itemObjectFromSQL($sql_items[$i])) {
             $items[] = $ob;
         }
     }
     return new return_package(0, $items);
 }
Example #3
0
// +----------------------------------------------------------------------
// | 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__);
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    refresh('?m=' . $_GET['m'] . '&c=list', 'WRONG ID', 'error');
}
$cms = new comments();
if (isset($_GET['report']) && is_numeric($_GET['report'])) {
    $cms->reported($_GET['report']);
}
$data = $cms->getAll(START, LIMIT, " `item_id` = '" . $_GET['id'] . "' ");
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=comments&id=" . $_GET['id'] . "&p=", "", PAGE, LIMIT, $cms->foundRows);
abr('paging', $p);
$itemsClass = new items();
$item = $itemsClass->get($_GET['id']);
_setTitle($item['name'] . ' &rsaquo; ' . $langArray['comments']);
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
 function actionSearchitem()
 {
     $request = yii::$app->request;
     $page = $request->get('page');
     $content = $request->get('content');
     $items = new items();
     $countpage = $items->getItempages_s($content, 5);
     $result = $items->AdminSearchItems($content, $countpage, $page, 5);
     if ($result) {
         $msg = '<thead><tr><td>编号</td><td>状态</td><td>姓名</td><td>项目名</td><td>时间</td><td>通过|不通过|详细</td></tr></thead><tbody>';
         foreach ($result as $key => $value) {
             $msg .= '<tr><td>' . ($key + 1) . '</td><td>' . $this->adminStatusThatHumanCanRead($value['Status']) . '</td><td>' . $value['username'] . '</td><td>' . $value['Item_Name'] . '</td><td>' . $value['Date'] . '</td><td><div class=\\"Set_dele glyphicon glyphicon-ok\\" onclick=\\"ItemPass(' . $value['Item_Id'] . ')\\"></div>|<div class=\\"Set_dele glyphicon glyphicon-remove\\" onclick=\\"ItemFail(' . $value['Item_Id'] . ')\\"></div>|<div class=\\"Set_dele glyphicon glyphicon-eye-open\\" onclick=\\"ItemDescribe(' . $value['Item_Id'] . ')\\"></div></td></tr>';
         }
         echo '{"success":true,"msg":"' . $msg . '","allpage":"' . $countpage . '"}';
     } else {
         echo '{"success":true,"msg":"没有项目","allpage":"' . $countpage . '"}';
     }
 }
Example #5
0
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
include '../autoloader.php';
echo "<p>getting itemsp<p>";
$ownersItemsCollection = items::getByOwner(1);
var_dump($ownersItemsCollection);
echo "<p>get All<p>";
$results = $ownersItemsCollection->getAll();
var_dump($results);
echo "<p>displaying JSON<p>";
$ownerItemJSON = $ownersItemsCollection->getAllJSON();
var_dump($ownerItemJSON);
Example #6
0
    $name = $category['name'];
    $link = '?category=' . $_GET['category'];
}
if (isset($_GET['user'])) {
    $whereQuery .= " AND `user_id` = '" . intval($_GET['user']) . "' ";
    require_once ROOT_PATH . '/apps/users/models/users.class.php';
    $usersClass = new users();
    $user = $usersClass->get($_GET['user']);
    $name = $user['username'];
    if ($link == '') {
        $link = '?user='******'user'];
    } else {
        $link .= '&user='******'user'];
    }
}
echo "<?phpxml version=\"1.0\" encoding=\"utf-8\" ?>\n<rss version=\"2.0\">\n<channel>\n<title>" . $config['domain'] . " - " . $name . " RSS</title>\n<link>http://" . $config['domain'] . "/rss/" . $link . "</link>\n<description></description>\n";
#####加载
require_once ROOT_PATH . '/apps/items/models/items.class.php';
$itemsClass = new items();
$rows = $itemsClass->getAll(0, 20, " `status` = 'active' " . $whereQuery, "`datetime` DESC");
if (is_array($rows)) {
    foreach ($rows as $r) {
        echo "\n\t\t\t\t<item>\n\t\t\t\t\t<title><![CDATA[ " . $r['name'] . " ]]></title>\n\t\t\t\t\t<link>http://" . $config['domain'] . "/" . $languageURL . "items/" . $r['id'] . "</link>\n\t\t\t\t\t<description><![CDATA[\n\t\t\t";
        if ($r['thumbnail'] != '') {
            echo "<a href=\"http://" . $config['domain'] . "/" . $languageURL . "items/" . $r['id'] . "\"><img src=\"" . $config['data_server'] . "/uploads/items/" . $r['id'] . "/" . $r['thumbnail'] . "\" alt=\"\" border=\"0\" style=\"float:left; margin:0 10px 0 0;\" /></a>";
        }
        echo "<br />" . mb_substr(strip_tags($r['description']), 0, 200) . "";
        echo "]]></description>\n\t\t         <guid>http://" . $config['domain'] . "/" . $languageURL . "items/" . $r['id'] . "</guid>\t\t          \n\t\t      </item>\n\t\t\t";
    }
}
echo "\n</channel>\n</rss>\n";
Example #7
0
    abr('hideForm', 'true');
} else {
    if (!isset($_POST['category'])) {
        $_POST['category'] = 0;
    }
    $categoriesSelect = $categoriesClass->generateSelect($allCategories, $_POST['category'], $_GET['category']);
    abr('categoriesSelect', $categoriesSelect);
    #加载属性
    require_once ROOT_PATH . '/apps/attributes/models/attributes.class.php';
    $attributesClass = new attributes();
    $attributes = $attributesClass->getAllWithCategories(" `visible` = 'true' AND `categories` LIKE '%," . (int) $_GET['category'] . ",%' ");
    abr('attributes', $attributes);
    #保存作品
    if (isset($_POST['upload'])) {
        require_once ROOT_PATH . '/apps/items/models/items.class.php';
        $itemsClass = new items();
        $s = $itemsClass->add();
        if ($s === true) {
            refresh('/' . $languageURL . 'author_dashboard/', $langArray['complete_upload_item'], 'complete');
        } else {
            $message = '<ul>';
            foreach ($s as $e) {
                $message .= '<li>' . $e . '</li>';
            }
            $message .= '</ul>';
            addErrorMessage($message, '', 'error');
        }
    }
    $fileTypes = '';
    foreach ($config['upload_ext'] as $ext) {
        if ($fileTypes != '') {
Example #8
0
// +----------------------------------------------------------------------
// | 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['queue']);
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    refresh('?m=' . $_GET['m'] . '&c=queue_update', 'WRONG ID', 'error');
}
if (!isset($_GET['p'])) {
    $_GET['p'] = '';
}
$cms = new items();
require_once ROOT_PATH . '/apps/users/models/users.class.php';
$usersClass = new users();
$data = $cms->getForUpdate($_GET['id']);
//获取所有预览图
$data['preview'] = $itemsClass->get_theme_preview($data['item_id'], true);
$data['preview_status'] = 0;
if (empty($data['theme_preview'])) {
    $data['preview_status'] = 1;
}
//路径
$data["thumbnail"] = empty($data["thumbnail"]) ? "" : DATA_SERVER . '/uploads/items/' . $data['item_id'] . '/' . $data["thumbnail"];
$data["first_preview"] = empty($data["first_preview"]) ? "" : DATA_SERVER . '/uploads/items/' . $data['item_id'] . '/' . $data["first_preview"];
$data["main_file"] = empty($data["main_file"]) ? "" : DATA_SERVER . '/uploads/items/' . $data['item_id'] . '/' . $data["main_file"];
abr('data', $data);
$item = $cms->get($data['item_id']);
        }
        $item = $mtg->format($db->fetch_single());
        return $link == true ? '<a href="items.php?action=info&amp;ID=' . $id . '">' . $item . '</a>' : $item;
    }
    public function listAll($ddname = 'item', $selected = null, $notIn = [], $pure = '')
    {
        global $db, $mtg;
        $first = $selected == null ? 0 : 1;
        $ret = '<select name="' . $ddname . '"' . ($pure ? ' class="' . $pure . '"' : '') . '><option value="0"' . ($selected == null ? ' selected="selected"' : '') . '>--- Select ---</option>';
        $first = 1;
        $extra = '';
        if (count($notIn)) {
            $extra .= ' WHERE `id` NOT IN(' . implode(',', $notIn) . ') ';
        }
        $db->query('SELECT `id`, `name` FROM `items` ' . $extra . ' ORDER BY `name` ASC');
        $db->execute();
        $rows = $db->fetch_row();
        foreach ($rows as $row) {
            $ret .= "\n" . '<option value="' . $row['id'] . '"';
            if ($selected == $row['id'] || !$first || isset($_POST[$ddname]) && $_POST[$ddname] == $row['id']) {
                $ret .= ' selected="selected"';
                $first = 1;
            }
            $ret .= '>' . $mtg->format($row['name']) . ' [' . $mtg->format($row['id']) . ']</option>';
        }
        $ret .= "\n" . '</select>';
        return $ret;
    }
}
$items = items::getInstance();
Example #10
0
// +----------------------------------------------------------------------
// | 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['queue']);
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    refresh('?m=' . $_GET['m'] . '&c=queue', 'WRONG ID', 'error');
}
if (!isset($_GET['p'])) {
    $_GET['p'] = '1';
}
$cms = new items();
require_once ROOT_PATH . '/apps/users/models/users.class.php';
$usersClass = new users();
$data = $cms->get($_GET['id'], false);
$data['preview'] = $cms->get_theme_preview($_GET['id']);
$data['user'] = $usersClass->get($data['user_id']);
//路径
$data["thumbnail"] = DATA_SERVER . '/uploads/items/' . $_GET['id'] . '/' . $data["thumbnail"];
$data["theme_preview"] = DATA_SERVER . '/uploads/items/' . $_GET['id'] . '/' . $data["theme_preview"];
$data["main_file"] = DATA_SERVER . '/uploads/items/' . $_GET['id'] . '/' . $data["main_file"];
abr('data', $data);
if (isset($_POST['submit'])) {
    if ($_POST['action'] == 'approve') {
        $s = $cms->approve($_GET['id']);
        if ($s == true) {
            refresh("?m=" . $_GET['m'] . "&c=queue&p=" . $_GET['p'], $langArray['complete_approve_item']);
Example #11
0
 /**
  * Deletes a product
  * 
  * If no product ID is passed or if it does not match a valid product ID in the database, an error
  * message is generated.  Otherwise the product is deleted and a success message is generated.  In either
  * case the user is redirected to the products index.
  */
 public function actionDelete()
 {
     testProject::setAlert('There was a problem with your request.  Please try again.', 'error');
     if (isset($_GET['value'])) {
         //check if ID is provided
         $model = items::model()->getByPK($_GET['value']);
         $name = $model->name;
         if ($model->delete()) {
             //attempt to delete the item
             testProject::setAlert('The item ' . $name . ' was deleted.', 'info');
         }
     }
     $this->redirect('items/index');
 }
Example #12
0
    $user_badges[] = array('name' => $badges_data['system']['location_global_community']['name'], 'photo' => '/uploads/badges/' . $badges_data['system']['location_global_community']['photo']);
}
if ($user['power_elite_author'] == 'true' && isset($badges_data['system']['power_elite_author'])) {
    if ($badges_data['system']['power_elite_author']['photo'] && file_exists(DATA_SERVER_PATH . "/uploads/badges/" . $badges_data['system']['has_been_featured']['photo'])) {
        $user_badges[] = array('name' => $badges_data['system']['power_elite_author']['name'], 'photo' => '/uploads/badges/' . $badges_data['system']['power_elite_author']['photo']);
    }
}
if ($user['elite_author'] == 'true' && isset($badges_data['system']['elite_author'])) {
    if ($badges_data['system']['elite_author']['photo'] && file_exists(DATA_SERVER_PATH . "/uploads/badges/" . $badges_data['system']['has_been_featured']['photo'])) {
        $user_badges[] = array('name' => $badges_data['system']['elite_author']['name'], 'photo' => '/uploads/badges/' . $badges_data['system']['elite_author']['photo']);
    }
}
abr('user_badges', $user_badges);
#加载用户作品
require_once ROOT_PATH . '/apps/items/models/items.class.php';
$itemsClass = new items();
$items = $itemsClass->getAll(0, 0, " `status` = 'active' AND `user_id` = '" . intval($_SESSION['user']['user_id']) . "' ");
abr('items', $items);
#更改密码
if (isset($_POST['change_password'])) {
    $usersClass = new users();
    $s = $usersClass->editNewPassword();
    if ($s === true) {
        refresh('/' . $languageURL . 'edit/', $langArray['complete_change_password'], 'complete');
    } else {
        $message = '<ul>';
        foreach ($s as $e) {
            $message .= '<li>' . $e . '</li>';
        }
        $message .= '</ul>';
        addErrorMessage($message, '', 'error');
Example #13
0
             break;
     }
     $collections = $collectionsClass->getAll($start, $limit, " `public` = 'true' AND (`name` = '" . sql_quote($s) . "' OR `text` LIKE '%" . sql_quote($s) . "%') ", false, "{$order} ASC");
     if (is_array($collections)) {
         $users = $usersClass->getAll(0, 0, $collectionsClass->usersWhere);
         abr('users', $users);
     }
     abr('results', $collections);
     abr('paging', paging('/' . $languageURL . 'search/?type=collections&term=' . $s . '&p=', '&sort_by=' . $_GET['sort_by'], PAGE, $limit, $collectionsClass->foundRows));
     break;
     #在书签集中结束搜索
 #在书签集中结束搜索
 default:
     abr('type', 'files');
     require_once ROOT_PATH . '/apps/items/models/items.class.php';
     $itemsClass = new items();
     if (!isset($_GET['sort_by'])) {
         $_GET['sort_by'] = '';
     } else {
         $_GET['sort_by'] = htmlspecialchars($_GET['sort_by']);
     }
     switch ($_GET['sort_by']) {
         case 'name':
             $order = '`name` ASC';
             break;
         case 'average_rating':
             $order = '`rating` DESC';
             break;
         case 'sales_count':
             $order = '`sales` DESC';
             break;
Example #14
0
 include_once $config['system_core'] . "/initEngine.php";
 require_once ROOT_PATH . "/apps/categories/models/categories.class.php";
 $categoriesClass = new categories();
 if (is_numeric($categoryID)) {
     $allCategories = $categoriesClass->getAll(0, 0, " `visible` = 'true' ");
     $categoryParent = $categoriesClass->getCategoryParents($allCategories, $categoryID);
     $categoryParent = explode(',', $categoryParent);
     $categoryParent = array_reverse($categoryParent);
     array_shift($categoryParent);
     $whereQuery = " AND `id` IN (SELECT `item_id` FROM `items_to_category` WHERE `categories` LIKE '%," . intval($categoryID) . ",%') ";
 } else {
     $categoryParent = array('data' => '');
 }
 require_once ROOT_PATH . '/apps/items/models/items.class.php';
 require_once ROOT_PATH . '/apps/users/models/users.class.php';
 $itemsClass = new items();
 $users = new users();
 $order = '`datetime` DESC';
 $items = $itemsClass->getAll(0, 40, " `status` = 'active' " . $whereQuery, $order);
 $categories = $categoriesClass->getAll();
 $res_data = array();
 foreach ($items as $data) {
     //用户信息
     $user_info = $users->getuserinfoById($data['user_id']);
     $data['user_info']['item-author'] = $user_info['nickname'];
     $item_categories = array();
     foreach ($data['categories'] as $cat) {
         foreach ($cat as $c_cat) {
             $item_categories[] = $categories[$c_cat]['name'];
         }
     }
Example #15
0
        die;
    }
}
if (isset($_POST['q'])) {
    $_GET['q'] = $_POST['q'];
}
if (!isset($_GET['q'])) {
    $_GET['q'] = '';
}
if (!isset($_GET['order'])) {
    $_GET['order'] = '';
}
if (!isset($_GET['dir'])) {
    $_GET['dir'] = '';
}
$cms = new items();
$whereQuery = '';
if (trim($_GET['q']) != '') {
    $whereQuery = " AND `name` LIKE '%" . sql_quote($_GET['q']) . "%' ";
}
$orderQuery = '';
switch ($_GET['order']) {
    case 'name':
        $orderQuery = "`name`";
        break;
    case 'price':
        $orderQuery = "`price`";
        break;
    case 'sales':
        $orderQuery = "`sales`";
        break;
Example #16
0
<?php

if ($_POST) {
    include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php';
    include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/items.php';
    $database = new database();
    $db = $database->getConnection();
    $items = new items($db);
    $items->item_kode = $_POST['object_id'];
    if ($items->delete()) {
        echo "Jasa berhasil dihapus.";
    } else {
        echo "Jasa tidak bisa dihapus.";
    }
}
Example #17
0
 $kode = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Kode Error.');
 include_once $path . '/pages/header.php';
 echo "<div class='row'>";
 //echo "<div class='container'>";
 echo "<div class='col-sm-3'>";
 include_once $path . '/pages/sidebarmenu.php';
 echo "</div>";
 include_once $path . '/objects/items.php';
 $items = new items($db);
 $items->item_kode = $kode;
 $items->ShowOne();
 echo "<div class='container'>";
 echo "<div class='col-md-9'> ";
 if ($_POST) {
     include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/items.php';
     $items = new items($db);
     $items->item_kode = $_POST['item_kode'];
     $items->item_name = $_POST['item_name'];
     $items->item_note = $_POST['item_note'];
     $items->isavailable = $_POST['isavailable'];
     $items->harga = $_POST['harga'];
     $items->item_type = 'BARANG';
     //$_POST['item_type'];
     if ($items->update()) {
         echo "<div class='alert alert-success alert-dismissable'>";
         echo "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>";
         echo "Data Barang berhasil di Ubah.";
         echo "</div>";
     } else {
         echo "<div class='alert alert-danger alert-dismissable'>";
         echo "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>";
Example #18
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/items/models/items.class.php';
$items = new items();
$queue = $items->getAll(0, 0, " `status` = 'queue' ");
$queueCount = 0;
if ($queue) {
    $queueCount = count($queue);
}
abr('queueCount', $queueCount);
//更新队列审核
$update = $items->getAllForUpdate();
$updateCount = 0;
if ($update) {
    $updateCount = count($update);
}
abr('updateCount', $updateCount);
//提现队列审核
require_once ROOT_PATH . '/apps/users/models/deposit.class.php';
$deposit = new deposit();
$deposit = $deposit->getWithdraws('', '', ' paid = "false"');
Example #19
0
// +----------------------------------------------------------------------
// | 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: &quot;script&quot;, type: &quot;post&quot;, url: &quot;/' . $languageURL . 'items/weekly/?p=' . (PAGE - 1) . '&quot;}); 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) {
        $a_kat = $i['categories'];
Example #20
0
 /**
  * @en Generating all permutations of a given array
  * @ru Получение всех возможны вариантов перестановок элементов массива
  *
  * $array = array('AAA', 'BBB', 'CCC');
  *
  * $result = arrays::permutation($array); # Array
  *                                        # (
  *                                        #     [0] => Array
  *                                        #     (
  *                                        #         [0] => AAA
  *                                        #         [1] => BBB
  *                                        #         [2] => CCC
  *                                        #     )
  *                                        #
  *                                        #     [1] => Array
  *                                        #     (
  *                                        #         [0] => AAA
  *                                        #         [1] => CCC
  *                                        #         [2] => BBB
  *                                        #     )
  *                                        #
  *                                        #     [2] => Array
  *                                        #     (
  *                                        #         [0] => BBB
  *                                        #         [1] => CCC
  *                                        #         [2] => AAA
  *                                        #     )
  *                                        #
  *                                        #     [3] => Array
  *                                        #     (
  *                                        #         [0] => BBB
  *                                        #         [1] => AAA
  *                                        #         [2] => CCC
  *                                        #     )
  *                                        #
  *                                        #     [4] => Array
  *                                        #     (
  *                                        #         [0] => CCC
  *                                        #         [1] => AAA
  *                                        #         [2] => BBB
  *                                        #     )
  *                                        #
  *                                        #     [5] => Array
  *                                        #     (
  *                                        #         [0] => CCC
  *                                        #         [1] => BBB
  *                                        #         [2] => AAA
  *                                        #     )
  *                                        # )
  *
  * @param array $array
  *
  * @return array
  */
 public static function permutation($array)
 {
     $results = array();
     if (count($array) == 1) {
         $results[] = $array;
     } else {
         for ($i = 0; $i < count($array); $i++) {
             $first = array_shift($array);
             $subresults = items::permutation($array);
             array_push($array, $first);
             foreach ($subresults as $subresult) {
                 $results[] = array_merge(array($first), $subresult);
             }
         }
     }
     return $results;
 }
Example #21
0
if ($_SESSION['current_user'] != null) {
    include_once $path . '/config/database.php';
    $database = new database();
    $db = $database->getConnection();
    $page_title = "Data Barang";
    include_once $path . '/pages/header.php';
    echo "<div class='row'>";
    //echo "<div class='container'>";
    echo "<div class='col-sm-3'>";
    include_once $path . '/pages/sidebarmenu.php';
    echo "</div>";
    include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/items.php';
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $records_per_page = 20;
    $from_record_num = $records_per_page * $page - $records_per_page;
    $items = new items($db);
    //$statement = $items->ShowBarang2($from_record_num, $records_per_page);
    //		$statement = $items->readBarang($from_record_num, $records_per_page);
    $statement = $items->ShowBarang2($from_record_num, $records_per_page);
    $num = $statement->rowCount();
    echo "<div class='container'>";
    echo "<div class='col-md-9'>";
    //menampilkan barang
    if ($num > 0) {
        ?>
		
		<div>
		<div class="form-group pull-right">
					<input type="text" class="search form-control" placeholder="Apa Yang Anda Cari?">
				</div>
				<span class="counter pull-right"></span>
Example #22
0
if ($_SESSION['current_user'] != null) {
    include_once $path . '/config/database.php';
    $database = new database();
    $db = $database->getConnection();
    $page_title = "Data Jasa Salon";
    include_once $path . '/pages/header.php';
    echo "<div class='row'>";
    //echo "<div class='container'>";
    echo "<div class='col-sm-3'>";
    include_once $path . '/pages/sidebarmenu.php';
    echo "</div>";
    include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/items.php';
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $records_per_page = 20;
    $from_record_num = $records_per_page * $page - $records_per_page;
    $items = new items($db);
    $statement = $items->readJasa($from_record_num, $records_per_page);
    $num = $statement->rowCount();
    echo "<div class='container'>";
    echo "<div class='col-md-9'>";
    //menampilkan barang
    if ($num > 0) {
        ?>
		
		<div>
		<div class="form-group pull-right">
					<input type="text" class="search form-control" placeholder="Cari?">
				</div>
				<span class="counter pull-right"></span>
			<ol class="breadcrumb">
				<li><a href="/">Home</a></li>
Example #23
0
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['downloads_setTitle']);
if (!check_login_bool()) {
    $_SESSION['temp']['golink'] = '/' . $languageURL . 'download/';
    refresh('/' . $languageURL . 'sign_in/');
}
require_once ROOT_PATH . '/apps/items/models/orders.class.php';
$ordersClass = new orders();
#下载作品
$itemID = get_id(2);
if (is_numeric($itemID)) {
    require_once ROOT_PATH . '/apps/items/models/items.class.php';
    $itemsClass = new items();
    $item = $itemsClass->get($itemID);
    if (!is_array($item) || check_login_bool() && $item['status'] == 'unapproved' && $item['user_id'] != $_SESSION['user']['user_id'] || $item['status'] == 'queue') {
        header("HTTP/1.0 404 Not Found");
        header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
    }
    if (isset($_POST['rating'])) {
        $_GET['rating'] = $_POST['rating'];
    }
    if (isset($_GET['rating'])) {
        if (!isset($_GET['rating']) || !is_numeric($_GET['rating']) || $_GET['rating'] > 5) {
            $_GET['rating'] = 5;
        } elseif ($_GET['rating'] < 1) {
            $_GET['rating'] = 1;
        }
        $item = $itemsClass->rate($itemID, $_GET['rating']);
    public static function html($report)
    {
        ?>
		<table id="origin" class="plan" xmlns="http://www.w3.org/1999/html">

			<?php 
        static::html_head();
        ?>

			<tbody>
				<?php 
        $i = 1;
        $educations = education_preview::get_by_report(get('report_id'));
        $optional = [];
        foreach ($educations as $education) {
            ob_start();
            $items = education_items_preview::get_by_order($education->id);
            $summ = [];
            foreach ($items as $item) {
                if ($item->is_optional) {
                    $optional[] = $item;
                    continue;
                }
                ?>
<tr><?php 
                ?>
<td><?php 
                echo $i;
                ?>
</td><?php 
                ?>
<td class="text-left"><?php 
                echo $item->name;
                ?>
</td><?php 
                $vals = education_items_values_preview::get_by_education_item_id($item->id);
                for ($j = 0; $j < 41; $j++) {
                    ?>
<td><?php 
                    foreach ($vals as $val) {
                        if ($val->col_num - 1 == $j) {
                            echo $val->value;
                            if (!isset($summ[$j])) {
                                $summ[$j] = 0;
                            }
                            $summ[$j] += $val->value;
                            break;
                        }
                    }
                    ?>
</td><?php 
                }
                ?>
</tr><?php 
                $i++;
            }
            $buffer = ob_get_clean();
            ?>
						<tr class="borders">
							<td></td>
							<td class="text-left bold">
								<?php 
            echo $education->name;
            ?>
							</td>
							<?php 
            for ($j = 0; $j < 41; $j++) {
                ?>
<td><b><?php 
                echo get($j, $summ);
                ?>
</b></td><?php 
            }
            ?>
						</tr>
						<?php 
            echo $buffer;
        }
        ?>
			</tbody>
		</table>

		<table class="summary">
			<?php 
        static::html_head(true);
        ?>

			<tbody>
				<tr>
					<td>1</td>
					<td class="text-left bold">Количество часов учебных занятий</td>

					<?php 
        $educations = education_preview::get_by_report(get('report_id'));
        $items = [];
        foreach ($educations as $education) {
            $items = array_merge(education_items_preview::get_by_order($education->id), $items);
        }
        $item_ids = [];
        foreach ($items as $item) {
            $item_ids[] = $item->id;
        }
        $edication_items = education_items_values_preview::get_by_education_item_ids($item_ids);
        $summary = [];
        foreach ($edication_items as $item) {
            if (!isset($summary[$item->col_num])) {
                $summary[$item->col_num] = 0;
            }
            $summary[$item->col_num] += $item->value;
        }
        ksort($summary);
        for ($i = 0; $i < 40; $i++) {
            ?>
<td><?php 
            echo get($i + 2, $summary);
            ?>
</td><?php 
        }
        ?>
				</tr>

				<tr>
					<td>2</td>
					<td class="text-left bold">Количество курсовых проектов</td>

					<?php 
        for ($i = 0; $i < 40; $i++) {
            ?>
<td></td><?php 
        }
        ?>
				</tr>

				<tr>
					<td>3</td>
					<td class="text-left bold">Количество курсовых работ</td>

					<?php 
        for ($i = 0; $i < 40; $i++) {
            ?>
<td></td><?php 
        }
        ?>
				</tr>

				<tr>
					<td>4</td>
					<td class="text-left bold">Количество расчётных работ</td>

					<?php 
        for ($i = 0; $i < 40; $i++) {
            ?>
<td></td><?php 
        }
        ?>
				</tr>

				<tr>
					<td>5</td>
					<td class="text-left bold">Количество типовых расчётов</td>

					<?php 
        for ($i = 0; $i < 40; $i++) {
            ?>
<td></td><?php 
        }
        ?>
				</tr>

				<tr>
					<td>6</td>
					<td class="text-left bold">Количество экзаменов</td>

					<?php 
        for ($i = 0; $i < 40; $i++) {
            ?>
<td></td><?php 
        }
        ?>
				</tr>

				<tr>
					<td>7</td>
					<td class="text-left bold">Количество зачётов</td>

					<?php 
        for ($i = 0; $i < 40; $i++) {
            ?>
<td></td><?php 
        }
        ?>
				</tr>
			</tbody>
		</table>

		<div class="optionals">
			<table class="optional width-40">
				<tbody>
					<tr>
						<td class="bold" colspan="4">IV. Факультативные дисциплины</td>
					</tr>

					<tr>
						<td class="bold">№ п/п</td>
						<td class="bold">Название дисциплины</td>
						<td class="bold">Семестр</td>
						<td class="bold">Часов</td>
					</tr>

					<?php 
        foreach ($optional as $key => $item) {
            ?>
							<tr>
								<td><?php 
            echo $key + 1;
            ?>
</td>
								<td><?php 
            echo $item->name;
            ?>
</td>
								<td></td>
								<td></td>
							</tr>
							<?php 
        }
        ?>
				</tbody>
			</table>

			<table class="optional width-20">
				<tbody>
					<tr>
						<td class="bold width-20" colspan="4">V. Учебная практика</td>
					</tr>

					<tr>
						<td class="bold">№ п/п</td>
						<td class="bold">Название практики</td>
						<td class="bold">Семестр</td>
						<td class="bold">Недель</td>
					</tr>

					<?php 
        $lines = $report->study_practice;
        $lines = string::lines($lines);
        if ($lines) {
            foreach ($lines as $key => $line) {
                $vals = explode(' ', $line);
                ?>
								<tr>
									<td><?php 
                echo $key + 1;
                ?>
</td>
									<td><?php 
                echo items::get($vals, 1);
                ?>
</td>
									<td><?php 
                echo items::get($vals, 2);
                ?>
</td>
									<td><?php 
                echo items::get($vals, 3);
                ?>
</td>
								</tr>
								<?php 
            }
        }
        ?>
				</tbody>
			</table>

			<table class="optional width-20">
				<tbody>
					<tr>
						<td class="bold width-20" colspan="3">VI. Производственная практика</td>
					</tr>

					<tr>
						<td class="bold">Название практики</td>
						<td class="bold">Семестр</td>
						<td class="bold">Недель</td>
					</tr>

					<?php 
        $lines = $report->manufact_practice;
        $lines = string::lines($lines);
        if ($lines) {
            foreach ($lines as $key => $line) {
                $vals = explode(' ', $line);
                ?>
								<tr>
									<td><?php 
                echo items::get($vals, 1);
                ?>
</td>
									<td><?php 
                echo items::get($vals, 2);
                ?>
</td>
									<td><?php 
                echo items::get($vals, 3);
                ?>
</td>
								</tr>
								<?php 
            }
        }
        ?>
				</tbody>
			</table>

			<table class="optional width-10">
				<tbody>
					<tr>
						<td class="bold width-10">VII. Дипломные проекты или дипломные работы</td>
					</tr>

					<tr>
						<td><?php 
        echo $report->grad_work;
        ?>
</td>
					</tr>
				</tbody>
			</table>

			<table class="optional width-10">
				<tbody>
					<tr>
						<td class="bold width-10">VIII. Государственный экзамен</td>
					</tr>

					<tr>
						<td><?php 
        echo $report->gos_exam;
        ?>
</td>
					</tr>
				</tbody>
			</table>
		</div>

		<script>
			$(function()
			{
				report.paper.table.optional.format();
			});
		</script>

		<div class="page-break"></div>
		<?php 
    }
Example #25
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/users/models/users.class.php';
$usersClass = new users();
abr('usersCount', $usersClass->getUsersCount(" `status` = 'activate' "));
//作品数量
require_once ROOT_PATH . '/apps/items/models/items.class.php';
$itemsClass = new items();
abr('itemsCount', $itemsClass->getItemsCount());
$admin_config = array('show' => true, 'add' => true, 'list' => true, 'edit' => false);
Example #26
0
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
$tag_type = get_id(2);
$tag = get_id(3);
require_once ROOT_PATH . '/apps/tags/models/tags.class.php';
$tagsClass = new tags();
_setTitle($tag);
$t = $tagsClass->isExistTag($tag);
if (is_array($t)) {
    $itemsClass = new items();
    #加载书签集作品
    $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 'root_category':
            $order = '`categories`';
            break;
        case 'average_rating':
Example #27
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__);
$itemID = get_id(2);
$itemsClass = new items();
$item = $itemsClass->get($itemID);
if (!is_array($item) || check_login_bool() && $item['status'] == 'unapproved' && $item['user_id'] != $_SESSION['user']['user_id'] || $item['status'] == 'queue' || $item['status'] == 'extended_buy') {
    header("HTTP/1.0 404 Not Found");
    header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
}
_setTitle($item['name']);
abr('meta_description', substr(strip_tags($item['description']), 0, 255));
require_once ROOT_PATH . '/apps/users/models/users.class.php';
$usersClass = new users();
$item['user'] = $usersClass->get($item['user_id']);
abr('item', $item);
#添加FAQ条目
if (check_login_bool() && $item['user_id'] == $_SESSION['user']['user_id'] && isset($_POST['add'])) {
    $faqClass = new faq();
    $s = $faqClass->add($itemID);
    if ($s === true) {
        refresh('/' . $languageURL . 'items/faq/' . $itemID . '/', $langArray['complete_add_faq'], 'complete');
Example #28
0
$usersClass = new users();
if (check_login_bool() && ($username == '' || $username == $_SESSION['user']['username'])) {
    $username = $_SESSION['user']['username'];
    $whereQuery = " AND (`status` = 'active' OR `status` = 'unapproved' ) ";
} else {
    $whereQuery = " AND `status` = 'active' ";
}
$user = $usersClass->getByUsername($username);
if (!is_array($user)) {
    header("HTTP/1.0 404 Not Found");
    header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
}
abr('user', $user);
#加载作品
require_once ROOT_PATH . '/apps/items/models/items.class.php';
$itemsClass = new items();
$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 'root_category':
        $order = '`categories`';
        break;
    case 'average_rating':
        $order = '`rating`';
Example #29
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']['items'])) {
    require_once ROOT_PATH . "/apps/items/models/items.class.php";
    $cms = new items();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
} elseif (isset($_POST['deleteComment']) && isset($_POST['id']) && isset($_SESSION['user']['access']['items'])) {
    require_once ROOT_PATH . "/apps/items/models/comments.class.php";
    $cms = new comments();
    $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;
Example #30
0
 /**
  * @en Generating all permutations of a given string
  * @ru Строковая комбинаторика. Получение всех возможны вариантов перестановок элементов строки
  *
  *
  * $result = string::permutation('AAA BBB CCC DDD'); # Array
  *                                                   # (
  *                                                   #     [0] => AAA BBB CCC DDD
  *                                                   #     [1] => AAA BBB DDD CCC
  *                                                   #     [2] => AAA CCC DDD BBB
  *                                                   #     [3] => AAA CCC BBB DDD
  *                                                   #     [4] => AAA DDD BBB CCC
  *                                                   #     [5] => AAA DDD CCC BBB
  *                                                   #     [6] => BBB CCC DDD AAA
  *                                                   #     [7] => BBB CCC AAA DDD
  *                                                   #     [8] => BBB DDD AAA CCC
  *                                                   #     [9] => BBB DDD CCC AAA
  *                                                   #     [10] => BBB AAA CCC DDD
  *                                                   #     [11] => BBB AAA DDD CCC
  *                                                   #     [12] => CCC DDD AAA BBB
  *                                                   #     [13] => CCC DDD BBB AAA
  *                                                   #     [14] => CCC AAA BBB DDD
  *                                                   #     [15] => CCC AAA DDD BBB
  *                                                   #     [16] => CCC BBB DDD AAA
  *                                                   #     [17] => CCC BBB AAA DDD
  *                                                   #     [18] => DDD AAA BBB CCC
  *                                                   #     [19] => DDD AAA CCC BBB
  *                                                   #     [20] => DDD BBB CCC AAA
  *                                                   #     [21] => DDD BBB AAA CCC
  *                                                   #     [22] => DDD CCC AAA BBB
  *                                                   #     [23] => DDD CCC BBB AAA
  *                                                   # )
  *
  *
  * @param string $string Any string
  * @param string $delimiter
  *
  * @return array
  */
 public static function permutation($string, $delimiter = ' ')
 {
     $array = items::permutation(explode($delimiter, $string));
     $result = null;
     foreach ($array as $item) {
         $result[] = implode(' ', $item);
     }
     return $result;
 }