core/api/modules/lk-edit-tovar/class.php

62 lines
2.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class main extends MySQL{
var $db; // Здесь объект для работы с MySQL
var $id;
/*
function __construct($smarty, $settings){
if ( @$_SESSION['dostup'] !='a' && @$_SESSION['dostup'] !='e' )header( 'Location: /403/' );
@mkdir(MYDIR . '/img/pages_cat', 0700);
@mkdir(MYDIR . '/img/pages_cat/slider', 0700);
@mkdir(MYDIR . '/img/pages_cat/slider/' . ID, 0700);
@mkdir (MYDIR . '/img/slider/' . ID, 0700);
if( $settings['cachePage'] > 0 ){
$smarty -> caching = true;
$smarty -> cache_lifetime = $settings['cachePage'];
}
}*/
/* ----------------------------------------------------------------------
02.06.2022
Получаем информацию о пользователе
---------------------------------------------------------------------- */
function get_user_info(){
$a['id'] = $_SESSION['user_id'];
$user = $this -> get_massiv( 'users', $a, 'json');
return $user;
}
function formatBytes( $bytes, $precision = 2 ) {
$units = array( 'B', 'KB', 'MB', 'GB', 'TB' );
$bytes = max( $bytes, 0 );
$pow = floor( ( $bytes ? log ( $bytes ) : 0 ) / log( 1024 ) );
$pow = min ( $pow, count( $units ) - 1 );
return round ( $bytes, $precision ) . ' ' . $units[$pow];
}
/* ----------------------------------------------------------------------
09.06.2022
Получаем историю заказов
---------------------------------------------------------------------- */
function get_orders( $limit=20 ){
$a['user_id'] = $_SESSION['user_id'];
$this -> or_by_desc = 1;
$orders = $this -> get_massiv( 'order', $a, 'id', $limit );
unset( $db -> or_by_desc );
$count = count($orders);
for ($i=0; $i < $count; $i++){
$orders[$i]['t']=date("H:i d.m.Y", $orders[$i]['t']);
unset($a);
$a['id']=$orders[$i]['status'];
$orders[$i]['status']=$this->get_val('order_status', $a, 'txt');
}
return $orders;
}
}
?>