Beispiel #1
0
<?php

$ans = array('title' => 'Необходимо установленный flexslider через bower. И подключение (не проверяется).');
if (!infra_theme('bower_components/flexslider/jquery.flexslider-min.js')) {
    return infra_err($ans, 'bower_components/flexslider/jquery.flexslider-min.js не найден');
}
return infra_ret($ans, 'Дистрибутив есть');
Beispiel #2
0
    $conf = infra_config();
    return infra_err($ans, $conf['subscribe']['msg']);
}
if (strlen($_REQUEST['email']) > 1000) {
    return infra_err($ans, 'Слишком много данных. ' . $conf['subscribe']['msg']);
}
$email = strip_tags($_REQUEST['email']);
$email = trim($email);
$email = infra_forFS($email);
$agent = $_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['REMOTE_ADDR'];
session_start();
if (empty($_SESSION['submit_time'])) {
    $_SESSION['submit_time'] = 0;
}
if (time() - $_SESSION['submit_time'] < 60) {
    return infra_err($ans, 'Письмо уже отправлено! Новое сообщение можно будет отправить через 1 минуту!');
}
$_SESSION['submit_time'] = time();
$data = array('email' => $email, 'agent' => $agent, 'ip' => $ip, 'host' => $_SERVER['HTTP_HOST']);
$body = infra_template_parse('*order.tpl', $data);
infra_mail_toAdmin('Запрос ' . $data['host'] . ' ' . $email, 'noreplay@' . $data['host'], $body);
$dirs = infra_dirs();
$src = $dirs['data'] . '.subscribe.json';
$subs = infra_loadJSON($src);
if (!$subs) {
    $subs = array();
}
$subs[$email] = date('d.m.Y');
file_put_contents($src, infra_json_encode($subs));
return infra_ret($ans, 'Ваша заявка принята');
Beispiel #3
0
    }
    $link = $_GET['link'];
    $link = $link . '/producers';
    $ans['external'] = '*catalog/seo.json';
    $ans['canonical'] = infra_view_getPath() . '?' . $link;
    return infra_ans($ans);
}
$fd = Catalog::initMark($ans);
if (isset($_GET['lim'])) {
    $lim = $_GET['lim'];
} else {
    $lim = '0,20';
}
$p = explode(',', $lim);
if (sizeof($p) != 2) {
    return infra_err($ans, 'Is wrong paramter lim');
}
$start = (int) $p[0];
$count = (int) $p[1];
$args = array($start, $count);
$list = Catalog::cache('producers.php', function ($start, $count) {
    $ans = array();
    $conf = infra_config();
    $data = Catalog::init();
    $prods = array();
    Xlsx::runPoss($data, function (&$pos) use(&$prods) {
        @$prods[$pos['Производитель']]++;
    });
    arsort($prods, SORT_NUMERIC);
    $prods = array_slice($prods, $start, $count);
    return $prods;
Beispiel #4
0
    if (!$pos) {
        return infra_err($ans, 'Position not found');
    }
    $link = $_GET['seo'];
    $link = $link . '/' . $pos['producer'] . '/' . $pos['article'];
    $ans['external'] = '*catalog/seo.json';
    $ans['canonical'] = infra_view_getPath() . '?' . $link;
    return infra_ans($ans);
}
$ans = array('val' => $val, 'prod' => $prod, 'art' => $art);
$ans['breadcrumbs'] = array();
//Путь где я нахожусь
$conf = infra_config();
$ans['breadcrumbs'][] = array('title' => $conf['catalog']['title']);
if ($pos) {
    $ans['result'] = 1;
    $ans['path'] = $pos['path'];
    $pos = Catalog::getPos($pos);
    $ans['pos'] = $pos;
    array_map(function ($p) use(&$ans) {
        $ans['breadcrumbs'][] = array('title' => $p, 'add' => 'group::group.' . $p . ':1');
    }, $pos['path']);
    $ans['breadcrumbs'][] = array('add' => 'producer::producer.' . $orig_val . ':1', 'title' => $orig_val);
    $ans['breadcrumbs'][] = array('title' => $orig_art);
    return infra_ret($ans);
} else {
    $ans['breadcrumbs'][] = array('href' => 'producers', 'title' => 'Производители');
    $ans['breadcrumbs'][] = array('href' => '', 'title' => $orig_val, 'add' => 'producer::producer.' . $orig_val . ':1');
    $ans['breadcrumbs'][] = array('title' => $orig_art);
    return infra_err($ans);
}
Beispiel #5
0
<?php

$ans = array();
if (isset($_GET['seo'])) {
    if (empty($_GET['link'])) {
        return infra_err($ans, 'Wrong parameters');
    }
    $link = $_GET['link'];
    $link = $link . '/find';
    $ans['external'] = '*catalog/seo.json';
    $ans['canonical'] = infra_view_getPath() . '?' . $link;
    return infra_ans($ans);
}
$ans = infra_loadJSON('*catalog/search.php');
$ans['breadcrumbs'] = array();
$conf = infra_config();
$ans['breadcrumbs'][] = array('href' => '', 'title' => $conf['catalog']['title']);
$menu = infra_loadJSON('*catalog/menu.json');
$ans['breadcrumbs'][] = array('href' => 'find', 'title' => $menu['find']['title']);
$ans['menu'] = $menu;
return infra_ret($ans);
Beispiel #6
0
$dirs = infra_dirs();
$dir = $dirs['data'];
$data = infra_loadJSON($dir . 'catalog_stat.json');
if (!$data) {
    $data = array('users' => array(), 'cat_id' => 0, 'time' => time());
    //100 10 user list array('val'=>$val,'time'=>time())
}
if (!$submit) {
    $conf = infra_config();
    $ans['text'] = infra_loadTEXT('*files/get.php?' + $conf['catalog']['dir'] . '/articals/stat');
    $ans['stat'] = $data;
    return infra_ret($ans);
}
$val = strip_tags(@$_GET['val']);
if (!$val) {
    return infra_err($ans, 'Incorrect parameters');
}
infra_cache_no();
$val = infra_forFS($val);
$val = infra_toutf($val);
$id = infra_view_getCookie('cat_id');
$time = infra_view_getCookie('cat_time');
if (!$time || !$id || $time != $data['time']) {
    $id = ++$data['cat_id'];
    infra_view_setCookie('cat_id', $id);
    infra_view_setCookie('cat_time', $data['time']);
}
$ans['cat_id'] = $id;
$ans['cat_time'] = $time;
$user = array('cat_id' => $id, 'list' => array(), 'time' => time());
foreach ($data['users'] as $k => $v) {
Beispiel #7
0
        return infra_err($ans, 'You are already logged in.');
    }
    if ($submit) {
        $email = trim(strip_tags($_POST['email']));
        if (!User::checkData($email, 'email')) {
            return infra_err($ans, 'You must specify a valid email address.');
        }
        $userData = infra_session_getUser($email);
        $password = trim($_POST['password']);
        if (md5($email . $password) != $userData['password']) {
            return infra_err($ans, 'Wrong password or email.');
        }
        infra_session_change($userData['session_id']);
        $ans['go'] = '?user';
        return infra_ret($ans, 'You are logged in.');
    }
}
if ($type == 'logout') {
    if (!$myemail) {
        return infra_err($ans, 'You are not logged in.');
    }
    if ($submit) {
        infra_session_logout();
        $ans['go'] = '?user';
        return infra_ret($ans, 'Your status guest.');
    }
}
if ($type == 'user') {
    $ans['verify'] = infra_session_getVerify();
}
return infra_ret($ans);
Beispiel #8
0
<?php

$ans = array();
$ans['title'] = 'Check GD extension';
if (!function_exists('imagecreatetruecolor')) {
    return infra_err($ans, 'GD required');
}
return infra_ret($ans, 'ok');
Beispiel #9
0
<?php

$ans = array('title' => 'Проверка обработчиков каталога - позиция, группа, производители, рубрики и тп.');
$data = infra_loadJSON('*catalog/rubrics.php');
if (!$data) {
    return infra_err($ans, 'Ошибка rubrics.php');
}
$data = infra_loadJSON('*catalog/producers.php');
if (!$data) {
    return infra_err($ans, 'Ошибка producers.php');
}
$data = infra_loadJSON('*catalog/stat.php');
if (!$data) {
    return infra_err($ans, 'Ошибка stat.php');
}
return infra_ret($ans);